Search code examples
httpiotesp8266batteryconsumption

HTTP request vs RTC battery consumption ESP8266


I just wanted to know, what is more efficient

  • Using NTPClient library and making an http request to get the time.
  • 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


Solution

  • I'm starting to work on a project that use both RTC and NTP running on battery and using deep sleep.

    The advantage of using RTC module (in my case with i2c protocol) is that to get the time you need tens of ms, instead of using NTP for which you need 1 or 2 seconds at least depending on the library used.

    Furthermore, the use of an RTC module is much more reliable as there is no possibility of connection problems or anything else. During my tests the RTC module has never failed, on the contrary, the wifi/internet/ntp connection sometimes has failed.

    The RTC module can be programmed offline and then mounted in the circuit. It has a back-up battery that should guarantee a duration of a couple of years (like a wristwatch). In my case (as also recommended by Marcel Stör) I will use date and time coming from the RTC module and only once a week I will try the calibration using the NTP protocol.

    At last but not least, keep in mind that many iot cloud platforms accept only the data and as a timestamp use that of receiving stream itself and not one provided by the device.

    Then, for battery saving (and reliability), is better to use RTC.