Electricity/Powering the board/Power budget

Power budget

Battery life is one number — the average current — and it is almost never set by the thing you think. Wi-Fi bursts are cheap. The power LED nobody removed is not.

Switch parts in and out, then compare "always awake" against deep sleep. Watch what the power LED does to the second number.

One 18650, 2000 mAh
average current decides everything
What is in the build?
Wake up every15 min · 6 s awake
Average current
11.1 mA
Battery lasts
8 days
The working
172 mA × 0.67% + 10.01 mA idle
10.0 mA is awake while the board is asleep. The chip is down at 10 µA and the power led on the board and the ams1117 regulator are still drinking hundreds of times that. Sleeping harder cannot help — that is the ceiling until it comes off the board.

Average is the only number that matters

A battery's rating is in milliamp-hours: 2000 mAh will supply 2000 mA for an hour, or 1 mA for 2000 hours. Divide the capacity by your average current and you have the life.

Peaks matter for a different reason — the supply has to survive them without the rail sagging — but they contribute almost nothing to the total if they are short. An ESP32 that wakes, connects and sends — call it 120 mA for six seconds every fifteen minutes — averages 0.8 mA from the radio. Six seconds in nine hundred is two thirds of one percent of the time.

Where the current actually goes

ItemDrawNotes
ESP32 awake, radio on120–240 mAIn bursts, so cheap on average
ESP32 awake, radio off~40 mAExpensive if it never sleeps
ESP32 deep sleep~10 µAThe reason sleep works at all
Power LED on a dev board3–10 mANever sleeps. Usually the biggest cost
AMS1117 linear regulator~5 mA quiescentNever sleeps either
DHT22, LM75, most sensors1–2 mAOnly while being read

The arithmetic that decides a project. An ESP32 asleep at 10 µA lasts about twenty years on an 18650 — on paper. Add one 5 mA power LED and it lasts sixteen days. The sleep code was never the problem.

That is also why the radio is the wrong thing to optimise first. Averaged out it is smaller than the LED sitting next to it and smaller again than the regulator — and unlike either of them, it is buying you something.

Getting from days to months

  1. Deep sleep between readings. One line of code, and it changes the answer by three orders of magnitude.
  2. Remove or disable the always-on parts. Desolder the power LED, or pick a board that has none. Replace a linear regulator with a buck converter, or feed 3.3 V straight in and bypass it.
  3. Wake less often. This is worth doing only after step 2. Switch the LED and the regulator off in the figure above and the interval suddenly moves the answer by more than an order of magnitude; leave them on and no interval gets you past about a fortnight.
  4. Cut connection time. Most of an ESP32's awake period is spent getting onto Wi-Fi. A static IP and a stored channel can halve it.

Edit this page — content/fundamentals/electricity/power-budget.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum