Deep SleepIn this mode ESP has only Realtime clock running, and after set time, it will set reset pin to low through GPIO16 pin, then ESP resets and wakes up.
To be able to wake up ESP you need to connect reset and GPIO16 pins together.
Remember that ESP always start program execution from the beginning after waking up from deep sleep.
Note that while these pins are connected you might not be able to flash new sketch. You can try to flash by resetting ESP at just a right moment. But better way is to but switch between RST and GPIO16 pin, so you can disable deep sleep functionally temporary.
Waking ESP from external source
Also if you need to wake ESP from external source like door switch you can put it between ground and RST pin. I will show this with my todays example "Mailbox monitor"
First of all, you should choose ESP board with no extra features like one that don’t have power led on all the time.
I'm using Wemos D1 mini and have measured that it uses only 60 µA in deep sleep mode.
With this consumption you can run ESP for months with battery.
Of course, depends what you do with it between sleeps. I have tested application that measures battery voltage every half hours and sends it to internet, and it has been running with AAA batteries for one month now and has dropped only 0.5 volts.
The lowest power consumption is achieved by feeding the ESP directly from the 5V line, in my test it took 3.5 mA on deep sleep if powered via USB connector, and 0.060 mA from 5V line.
Specs for Wemos D1 mini regulator(RT9013) says you can power up to 5,5 volts(Absolute Maximum 6.0v)
3 x AA battery = (Empty) 3,3V - (Full) ~4,8V
4 x AA battery = (Empty) 4.4V – (Full) ~6,4 V
4 x NiMh AA battery = 4.0V - (Full) ~6.0 V
Using 3 Batteries is fine by specs, but you can’t power 5v sensors with that, and on my test ESP was shut down at 3.5V so you can’t fully utilize full battery capacity.
Using 4 Batteries is over spec, and can fry your ESP.
So best would be using 4 batteries that are not brand new, and together measures about 5.6 volts.
Or if you have 1.2V NiMh batteries, they would be ideal.
In one of my projects I’m using 4 x AA batteries and have been lucky that everything works fine.
Also on project that don’t use 5V sensors I have used 3 x AA batteries.
I will cover usage of Li-Po/Li-Ion batteries in another post.