ESP32 Deep Sleep and Power Management Guide
Mastering ESP32 deep sleep and power management is essential when engineering battery-operated remote IoT sensor nodes. While active WiFi and dual-core processing draw between 120mA and 240mA, placing the ESP32 into deep sleep cuts current consumption down to 10 to 15 microamps on bare SoC designs.
1. Understanding ESP32 power domains
During deep sleep, the main CPU cores, high-speed RAM, and digital peripherals are completely powered down. The Ultra-Low Power (ULP) coprocessor, RTC fast/slow memory, and RTC peripherals remain operational, allowing the board to monitor external triggers while conserving energy.
2. Configuring wake-up triggers
The ESP32 supports multiple wake-up sources depending on your operational architecture:
- Timer Wakeup:
esp_sleep_enable_timer_wakeup(time_in_us)triggers periodic wakeups for automated data telemetry. - EXT0 Wakeup: Monitors a single RTC GPIO pin for high/low logic transitions using
esp_sleep_enable_ext0_wakeup(GPIO_NUM_X, 1). - EXT1 Wakeup: Uses a bitmask to monitor multiple RTC GPIOs simultaneously for door sensors or user button interrupts.
3. Preserving variables across wakeups in RTC memory
Because standard SRAM loses its state upon entering deep sleep, variables that must persist across reboots (such as boot counters, calibration offsets, or MQTT sequence IDs) must be declared with the RTC_DATA_ATTR prefix to store them in 8KB RTC fast memory. For chip comparison guidance, see our analysis on ESP32 vs ESP8266 selection[cite: 1].
4. Hardware bottlenecks: Low-dropout regulators and USB bridges
Standard development boards (like the NodeMCU-32S) feature onboard CP2102 USB-to-UART bridges and AMS1117 LDO regulators with high quiescent currents (5mA to 10mA). For genuine sub-milliamp battery lifespans, deploy custom boards utilizing low-quiescent LDOs (such as the ME6211) and remove unneeded power LEDs.
When to get help
If you'd rather have this handled directly, see our Embedded Systems Firmware Services for scope and turnaround times.