OTD ACADEMY
Sign in / Sign up
Library

LIBRARYPower modes and sleep.

Sleep modes shut down parts of a microcontroller to cut current from milliamps to microamps. Why sleep current dominates battery life, with a runtime calculator.

A microcontroller does not have to run flat out. Sleep modes shut down parts of the chip to cut its current from milliamps down to microamps, and on a battery that is the difference between hours and months. A board that spends almost all of its time asleep can run for a very long time on a small cell.

Active, light sleep, deep sleep

In active mode the CPU and radio run and the chip draws the most current. Light sleep pauses the CPU but keeps its state and memory alive, so it wakes quickly and picks up where it left off. Deep sleep powers down almost everything, keeping only a tiny always-on domain, which drops the current to microamps but loses most of the chip's state, so it effectively restarts on wake. Each step trades responsiveness for lower current.

What wakes it

A sleeping chip wakes on a source you configure ahead of time: a timer after a set interval, a pin changing level, or a peripheral event. A typical sensor node deep-sleeps on a timer, wakes, takes a reading, sends it over the radio, and goes back to sleep, spending a few milliseconds awake for every several seconds asleep.

Why sleep dominates battery life

When a board is awake for a few milliseconds and asleep for seconds at a stretch, the sleep current sets the average almost by itself, and the brief active current barely counts. Halving the deep-sleep current can nearly double the runtime, while shaving the active current barely moves the needle. That is why low-power design chases deeper, more frequent sleep; slowing the CPU down barely helps.

Iavg=Iactivetactive+Isleeptsleeptactive+tsleepI_{avg} = \frac{I_{active}\, t_{active} + I_{sleep}\, t_{sleep}}{t_{active} + t_{sleep}}

Inputs

Result

13 h 20 m

estimated runtime

13.3 hours at 120 mA average

Estimate runtime from battery capacity and average current.
Deep dive· What stays powered in deep sleep

On the ESP32 a small low-power domain stays alive through deep sleep: an RTC timer to keep time and wake the chip, a little RTC memory, and a few RTC-capable GPIOs that can serve as wake pins. Everything else, the main cores and most peripherals, is powered off, which is where the microamp current comes from. Because normal RAM is lost, you stash the handful of bytes you need to survive the restart (a counter, a state flag) in that RTC memory, and read them back on wake. (Espressif ESP-IDF sleep modes)

A current-versus-time trace of a wake-measure-sleep cycle: a brief tall active spike, then a long flat microamp sleep floor, repeating.
A wake-measure-sleep cycle: the long, low sleep floor is what sets the battery life.

Checkpoint

Quick check

What mostly determines a battery board's life if it sleeps most of the time?
What is the main trade-off of deep sleep versus light sleep?
What can wake a sleeping ESP32?
0 / 3 correct

One Thousand Drones engineering team · verified 2026-07