make ESP8266 do a specific task at precise time
Posted: Wed Nov 28, 2018 8:00 am
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?
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?