-->
Page 1 of 4

I tested esp8622 time keeping without RTC

PostPosted: Sun May 22, 2016 8:53 am
by ectoplasma
Hey everyone,

If anyone here is wondering how well an arduino or esp8266 keeps track of time on its own (without using a real time clock unit), I tested it for you:

http://www.instructables.com/id/TESTED- ... -WITHOUT-/

Spoiler: only about one second off every day.

Any suggestions on improving the code would be more than welcome. I just read that millis() resets every 50 days, so I am gonna have to write some code to deal with that.

Re: I tested esp8622 time keeping without RTC

PostPosted: Wed Jun 08, 2016 9:51 am
by lotus49
That's interesting. I am building a time-based one time password activated device and keeping reasonably accurate time is a core requirement. I had been wondering whether a hardware RTC would be necessary but given that I can access NTP servers from the ESP8266, I may not need one if the clock is reasonably accurate.

Thank you.

Re: I tested esp8622 time keeping without RTC

PostPosted: Wed Jun 08, 2016 10:00 am
by eriksl
BTW my experience is that ntp isn't implemented correctly (at least in the newest SDK versions, don't know about older ones). The time is only fetched once and after that it's never adjusted. And believe me, that's necessary, the built-in RTC clock runs about 1 hour fast on 24 hours.

So I worked around that by every ten minutes stopping ntp and starting it again, and then you will get periodic adjustment.

Re: I tested esp8622 time keeping without RTC

PostPosted: Wed Jun 08, 2016 10:15 am
by chaeplin
With Timlib by PaulStoffregen, sync is done every 5 min and can be adjusted.
https://github.com/PaulStoffregen/Time/ ... 66WiFi.ino
https://github.com/PaulStoffregen/Time/ ... #L312-L321