Hi,
I need you to check and correct my thoughts.
I’m learning energy saving in ESP32 and found a thing which looks strange for me.
Let’s consider a standard weather station sending its sensor data to the Blynk server every 5 min (300 sec). It consumes about 200 mA when active and a little energy when sleeps: 0.8 mA in Light Sleep, 0.15 mA in Deep Sleep (0.15 in ULP on, 0.01mA if ULP off, I do not turn off ULP now)
Looking to my Light Sleep sketch I see:
Starting v2.02
[61] Connecting to XXX
[1151] Connected to WiFi
[1151] IP: 192.168.6.59
[1151]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / ’ /
/ / /_, / // / /_
/ __/ v0.6.1 on ESP32
[1224] Connecting to [ha2.r-as.ru:9443](http://ha2.r-as.ru:9443/)
[2663] Certificate OK
[3264] Ready (ping: 600ms).
[3656] Time sync: OK
[3793] 0 38.849396
11:30:25 25°С 39%
Brightness Slider VPIN_Bright value is: 2
[3861] Voltage: 3160.50
MQTT connecting …connected
[4121] Subscribe: 1
[5123] Go to sleep in 1 sec…
[126123] Bootcount: 1
[126128] Connecting to [ha2.r-as.ru:9443](http://ha2.r-as.ru:9443/)
[128358] Certificate OK
[128859] Ready (ping: 500ms).
[129250] Time sync: OK
Brightness Slider VPIN_Bright value is: 2
[129388] 1 38.681549
11:32:30 25°С 39%
[129454] Voltage: 4002.25
[129523] Go to sleep in 1 sec…
[250524] Bootcount: 2
That means that after restart it takes 5 sec [5123] to start, initialize WiFi, connect to Blynk, run the measurement cycle, send everything to Blynk and MQTT and go to Light Sleep.
It wakes up at [126123], repeat the cycle and goes to Light Sleep again at [129523]
129523-126123 = 3400 (3.5 sec)
Looking to other cycles we see the same picture:
[1487300] Bootcount: 12
Wakeup caused by touchpad
[1487304] Connecting to ha2.r-as.ru:9443
[1489071] Certificate OK
[1489574] Ready (ping: 501ms).
[1489964] Time sync: OK
Brightness Slider VPIN_Bright value is: 0
[1490101] 0 38.704437
11:54:56 24°С 39%
[1490169] Voltage: 4004.00
[1490239] Go to sleep in 1 sec…
[1611239] Bootcount: 13
1490239-1487300 = 2939 (3 sec)
So I expect that restart after Deep Sleep takes longer than running a cycle after Light Sleep (extra initialization required, etc). But “active” time is a major energy consumption!
5 sec * 200 mA (Active) + 295 sec * 0.15 mA (Deep) = 1000 + 44.25 = 1044 mAsec
3 sec * 200 mA (Active) + 297 sec * 0.8 mA (Light) = 600 + 237.6 = 838 mAsec
2 sec saving (shorter Active period when using Light Sleep) makes total energy consumption per cycle less then in Deep Sleep. These 2 sec beets even Hibernation extra saving.
I guess ESP8266 looks similar. And as it requires external RTC memory to save variables, some hardware modifications to wake up (connect RST to another pin) Light Sleep may become a good alternative to the Deep Sleep.
What do you think?