Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Sbraaa
#79316 Hi!
I want that my ESP8266 do a specific task, once a day, at precise time (time will be hardcoded, if I need to change it I will flash again the ESP8266).
For this project ESP8266 will be powered by battery pack so I need a find the way to minimize power consumption: someone could advice me the best approach?

Polling the NTP service sound like a waste of time and power so I'm thinking something like this:

The first time my program runs on ESP8266 it connect to NTP service and set the current time.
Then it calculates the time difference between now and time set for task execution and fall to deep sleep mode for the calculated time difference.
When time has come, ESP8266 wakes up, execute the task, then go to deep sleep mode for 24H (once a day, remember?).

Is this the right way?
User avatar
By ebivan
#79331 I guess that wont be very precise. You are using a Battery, so I guess that the module will be located outside. Temperature change can mess up your timing.
Also, I guess you want to transmit some data, otherwise you wouldnt take a power hungry esp8266 for that project, right? So, for transmitting you will need to connect to your wifi and then transmit something. Both of which can take a different amount of time everytime you do it. And there, youre timing is messed up again.
You could use an RTC, like DS**** (I forgot the number) these are buffered by a coin cell, so they dont suck anything from your lipo while the esp sleeps. But remember to get the one that adjusts itself to temperature, the other ones tend to lose the correct time pretty fast.
User avatar
By Sbraaa
#79377
ebivan wrote:Found it, its called DS3231, its available as a module for about 2 bucks.


Thank you for the advice, I've just bought the DS3231!
Could you suggest me some links to alternative ways without using 8266?
Effectively I need to log some data but I'm also interested in making the same task without log any data.
Thank you in advace.