ABC of Electronics cosycom.com
EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 72

ESP32: Wi-Fi Connection and Deep Sleep

Connect, send, sleep.

A typical battery sensor wakes, joins the Wi-Fi network, sends one reading, and returns to deep sleep. In deep sleep most of the chip is off, and only a timer or special pins stay alive.

Joining Wi-Fi is the costly part, since the radio draws high current. Store the access point details to speed reconnection and shorten awake time.

Variables normally vanish in deep sleep; use the small memory that survives if you need to keep a counter.