Page 1 of 1
Time for a wake up!
Posted: Wed Jul 11, 2018 11:37 pm
by mzimmers
My app runs on a device that has to be able to run on a battery for 24 hours. Currently, battery life is about 1/4 that. This doesn't particularly concern me because I haven't yet done anything to try to conserve battery life. The first thing I think I should look at is entering a low-power mode (AKA light sleep). I'd be doing this for about a minute, then waking to send a short transmission, and then returning to light sleep.
There are three things that ideally would wake me:
1. a one-minute timer (this is explained in the docs)
2. the press of a button attached to a GPIO
3. the receipt of a message via Wifi
The docs are a bit confusing on the last two. #3 isn't necessarily essential, but #2 is. Any suggestions?
Thanks...
Re: Time for a wake up!
Posted: Thu Jul 12, 2018 12:27 am
by kolban
Looking at the ESP32 Datasheet ... the radio is only on in Active mode which is full power and hence if you are in any other power saving mode you won't be able to be woken up by WiFi.
For the other modes:
* Modem-sleep
* Light-sleep
* Deep-Sleep
* Hibernation
It looks like light-sleep or deep-sleep will work for you. Those have power consumptions of 800uA and 150uA (if I am reading it correctly). In Light-sleep, you can be woken up by a timer or by any interrupt. So if you configure the GPIO on the button as an interrupt source, that should work.
If you need even more power saving, then hibernation mode is a candidate. However, in that mode, you must drop down to ULP assembler for those tasks.
Re: Time for a wake up!
Posted: Fri Jul 13, 2018 5:50 pm
by mzimmers
It seems that designating a GPIO pin as a wake-up source disables any other ISR handler that was previously added. Just a note...
Re: Time for a wake up!
Posted: Tue Jul 17, 2018 4:26 pm
by mzimmers
What does this mean?
In light sleep mode, digital peripherals, most of the RAM, and CPUs are clock-gated,
I thought I read somewhere that light sleep paused the CPU, but my program's behavior doesn't seem to reflect that. I was expecting all tasks to pause until a wakeup was triggered...is this not the expected behavior?
BTW: modem-sleep isn't mentioned in the current ESP32 docs; is that mode gone?