ESP32 Deep Sleep & Battery Power — From Hours to Months
The ESP32's headline battery trick is deep sleep: the chip drops to tens of microamps and wakes on a timer, a GPIO edge, or the ULP coprocessor. In practice, most people's battery projects die at weeks — not because the chip is bad, but because the dev board leaks milliamps and the wake cycle is wrong. This guide closes that gap.
Quick answer: Four levers decide battery life: sleep mode (deep sleep ≈ 0.01–0.15 mA, light sleep ≈ 0.8 mA), what's on the board (a dev board's USB bridge + regulator + power LED adds 1–10 mA permanently — remove or power-gate them), the duty cycle (awake 1% vs 10% is a 10× runtime difference), and the battery's usable capacity (80% of nameplate). Measure your real sleep current once — the battery-life calculator then predicts weeks vs months honestly.
The sleep modes in one table
| Mode | Typical current (chip) | Keeps | Typical use |
|---|---|---|---|
| Modem sleep | ~10–40 mA | CPU + RAM, Wi-Fi off | short waits between sends |
| Light sleep | ~0.8 mA | RAM, wake on timer | frequent but slow reporting |
| Deep sleep | 0.01–0.15 mA | RTC memory only | reporting every minute or slower |
| Hibernation | ~0.002–0.01 mA | nothing | long unattended sensing |
Wake sources
Timer (esp_sleep_enable_timer_wakeup) for periodic reporting; GPIO (ext0 — any pin, edge; ext1 — a set of pins, wake on any) for door/motion sensors; touch wake on chips with touch pins; and the ULP coprocessor for wake-on-analog-threshold without waking the main CPU. For periodic sensors, timer wake is the 95% case. The RTC memory holds a small state blob through deep sleep — enough for a sequence number or calibration, not for your heap.
The dev-board leak (the thing most people miss)
A typical dev board draws 1–10 mA with the chip in deep sleep, because the USB-UART bridge, regulator quiescent current and power LED are all on the board, not powered by the chip. The fix is choosing hardware: a bare module with an external 3.3 V regulator and a battery connector, or a board explicitly built for batteries. If you must keep the dev board, cut the power LED and consider desoldering the bridge or feeding it from an I/O pin that goes low during sleep. Whatever you do, measure — the number on the spec sheet is the chip's, not yours.
A battery-life prediction recipe
1) Measure sleep current with the board in deep sleep (µA mode on the meter). 2) Measure or estimate active average — for Wi-Fi transmits, 80–120 mA typical. 3) Pick the duty cycle your sensor needs. 4) Run the battery-life calculator. If the answer is days and you need months, the first lever is the dev-board leak, the second is duty cycle, and only then battery size — 10× gains come from sleep current, not from doubling mAh.
Frequently Asked Questions
How low can an ESP32 deep sleep current go?
Can I wake the ESP32 from deep sleep with a button?
Does deep sleep keep my Wi-Fi connection?
How do I measure the sleep current without special gear?
What's the difference between deep sleep and the ULP?
More tools used in this guide
Battery runtime for microcontroller projects: enter capacity, active current, duty cycle and sleep current to get real-world battery life in hours and days — the way it actually behaves on an ESP32-class board.
Interactive pinout for the ESP32 family: click any pin on a DevKitC V4, S3-DevKitC-1, C3-DevKitM-1 or C6-DevKitC-1 to see its GPIO number, every official function, and the boot-time traps — transcribed from Espressif's official header tables.
Two-resistor voltage divider: output voltage, divider current and dissipation — plus the R2 value that hits a target voltage, and the ESP32 ADC limits that decide whether your reading will actually be stable.
More guides
10 starter projects in the right order: from blink to Wi-Fi to your first cloud dashboard, with the hardware list and the wiring traps each one teaches.