New RTC changes - what am i missing?

i have 0.4.4 library and 0.21.7 local server, using the example sketch, this is my output:

ÿ[29437] Connecting to SSID
[33440] Connected to WiFi
[33440] IP: 192.168.0.112
[33440]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.4.4 on ESP8266

[33446] Connecting to 192.168.0.7
[33469] Ready (ping: 10ms).
Current time: 0:0:43 Current time: 0:0:53 Current time: 0:1:3 Current time: 0:1:13 Current time: 0:1:23 Current time: 0:1:33 Current time: 0:1:43 Current time: 0:1:53 Current time: 0:2:3 Current time: 0:2:13 Current time: 0:2:23 Current time: 0:2:33 Current time: 0:2:43 Current time: 0:2:53 Current time: 0:3:3 Current time: 0:3:13 Current time: 0:3:23 Current time: 0:3:33 Current time: 0:3:43 Current time: 0:3:53 Current time: 0:4:3 Current time: 0:4:13 Current time: 0:4:23 Current time: 0:4:33

see how it starts at 00:00 - that’s not the time here…

this sketch:

/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  Blynk can provide your device with time data, like an RTC.
  Please note that the accuracy of this method is up to several seconds.

  App project setup:
    RTC widget (no pin required)
    Value Display M widget on V1
    Value Display M widget on V2

  WARNING :
  For this example you'll need SimpleTimer library:
    https://github.com/jfturcot/SimpleTimer

  And also this Time keeping library:
    https://github.com/PaulStoffregen/Time

  This code is based on an example from the Time library:
    https://github.com/PaulStoffregen/Time/blob/master/examples/TimeSerial/TimeSerial.ino
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "qwerty";
char ssid[] = "abc";
char pass[] = "123";

SimpleTimer timer;

WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");


  // Send time to the App
  Blynk.virtualWrite(V24, currentTime);
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 0, 7));

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html

  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);
}

void loop()
{
  Blynk.run();
  timer.run();
}

the 0.4.4 libraries:

I assume after moving the new libraries into this folder you closed the IDE, re-opened, then uploaded? One issue I had (and I have no idea how I managed to do this) was that I had two copies of some libraries and the IDE was pointing to the old location. Try searching your entire drive for another time.h file and see if anything else turns up.

1 Like

Did you add the RTC widget in your dashboard???

[4269] Connected to WiFi
[4269] IP: xxx.xxx.xxx.xxx
[4269] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.4 on Arduino

[4275] Connecting to xxx.xxx.xxx.xxx:xxxx
[4293] Ready (ping: 6ms).
[4306] Time sync: OK
Current time: 18:1:5 Current time: 18:1:15 Current time: 18:1:25 Current time: 18:1:35 Current time: 18:1:45 Current time: 18:1:55 

Your code and “my” spanish time!

2 Likes

@Dave1829 if you are still struggling add the following before rtc.begin()

setSyncInterval(1);

and then in the clock loop

if(year() == 1970){
    setSyncInterval(1);    
  }
else{
  setSyncInterval(300000);  // sync every 5 minutes
  // virtualWrite time to the app etc
}
3 Likes

Yeah, i don’t get “Time sync OK”… Thanks for verification of the code @psoro

I’ll quadruple check the libraries, the complier was silent on libraries though @structure7 weird…

If it still fails I’ll use @Costas manual sync.

But it should work, therefore im thinking library most possible… I’m just checking I hadn’t overlooked something basic…

No worries @Dave1829, it should be a silly thing… Try to remove the RTC widget and add it again…

Yes tried that… :slight_smile:

Ok…last thing before to go to sleep…Android App version? 2.7.1?

@Dave1829,
Are you still struggling with the RTC?
My curiosity goes one step before me…:blush:

We had a android phone crash here yesterday… My ‘projects’ took a massive back step until we could retrieve the phone’s unbackedup data… I’m going to redo the local server with whatever the latest version is… It’s the only bit i haven’t redone… And my VNC is not working either, which is making it difficult!

Oh oh…It doesn’t sound good… Good luck Dave…

Kind regards!!

1 Like

You basically stated the obvious…but was what was missing for me: RTC widget in dashboard!

I can say that for me, is working like a charm! Thanks guys.

was local server not updated properly (well, the autostart script to be precise),

at least i also fixed VNC :slight_smile: