Electronics

How long will the battery last? Power budgeting for battery-powered devices

Why a battery-powered device lives or dies by its average current; the shape of a wake-measure-transmit burst; the sleep floor and the parts that quietly raise it; choosing a cell for the load; regulators at microamp loads; firmware that keeps a node asleep; and measuring it.

Author
Ahmedonics Engineering
Published
Last updated
Illustration of a small weatherproof sensor node on a pole with its lid open to show a lithium battery and a circuit board, and a faint radio-wave arc from its antenna

A device that must run for a year on a cell is not built around a big battery. It is built around a small number: the average current, in microamps, that the whole board draws while doing what it was designed to do, most of which is nothing. The arithmetic is short, and the battery life calculator does it. The engineering is in knowing what goes into the sleep figure, what shape the bursts really have, which cell can deliver them, and how to find out with a meter rather than a datasheet whether the number is true.

The budget is an average current, and sleep sets the floor

A battery is a store of charge, rated in milliamp-hours: a 2 000 mAh cell can supply 2 000 mA for an hour, or 2 mA for a thousand hours, or 0.2 mA for ten thousand, give or take the effects of rate and temperature. So the life of a device is its usable charge divided by its average current, and everything in the budget is a way of getting that average current right. A burst of 120 mA that lasts a fifth of a second six times an hour is, over the hour, 0.04 mAh, or 40 µA of average current; a 20 µA floor that never stops is 20 µA. The two are the same kind of number and they simply add.

The floor is the current the board draws between events, and it is the one term that runs 8 760 hours a year whatever the firmware decides. Twenty microamps over a year is 175 mAh, a tenth of the cell in the example; 200 µA, which is what a carelessly designed board draws asleep, is 1 750 mAh, the whole cell. Whether the floor matters relative to the events depends on how often the events come. In the example one event costs 0.035 mA of average current at the battery and the floor costs 0.022 mA: the two are equal at about one report every ninety minutes. Report six times an hour and the floor is 8 % of the drain; report once a day and the floor, with the cell's own self-discharge, is nearly all of it. That is why a node that reports rarely is designed around its sleep current, and a node that reports often is designed around its bursts.

Events: measure, think, transmit

An event is a sequence, and its cost is the area under its current-against-time curve. The microcontroller wakes from its stop mode in microseconds, starts its main clock, powers the sensor and waits for it to settle. A pressure and humidity sensor settles in about ten milliseconds; a soil-moisture probe, a gas sensor with a heater, or an ultrasonic level transducer that needs several pings can take a second or more, and that is where the 1 500 ms in the example comes from. The reading is taken over I²C or SPI, the packet is built, and the radio is handed it.

The radio is short and fat: 120 mA for a LoRa transmitter at 20 dBm, 200–300 mA for Wi-Fi, but only for as long as the packet is on air. On LoRa the air time depends on the spreading factor: a 20-byte packet takes about 60 ms at SF7, about 200 ms at SF9 and 1.5 s at SF12, so a node at the edge of coverage on SF12 spends seven times the charge per packet of one near the gateway. The microcontroller is long and thin: 60 mA is half the radio's current, but it runs for seven times as long, and in the example it is 57.8 % of the drain against the radio's 15.4 %.

Then come the parts of the event that are easy to forget. A LoRaWAN class A uplink is followed by two receive windows, one and two seconds after the transmission ends, in which the radio listens for a few tens of milliseconds at 10–12 mA; that is cheap for the radio but expensive if the microcontroller waits for it at 60 mA instead of sleeping between the windows. A confirmed uplink that gets no acknowledgement is retried. An NB-IoT module that lost the network may search for it for tens of seconds at tens of milliamps before it sends anything. A Wi-Fi module has to associate and obtain an address, one to three seconds of 40–100 mA, before its 200 mA burst. Put all of these into the active time at their currents, and take the retry rate from a deployment, not a bench.

One hour: six events on a 20 µA floor each burst reaches 60–120 mA, far above this scale 00.10.20.3 mA 015304560 min 20 µA floor 0.233 mA average One event, zoomed measure 1.5 s, transmit 0.2 s 060 mA120 mA150 mA 00.51.01.52.0 s 60 mA × 1.5 s = 0.025 mAh 120 mA × 0.2 s = 0.0067 mAh Per hour: 6 × (0.025 + 0.0067) = 0.19 mAh of bursts + 0.02 mAh of sleep = 0.21 mAh at the load; ÷ 90 % converter efficiency = 0.233 mA average at the battery, the number that divides the capacity.
One hour of a sensor node: six short bursts on a 20 µA floor. The zoom shows a burst (60 mA to measure, a 120 mA radio spike to send), and the dashed line is what it all averages to: 0.23 mA, the number that divides the battery.

Sleep: the number that decides everything past a few events an hour

The microcontroller's own sleep current, one to five microamps for a modern Cortex-M0+ with its real-time clock running, is rarely the problem. The board around it is. In rough order of how often they turn up on a board that "should last a year" and lasts a month:

  • The regulator's quiescent current. The 1117-type linear regulators fitted to many modules and breakout boards draw about 5 mA with no load, two hundred and fifty times the floor in the example. A general-purpose LDO draws 50–100 µA; a part chosen for the job (MCP1700, XC6206, TPS7A02 and their relatives) draws between 30 nA and 2 µA.
  • The debug or power LED. A green LED behind 1 kΩ on a 3.3 V rail is 1–2 mA, all day, every day. It is the most expensive component on the board.
  • Pull-ups and dividers. An I²C pull-up of 4.7 kΩ held low by a sleeping sensor is 0.7 mA; a 10 kΩ divider across a 3.7 V battery to feed the ADC is 0.37 mA. Use 1 MΩ dividers with a capacitor and a slow ADC read, or switch them with a transistor, and check what state every pull-up is left in when the bus is idle; the voltage dividers guide covers the trade.
  • Sensors left in continuous mode. A BME280 in normal mode with heavy oversampling draws hundreds of microamps; in forced mode, read once and put back to sleep, it draws under a microamp between readings. Most sensors have such a mode and most example code does not use it.
  • The brown-out detector and the peripherals. On some microcontrollers the brown-out detector costs 10–20 µA and can be disabled in sleep and re-enabled on wake; an ADC, a comparator or a UART left enabled keeps its clock domain awake. A serial flash chip in standby draws tens of microamps until it is sent to deep power-down.
  • Anything with USB. A USB-to-serial bridge left powered, or a module with one on board, draws milliamps. It belongs on the programming jig, not the product.
  • Leakage. Flux residue, condensation and a dirty board leak microamps between adjacent high-impedance nodes. It is small until everything else is fixed, then it is the floor.

The real-time clock that wakes the device is the one thing that must stay on, and with a 32 kHz crystal it costs about a microamp. Everything else on the list is a design decision.

Choosing the battery for the shape of the load

A datasheet capacity is measured at a low, steady current down to a low end voltage. A real node draws almost nothing and then draws a lot, and what matters during the burst is the cell's internal resistance, because the terminal voltage during a pulse is the open-circuit voltage minus the current times that resistance. A fresh CR2032 has 10–40 Ω, rising as it is used; a 100 mA radio burst through 20 Ω is a 2 V drop, which takes a 3 V cell straight through the microcontroller's brown-out threshold while the cell still holds nearly all its charge. Two alkaline AA cells are 0.3–0.6 Ω fresh and about 2 Ω near the end; an 18650 is 30–80 mΩ and does not care; a lithium thionyl chloride bobbin cell is several ohms and, after months idle, grows a passivation layer that makes its voltage dip on the first pulse.

A capacitor across the cell can carry a burst, and the arithmetic says which bursts. The charge in a burst is current times time; the capacitor must supply it with a droop you can accept, so C = I × t ÷ ΔV. A Bluetooth connection event of 10 mA for 2 ms is 20 µC, and 67 µF holds it to 0.3 V of droop, so a coin cell and a small ceramic capacitor make a beacon that lasts years. A LoRa packet of 120 mA for 200 ms is 24 mC, and the same droop needs 80 mF, which is a supercapacitor or the hybrid layer capacitor sold to go with LiSOCl₂ cells. That is why the calculator warns when a coin cell is asked for a big burst: the cell is not the problem, the shape of the load is.

The other axis is self-discharge, and it decides the rare-reporting node. A Li-ion cell loses 2–3 % of its capacity a month at 20 °C, and in the example that is 19 % of the drain at six reports an hour; at one report a day it is most of it, and the node is spending the cell on the cell. Alkaline loses 0.2–0.3 % a month, lithium iron disulphide about 0.1 %, lithium thionyl chloride about 1 % a year. All of these roughly double for every 10 °C, so a box on a pole in Jacobabad in June is not at the datasheet figure. Temperature also sets what a cell can do at all: Li-ion cannot be charged below 0 °C or above 45 °C, which rules out a solar-charged Li-ion node on a roof in summer without a temperature-aware charger; alkaline loses much of its capacity below freezing and leaks when left flat in the heat; LiFeS₂ and LiSOCl₂ work from −40 °C and are the choice for a device that has to survive Skardu in January and Sibi in June.

Regulators and voltage: LDO, buck, boost, or none

The best regulator at microamp loads is often none. A 3.3 V microcontroller usually runs from 1.8 to 3.6 V, and a LiFePO₄ cell sits between 3.6 V full and 2.5 V empty, so it can power the microcontroller and most radios directly; two AA cells run from 3.2 V to 1.8 V and do the same, with the radio's minimum voltage (about 1.8 V for a LoRa transceiver, 3.0 V for an ESP32 transmitting) setting the end of life. The price is that the supply is no longer constant: the ADC must use its internal reference rather than the rail, a flash write may need a minimum voltage, and the radio's output power may fall as the cell empties. In exchange the floor loses the regulator entirely.

When a regulator is needed, its quiescent current matters more than its efficiency at these loads. An LDO that drops a 3.7 V Li-ion to 3.3 V wastes 11 % of the energy, which no switching converter's idle current will recover on a 20 µA board; a low-quiescent LDO is the right part there. A buck earns its place when the step is large, since an LDO from 12 V to 3.3 V wastes 72 %, or when the active current is high for long; choose one whose datasheet shows the quiescent current in its light-load (pulse-skipping) mode, and read its efficiency curve at 100 µA rather than at the 1 A the headline was measured at, where 60 % is common. A boost from 1.5 V cells is unavoidable if the circuit needs 3.3 V, and it has two costs at once: its efficiency falls as the input sags, and its input current rises as the input voltage falls, so the last third of the cells' capacity is delivered at a poorer rate than the first. The trap in all three cases is the same: the converter's losses are plotted from a milliamp upward, and the node lives below that.

Firmware is half the battery

The hardware sets what the floor can be; the firmware decides whether the device ever reaches it. The habits that matter:

  • Use the deepest sleep mode the wake-up allows. A stop or standby mode with the RTC as the only clock; not an idle loop, and not a "delay" that spins the core at 60 mA.
  • Power the peripherals, do not just disable them. Sensors and the radio behind a load switch or a GPIO pin, so that a part which forgets to sleep is switched off anyway. Disable the clocks of every peripheral not in use, and put the serial flash into deep power-down.
  • Never wait with the core running. Sensor settling, the radio's transmit-done, the receive windows: sleep through them on a timer or an interrupt. Use DMA for anything long over a bus. This is where the 1 500 ms in the example usually hides.
  • Put a time-out on every wait. A stuck I²C bus or a radio that never asserts its done flag will keep the device awake until the cell is flat. Every loop that waits for hardware has a limit, and hitting it is logged and recovered from.
  • Report on change, with a heartbeat. A temperature that has not moved does not need six packets an hour; a packet an hour when nothing changes and a packet within a minute when something does is a smaller budget and better data. Adaptive rates are the largest single saving after the floor.
  • Design the watchdog for sleep. An independent watchdog with its own low-power clock costs a microamp or less; one that must be fed from the main loop forces the device to wake for nothing, and a reset that re-initialises the radio and re-joins the network is an expensive event. Record the reset cause and count the resets in the field.
  • Test the sleep path harder than the active path. The active path is exercised at every test; the sleep path is exercised only when a meter is on the supply. A device that fails to sleep once in a hundred cycles loses more than a device that fails to send once in ten.

The example in numbers

A LoRa temperature and humidity node on an orchard near Multan, six readings an hour, on a single 2 000 mAh 18650 cell with 85 % usable and 2 % a month self-discharge; 20 µA asleep; 60 mA for 1 500 ms to wake, read and pack; 120 mA for 200 ms to send at 20 dBm; a buck converter at 90 %.

  1. Per event: 60 mA × 1.5 s = 0.0250 mAh active, 120 mA × 0.2 s = 0.0067 mAh transmit, 0.0317 mAh together.
  2. Per hour: six events are 0.190 mAh, the floor adds 0.020 mAh, 0.210 mAh at the load; through the 90 % converter the battery gives 0.233 mA.
  3. Self-discharge: 2 000 mAh × 2 % ÷ 730 h = 0.055 mA. Total drain 0.288 mA.
  4. Life: 2 000 × 0.85 = 1 700 mAh ÷ 0.288 mA = 5 900 h = 246 days, about 8.1 months.
  5. Where it goes: active 57.8 %, self-discharge 19.0 %, transmit 15.4 %, sleep 7.7 %. Doubling the reports cuts the life to 4.7 months; halving the sleep current only stretches it to 8.4.

The lever is the 1 500 ms awake. Cut it to 500 ms, by sleeping through the sensor's settling time and the radio's work instead of waiting for them, and the calculator gives 13.2 months on the same cell; with the reporting made adaptive so the average falls to two packets an hour, and a lithium primary cell in place of the Li-ion to remove most of the self-discharge, the same node is into its third year. None of that costs a component.

Measuring: the only budget that counts

Every figure above is an estimate until the sleeping board has been measured, and it cannot be measured with an ordinary multimeter. On its microamp range a meter drops hundreds of millivolts across its shunt, so the first burst resets the board; on its milliamp range it cannot see 20 µA. Use a low-burden microamp meter (the µCurrent design and its many relatives) to read the floor; better, a power profiler such as the Nordic PPK2, a Joulescope or an Otii Arc, which log from microamps to hundreds of milliamps with the time resolution to see every burst and integrate a day of them into a real average. The bench alternative is a 1 kΩ resistor in the supply lead with an oscilloscope across it, 20 µA reading as 20 mV, and a pair of Schottky diodes back to back across the resistor so that a burst is limited to 0.3 V of drop and the board keeps running.

Then leave the meter on for a day, because the floor between events is what you are looking for, and a device that sleeps properly 99 times in 100 shows its one failure only over hours. Then put a handful of units in the field with the battery voltage in every packet, and read the trend over a season: a Li-ion cell's voltage is a usable state-of-charge indicator, an alkaline's roughly, a thionyl chloride cell's not at all until the end. Derate what the field shows for the winter the units have not seen yet and for the ageing of the cell, and quote the customer a life with margin. A node specified for two years that lasts two and a half is a success; one specified for three that dies after two, in a fruit orchard at harvest, is a warranty claim and a lost account.

Where Ahmedonics uses this

Ahmedonics designs and builds custom hardware for automation and monitoring, and a good part of it runs on batteries: LoRa and NB-IoT nodes for tank levels, tube-well flow and soil moisture on farms, trackers on equipment, and wireless sensors retrofitted to machines that have no spare conduit. On those projects the power budget is a design deliverable rather than a spreadsheet: a measured sleep floor for the finished board, a burst profile captured with a power profiler, a cell chosen for the shape of the load and the temperatures of the site, a projected life with margin, and a field trial that reports its battery voltage back so the projection is checked against the truth before the batch is built. The dev board to product guide sets that work in the context of the rest of the design.

References

  • Texas Instruments, ultra-low-power design application notes (the SLAA-series "ULP Advisor" rules) — sleep modes, peripheral clocks, interrupts over polling and the other habits that keep a microcontroller asleep
  • Nordic Semiconductor, Online Power Profiler — an event-based current model for BLE, Thread and LTE-M devices; useful to cross-check radio figures
  • LoRa Alliance, LoRaWAN L2 1.0.4 Specification — class A receive windows one and two seconds after an uplink, and confirmed-uplink retries
  • Semtech, SX1276/77/78/79 datasheet — transmit current against output power, receive and sleep currents, air time against spreading factor
  • Energizer and Duracell technical datasheets and application manuals for alkaline and lithium cells — capacity against drain rate and temperature, pulse behaviour, internal resistance, self-discharge
  • IEC 60086-2, Primary batteries — Part 2: Physical and electrical specifications — standard cell sizes, minimum average durations and test conditions
  • IEC 60086-1, Primary batteries — Part 1: General — the designation system (CR2032, LR6, FR6) shared with ANSI C18