NTPClient vs RTC battery consumption
Opened this issue · 1 comments
Hi, I just wanted to know, what is more efficient
- Using NTPClient library and making an http request
- Using a RTC and read the time from it.
Taking into account that I used deep sleep, and once it wakes up has to set up the wireless because I am sending data into cloud storage, but just before I get the time with the NTPClient library.
But I am thinking that I may save some battery if I use a RTC.
What do you think?
Thanks
Hi,
I've not worked a lot with deepsleep, but I guess internal esp8266 RTC still runs while in deepsleep, so millis() (which TimeLib is based on) should give you the right value.
Theoretically you could save offset between now() and millis() on RTC memory as soon as you get a correct sync and calculate new time on your setup function to reset time without NTP request. If you do that you do not need to resync on every wake.
Anyway, if all this sounds too complicated. An external RTC will fit your solution. NTP sync process may take a couple of seconds of WiFi activity. I2C communication will always be less battery hungry than WiFi.