Time for a wake up!

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Time for a wake up!

Postby mzimmers » Wed Jul 11, 2018 11:37 pm

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...

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Time for a wake up!

Postby kolban » Thu Jul 12, 2018 12:27 am

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: Time for a wake up!

Postby mzimmers » Fri Jul 13, 2018 5:50 pm

It seems that designating a GPIO pin as a wake-up source disables any other ISR handler that was previously added. Just a note...

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: Time for a wake up!

Postby mzimmers » Tue Jul 17, 2018 4:26 pm

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?

Who is online

Users browsing this forum: Majestic-12 [Bot] and 101 guests