-->
Page 1 of 2

Deep sleep for more than 4,294,967,295 microseconds

PostPosted: Tue Nov 10, 2015 3:37 pm
by asfyra
As I read from the Internet, the parameter that holds the time to put the ESP to deep sleep is a uint32_t, with a max value of 4,294,967,295 microseconds. This translates to something like more than an hour.
For my project I need the ESP to wake up only once a day. How would you accomplish something like this?

Thanks in advance
Alex

Re: Deep sleep for more than 4,294,967,295 microseconds

PostPosted: Tue Nov 10, 2015 6:06 pm
by DrG
asfyra wrote:As I read from the Internet, the parameter that holds the time to put the ESP to deep sleep is a uint32_t, with a max value of 4,294,967,295 microseconds. This translates to something like more than an hour.
For my project I need the ESP to wake up only once a day. How would you accomplish something like this?

Thanks in advance
Alex


Try having it sleep for 60 minutes, wake up, increment a counter and go back to sleep unless the counter is at 24. Then it does it's thing and resets the counter before going back to sleep.

Alternatively, if you need more exact wake up times or more flexibility, you can use an external RTC (with a coin cell) power up the ESP to do its thing and then your ESP code turns off the alarm and powers off...until the RTC wakes it up again. That approach is being discussed at some length in this thread: viewtopic.php?f=13&t=5747

Hope this is of some help.

DrG

Re: Deep sleep for more than 4,294,967,295 microseconds

PostPosted: Wed Nov 11, 2015 12:13 am
by asfyra
DrG, thanks for your reply.
Your first approach sounds very interesting, but won't the counter reset every time the chip goes to sleep, or am I missing something?

Thanks again for your time
Alex

Re: Deep sleep for more than 4,294,967,295 microseconds

PostPosted: Wed Nov 11, 2015 1:01 am
by lethe
Normal RAM will indeed not survive deep sleep.
The RTC has a special block of RAM however, that will survive deep sleep. There is example code in the SDK API documentation and a low power demo on github.