Cheat sheet

Power budget worksheet

A fill-in worksheet and a tested Python script that turn a duty-cycle profile into average current and battery life, with a worked example and the checks to run before you trust the result.

Last verified 28 November 2026· tools/calc/power_budget.py, Python 3.12

This page is for anyone who needs a battery-life estimate for a device that wakes, does some work and sleeps again. It gives you a worksheet to fill in, the formula behind it, and a script (tools/calc/power_budget.py) that does the arithmetic so you do not have to. Every battery-life figure on this site is computed with that script, and its unit tests run on every change.

The model

A duty-cycled device repeats one period T, for example 300 s. Inside each period it runs a short list of active phases (boot, read a sensor, connect, transmit). Each phase has a mean current and a duration. For the rest of the period it sleeps. Some loads never switch off, such as a regulator’s quiescent current or a resistor divider on the battery, so they count for the whole period.

Quantity Formula
Charge per period, Q sum of (Iphase × tphase) + Isleep × (T − sum of tphase) + Ialways-on × T
Average current, Iavg Q / T
Self-discharge as a current, Isd C × (monthly self-discharge %) / 100 / 730 h
Usable capacity, Cusable C × usable fraction
Battery life, L Cusable / (Iavg + Isd)

C is the cell’s rated capacity in mAh. The usable fraction is your allowance for the regulator’s cut-off voltage, cold temperatures and cell ageing. The script does not know these for your cell, so it takes them as inputs. Treating self-discharge as a constant current is a simplification. It is good enough to show whether self-discharge matters at all for your design.

The worksheet

Copy this table and fill one row per phase. Write down where each number came from, because that is the first thing a reviewer will ask.

Phase Mean current Duration per period Where the number came from (measured, datasheet table, conditions)
Boot and sensor read mA s
Radio connect mA s
Transmit and wait for acknowledgement mA s
Sleep (rest of the period) µA T minus the phases above
Always-on loads µA whole period
Battery and period Value Notes
Period T s how often the device reports
Rated capacity C mAh from the cell datasheet, with its discharge conditions
Usable fraction 0 to 1 cut-off voltage, temperature, ageing
Self-discharge % per month from the cell datasheet

Where the numbers come from

  • Measure the whole board where you can. Put the meter between the battery and the board, so you capture the regulator, pull-ups and anything else on the rail. Our method is on /lab/methods/current-measurement/.
  • Mind the dynamic range. Espressif’s ESP-IDF v6.1.1 guide to measuring module current notes that deep-sleep current is in the microamp range and active current in the milliamp range. It says ordinary ammeters cannot switch ranges fast enough, and their internal resistance can drop enough voltage to leave the module underpowered. It recommends a meter with low internal resistance that switches range dynamically.
  • Devkits can isolate the module. The same guide says boards such as the ESP32-C5-DevKitC-1 have headers for measuring the module’s current. That gives you a module figure. Your battery still supplies everything else on your own board, so measure that too.
  • Datasheet figures carry conditions. If you take a current from a datasheet, copy the supply voltage, temperature, radio mode and whether it is typical or maximum into the “where from” column.
  • Durations matter as much as currents. A radio connect that takes 1.2 s instead of 0.3 s can dominate the budget. Measure the time from wake to sleep on a current trace, not from log timestamps.

Worked example

The inputs below are round illustrative numbers chosen to show the method. They are not measurements or datasheet figures for any chip, board or cell. This is the profile the script runs when you give it no file, copied from the script:

name = "Example (illustrative inputs): Wi-Fi sensor reporting every 5 minutes"
period_s = 300.0
sleep_ua = 20.0            # whole-board sleep current, measured at the battery terminals
always_on_ua = 5.0         # loads that never switch off (regulator quiescent current, dividers)
capacity_mah = 2000.0      # rated capacity of the cell
usable_fraction = 0.8      # share of rated capacity you expect to use (cut-off, temperature, ageing)
self_discharge_pct_per_month = 2.0

[[phase]]
name = "Boot and sensor read"
current_ma = 25.0
duration_s = 0.15

[[phase]]
name = "Wi-Fi connect, DHCP and TLS"
current_ma = 90.0
duration_s = 1.2

[[phase]]
name = "MQTT publish and acknowledgement"
current_ma = 110.0
duration_s = 0.25

Run it from the repository root:

python tools/calc/power_budget.py --sweep 60,300,900,3600,21600

The script prints this (output copied from the run on 28 November 2026):

Example (illustrative inputs): Wi-Fi sensor reporting every 5 minutes

Part of the period                                   Charge (µAh)    Share
Boot and sensor read (25 mA, 0.15 s)                        1.042     2.6%
Wi-Fi connect, DHCP and TLS (90 mA, 1.2 s)                 30.000    73.6%
MQTT publish and acknowledgement (110 mA, 0.25 s)           7.639    18.7%
Sleep (20 µA, 298.4 s)                                      1.658     4.1%
Always-on loads (5 µA, 300 s)                               0.417     1.0%
Total per period                                           40.755   100.0%

Average current: 489.1 µA over a 300 s period
Self-discharge as an equivalent current: 54.8 µA (2 % of 2000 mAh per month)
Usable capacity: 1600 mAh (80% of 2000 mAh)
Estimated life: 2,942 h = 123 days

Period (s)  Average (µA)  Life (days)  Sleep + always-on share
        60        2345.3           28                     1.0%
       300         489.1          123                     5.1%
       900         179.7          284                    13.9%
      3600          63.7          563                    39.2%
     21600          31.4          773                    79.5%

What the example shows

At a 5 minute period the Wi-Fi connection is 73.6 % of the charge. Shaving time off the connect phase (keeping the IP address, resuming the TLS session) is worth more here than lowering the sleep current. At a 6 hour period the picture flips: sleep and always-on loads take 79.5 % of the charge, and the sleep current becomes the number to chase.

Self-discharge in this example (54.8 µA equivalent) is larger than the sleep and always-on current combined (25 µA). With long periods it limits the life on its own, so read it from the cell’s datasheet rather than guessing.

02004006001 min5 min15 min1 h6 hestimated life (days)
Estimated battery life against reporting period for the illustrative profile above, computed by tools/calc/power_budget.py. The inputs are not measurements of any device.

Checks before you trust the result

  • Does each current carry its source and conditions in the worksheet?
  • Is the sleep current the whole board at the battery, not the chip’s datasheet figure?
  • Are retries included? A failed connection that retries three times triples that phase. Add a phase for the expected retry rate, or run the script twice with a typical and a bad case.
  • Is the usable fraction realistic for your regulator’s cut-off voltage and the coldest temperature the device will see?
  • Does the period include the slowest case (for example, a daily time sync or an OTA (over-the-air) update check)? Add it as a phase scaled to its share of each period.
  • Have you compared the estimate with one measured full cycle on the bench? If they disagree, find out why before quoting a life figure.

Running your own profile

python tools/calc/power_budget.py --template > my-device.toml
python tools/calc/power_budget.py --profile my-device.toml --sweep 60,300,3600
python -m unittest tools/calc/test_power_budget.py

The script uses only the Python standard library (Python 3.11 or newer for tomllib). Currents for phases are in mA, sleep and always-on currents in µA, times in seconds and capacity in mAh. It rejects a profile whose phases last longer than the period, and any negative input.

For makers

Measure one full wake cycle with a power profiler, read the phase currents and durations off the trace, and run the script with those numbers. Use the sweep to choose a reporting period that gives the life you want.

For product teams

Keep the profile file under version control next to the firmware, record the board revision and firmware commit each number was measured on, and rerun the budget whenever either changes. Budget for the worst case (cold, aged cell, retries) as well as the typical one.