To measure sleep and average current you can trust, use an instrument that spans nanoamps to hundreds of milliamps without starving the board of voltage, and measure production hardware running production firmware with the debugger unplugged. Record whole duty cycles at the battery terminals, mark each firmware state with a spare GPIO, and split the trace into sleep, sensor and radio states. Feed those measured numbers, not datasheet figures, into the battery life estimate, and repeat the measurement on several boards and at the temperatures the product will see.
The rest of this article turns that summary into a method you can run on any board, with the errors that most often make a good design look bad or a bad one look good.
What you are actually trying to measure
A battery life estimate needs three things from the bench: the steady current while asleep, the charge each wake-up consumes, and how often each wake-up happens. Everything else is arithmetic.
Sleep current is the steady floor between events: the microcontroller in its low-power mode, the real-time clock running, RAM retained, and every other part on the board leaking or idling. Active states are the wake-ups: a sensor reading, a radio event, a flash write. Average current is the time-weighted mean over a whole cycle, and it is the number that divides into battery capacity.
The battery life calculator uses exactly that structure. Its formula is “sleep current for the time asleep + each active state weighted by its share of the hour + self-discharge spread over the year,” and life is “usable capacity ÷ average current.” The bench work in this article produces the inputs for that formula.
Units you will convert between
Meters report charge in coulombs or microcoulombs, batteries are rated in milliamp-hours, and estimates use microamps. One milliamp-hour is 3.6 coulombs, because a milliamp flowing for 3,600 seconds moves 3.6 C. An average of 1 µA for a year is about 8.8 mAh. Keep these two conversions next to the bench, because a slip between micro and milli is an easy way to be wrong by a factor of 1,000.
Why datasheet figures are not enough
A datasheet sleep figure describes the chip under stated conditions, not your board running your firmware. TI’s CC2340R5 page, for example, gives under 710 nA in standby for its CC2340R52 variant with full RAM retention. Your board adds a regulator, sensors, pull-up resistors, an external flash chip and whatever the firmware leaves switched on. Even a bare module adds its own flash and support parts to the chip; Espressif’s module measurement, described later in this article, is a module figure, not a chip figure.
Measure where the battery sees it
Current at the microcontroller’s supply pin and current drawn from the battery are different numbers whenever a switching regulator sits between them. A step-down converter trades voltage for current, and it also draws its own quiescent current.
TI’s TPS62840 shows the scale. Its product page lists 60 nA quiescent current and 80 percent efficiency at 1 µA output, converting 3.6 V to 1.8 V. At that operating point, 1 µA drawn at 1.8 V costs the battery about 0.63 µA at 3.6 V. For battery life, measure at the battery terminals, or convert rail current with the regulator’s efficiency at that load. For firmware debugging, measure at the rail as well, so you can see which side of the regulator a change affects.
Choosing an instrument
The instrument has to cover a dynamic range of about a million to one, switch ranges fast enough to follow a radio burst, and drop so little voltage that the board behaves normally. Espressif’s guide says ordinary ammeters miss the last two.
Espressif’s current measurement guide puts the problem plainly. In deep sleep a module draws “just several microamps,” while active current is “in the order of milliamps,” and “ordinary ammeters cannot dynamically switch the measurement range fast enough.” It adds that ordinary ammeters “have a relatively high internal resistance, resulting in a significant voltage drop,” which can leave the module below its minimum supply voltage.
Burden voltage, worked through
Most current meters measure the voltage across a shunt resistor, and that voltage is taken away from your board. The drop is the current times the shunt resistance, so a range chosen for microamps can be disastrous at milliamps.
For example, suppose a meter’s microamp range uses a 100 Ω shunt. At 10 µA of sleep current the drop is 1 mV, which is harmless. When the radio wakes and draws 20 mA, the same shunt would drop 2 V, and a 3 V board would brown out and reset. The meter then reports a tidy sleep figure from a board that never completes a radio event. Check the burden specification of each range, or the total drop at your peak current, before you trust a reading.
Instrument types compared
| Instrument | Strengths | Limits for this job |
|---|---|---|
| Handheld or bench multimeter | Accurate on a steady current in a fixed range | Slow, fixed range, and burden voltage on low ranges; reads sleep only if you lock the board in sleep |
| Shunt resistor and oscilloscope | Fast; shows the shape of each event | Limited dynamic range; tiny sleep currents disappear in noise |
| Auto-ranging power analyzer | Covers microamps to amps in one capture; logs charge over time | Check range switching speed, resolution at the bottom range and total voltage drop |
| Source measure unit | Supplies and measures at once; precise at low currents | Cost, and range switching speed varies by model |
Espressif’s guide names two auto-ranging instruments and quotes their key figures. It describes the Joulescope as measuring “over nine orders of magnitude from amps down to nanoamps” with “a total voltage drop of 25 mV at 1 A.” It describes Nordic’s Power Profiler Kit II as covering “several microamps to 1 A,” with resolution “between 100 nA and 1 mA, depending on the measurement range.” Those are the vendor documentation’s descriptions, not our comparison. Whatever you choose, read three specifications: resolution on the lowest range, how fast it changes range, and the total drop at your highest peak.
Sample rate and averaging
Short events need fast sampling, and averages need long captures. A 2.5 ms radio event sampled at 1,000 samples per second yields two or three points, which is too few to measure its charge. At 100,000 samples per second it yields 250. For the average, capture a whole number of complete cycles: if the device reads a sensor every 5 minutes, an hour-long capture contains twelve full cycles and a ten-minute one contains two.
Check the meter against a known load
Before you trust the meter on your board, check it on resistors whose current you can calculate. At 3.0 V, a 1 MΩ resistor draws 3 µA and a 300 Ω resistor draws 10 mA. Measure both, then switch between them quickly, for example with a transistor driven from a function generator, to see whether the meter follows the step without a gap or an overshoot. A meter that reads the steady values correctly but smears the step will also smear your radio events.
Preparing the board
Measure the board you will ship, powered the way it will be powered, with nothing else connected to its pins. Development boards and attached tools add current that has nothing to do with your design.
Do not trust a development board’s number
Development boards carry extra circuits: USB bridges, LEDs, level shifters, regulators sized for convenience. Espressif says that for ESP32, measuring the module’s current on a development board “is not recommended, as some circuits still consume power on the board even when you flash the chip with the deep_sleep example.” Its procedure measures a bare module powered through the meter instead.
Microchip’s guide for its PIC32CM GV Curiosity Nano+ Touch board quantifies one source. Each on-board level shifter has “a maximum of 2 μA leakage current,” so “the worst-case maximum current draw for the five on-board level shifters is 10 μA.” The guide tells you to cut the board’s target power strap, connect the ammeter across it, and tri-state any I/O connected to the on-board debugger.
Break the supply where your product’s battery connects
Plan the measurement point into your own board. A jumper, a zero-ohm resistor or a cuttable strap between the battery connector and the rest of the circuit lets you insert the meter without soldering to the battery tabs. Place a second break before the microcontroller’s supply if you want to separate the regulator and sensors from the chip.
Isolate sections when the floor is too high
When the sleep floor is higher than the parts list explains, split the board into sections and measure each one. Jumpers or zero-ohm resistors in each sensor’s supply, in the external flash supply and before the regulator let you remove one section at a time and watch the floor drop. Plan them into the first board revision; removing a jumper is easier than cutting a trace. Record each section’s share, because it tells you whether the fix is in firmware (a sensor left on) or in hardware (a part with high standby current).
Bench supply or real battery?
Use a bench supply for repeatable firmware work and a real cell for the final check. A bench supply holds its voltage regardless of load, which is what you want when comparing two firmware builds. A real cell has internal resistance, so its voltage dips during each radio burst, and that dip can change how long the regulator and the radio take to settle. Run the final measurement on the cell type you will ship, and see why battery life falls short of the estimate for what pulse loads do to a cell.
If your instrument can act as the supply, keep the wiring short and avoid long thin leads. Resistance in the leads adds to the meter’s own drop at peak current.
Remove everything that touches the pins
A debug probe, a USB serial adapter or a logic analyzer with pull resistors can feed current into an I/O pin or sink it out, and the meter cannot tell that current from your firmware’s. Unplug the debug probe and the serial adapter for the capture. If you must keep a connection, tri-state the microcontroller pins on that side first, as Microchip’s guide instructs for its debugger lines.
Power the board from the source the product will use, at the voltage it will see. A bench supply set to the battery’s nominal voltage is fine for most captures. Repeat the key measurement at the end-of-life voltage too, because regulator efficiency and some leakage currents change with input voltage.
Preparing the firmware
The firmware you measure must be the firmware you ship. Debug builds, test builds and logging options can keep clocks, debug logic or peripherals alive in sleep, and the difference can be large.
Debug and test builds keep debug logic awake
Some toolchains enable low-power debugging automatically in debug builds. In Zephyr, the STM32 option STM32_ENABLE_DEBUG_SLEEP_STOP, “Allow debugger attach in stop/sleep Mode,” defaults to on when DEBUG or ZTEST is enabled, according to its Kconfig definition. Its help text explains that “Some STM32 parts disable the DBGMCU in sleep/stop modes because of power consumption,” and that SEGGER RTT needs it on. Check your own platform for the equivalent setting, and confirm it is off in the build you measure.
Logging and consoles
A console UART, a log backend or a USB stack can hold a clock or a peripheral on, and on some platforms it can prevent the deepest sleep state. Measure with logging configured exactly as it ships. If production keeps a console, measure with it; if not, remove it from the measured build rather than just disconnecting the cable.
Pins, pull-ups and peripherals
A pin that fights a resistor draws current all night. ESP-IDF’s sleep modes documentation gives a concrete case: on the ESP32-WROVER module, GPIO12 “is pulled up externally, and it also has an internal pulldown,” so current flows through both resistors in deep sleep unless you call rtc_gpio_isolate(). Espressif’s measurement procedure also disables touch wake-up “to reduce the bottom current.” Walk every pin on your schematic and decide its sleep state: driven low, driven high, or floating with nothing attached.
Sensors and their regulators are the other half. A sensor left powered between readings adds its own standby current to the floor. If its datasheet standby current is not small enough, switch its supply with a load switch or a GPIO.
Is the chip reaching the sleep state you think it is?
An RTOS chooses the sleep state at run time, so the state on your test build may not be the state on the product build. Zephyr’s system power management under its residency policy enters the deepest state whose minimum residency plus exit latency fits the idle time the kernel scheduled. A frequent timer can therefore keep the device in a lighter state than you planned.
Zephyr’s device runtime power management adds another trap. It uses reference counting, with “get” and “put” calls marking when a device is needed. A missing “put” on one error path leaves that device powered, and the extra current appears only after that path runs. A sleep current that rises after an error, a retry or a firmware update is a sign of this kind of bug.
Mark each firmware state with a spare GPIO
A current trace shows how much current flowed, but not what the firmware was doing. Driving a spare pin high at the start of each state and low at the end, and recording that pin alongside the current, lets you attribute every microcoulomb to a state.
How to set it up
- Reserve one or two pins that are unconnected in the product, or connected only to a test point.
- Set the pin high when a state begins and low when it ends: sensor read, radio event, flash write. With two pins you can encode up to four states.
- Record the pins on the meter’s logic input if it has one, or on a logic analyzer that shares ground with the meter.
- Keep the marker cheap. A pin driving only a high-impedance input costs almost nothing. Remove the marker from the release build, or leave the pin driven low, and measure once without it to confirm it changed nothing.
Turn windows into charge
For each marked window, the meter’s software gives the charge (current integrated over time) or the average current and the duration. Charge per event is average current times duration. In Figure 2’s fictional values, a sensor wake-up of 3.4 mA for 180 ms is 612 µC, and a radio event of 6.3 mA for 2.5 ms is about 16 µC. The radio event looks dramatic on the trace, but at one per second it adds up to about 57 mC an hour, while twelve sensor wake-ups add up to about 7 mC.
Taking the measurement, step by step
Treat the capture as a procedure with a written record, so a colleague can repeat it next month and get the same number. The steps below work for any microcontroller board.
- Write down the configuration. Board revision and serial number, firmware version and build options, supply voltage, temperature, and what is connected.
- Zero the meter. With the board disconnected, record the meter’s reading at its lowest range. That offset sets the smallest current difference you can trust.
- Let the board settle. After power-up, capacitors charge, sensors finish their start-up and the radio may scan or reconnect. Wait until the trace repeats before you start recording.
- Capture whole cycles. Record a whole number of the longest cycle, and at least several of them, at a sample rate that resolves your shortest event.
- Read the sleep floor between events. Use a window well clear of any wake-up, because regulators and capacitors take time to settle after one.
- Read each marked state. Record duration, average current and charge for each, and how often it occurs.
- Repeat on several boards. Component tolerances and assembly differences move sleep current. Record the spread, not only the mean.
- Repeat at the edges. Measure at the lowest supply voltage the product will see and, if it lives outdoors, at its temperature extremes. Check whether the chip datasheet’s sleep figure is given at 25 °C only.
How long is long enough?
Use the slowest periodic event to size the capture. A device that reports every 15 minutes needs hours of capture for a stable average; one that advertises every second needs a few minutes. If the product also has rare events, such as a daily sync or a weekly update check, measure each one separately and add it to the estimate by its frequency, rather than waiting a week for one to appear in a capture.
Capture peaks and start-up separately
The average decides battery life, but the peak decides whether the board survives on a tired cell. Capture three events at a high sample rate on their own: power-on, when input capacitors charge and regulators start; the largest radio transmission; and any flash erase or write. Record the peak current and how long it lasts, not only the charge. Those numbers size the regulator, the bulk capacitor and the meter range, and they show how close the design runs to brown-out when the cell’s internal resistance rises late in its life.
A shunt and an oscilloscope are good at this job even though they are poor at sleep floors. Use each instrument where it is strong, and note in the record which one produced which number.
Measure the radio with its real peer
Some radio timing is set by the other side of the link, not by your firmware. The BLE update time calculator notes that “the phone or gateway decides the connection interval,” and the same holds for many low-power links. A probe measured against a development dongle may wake at a different rate, and stay awake for a different time, than it does against the gateway or phone your customers use. Measure the radio states against the production peer, at a realistic distance, and record which peer you used.
Keep a measurement record
A number without its conditions cannot be compared with next month’s. A short record per capture is enough:
| Field | Example entry |
|---|---|
| Board and serial number | Rev D, unit 0412 |
| Firmware version and build | 1.1.0 release build, debug-in-sleep off |
| Supply and voltage | Bench supply, 3.0 V at the battery jumper |
| Instrument, range and sample rate | Auto-ranging analyzer, 100,000 samples per second |
| Connected tools | None during capture |
| Temperature | 22 °C |
| Capture length | 60 minutes, 12 sensor cycles |
| Results | Floor, each state’s duration, current and charge, average |
Reading a real capture: Espressif’s module example
Espressif’s measurement guide includes a capture you can use to practice the arithmetic. It measures an ESP32-S3-WROOM-1 module running the deep_sleep example, which wakes the module every 20 seconds, powered at 3.3 V through the meter.
The guide reports a deep-sleep current of 8.14 µA and an active current of about 23.88 mA. It also reports average power of 26.85 µW in deep sleep, 78.32 mW in active mode, and 6.37 mW over one whole cycle.
What the numbers tell you
Converting the cycle figure to current at 3.3 V gives about 1.93 mA on average, which is more than 200 times the deep-sleep floor. Solving for the share of time awake, our arithmetic from Espressif’s figures puts it at about 8 percent, or roughly 1.6 seconds of every 20-second cycle. In that example the average is set almost entirely by how long the module stays awake, and halving the sleep floor would change it by well under 1 percent.
The lesson carries over to other boards: the floor is the number people quote, but the wake time can be the number that decides battery life. Read both from every capture, and compute the share of each before deciding what to optimize.
Translating power figures into calculator inputs
Some instruments report power or energy rather than current. Divide power by the supply voltage at the measurement point to get current, and energy by voltage to get charge. Use the voltage where the meter sits: the battery voltage if the meter is in the battery path, the rail voltage if it is after the regulator. Mixing the two is a quiet way to be off by the regulator’s conversion ratio.
Common errors and how to spot them
The causes below cover the errors described in this article, and each leaves a recognizable trace. Check this table before you start changing firmware.
| What you see | Likely cause | How to check |
|---|---|---|
| Sleep floor far above the datasheet, even on a blank board | Development board circuits, LEDs, level shifters or a USB bridge | Measure the bare module or your own board through a cut supply strap |
| Floor drops when you unplug a cable | Debug probe or serial adapter feeding or sinking pin current | Unplug all tools; tri-state pins that must stay connected |
| Floor higher on the debug build | Debug logic kept powered in sleep | Compare with the release build; check debug-in-sleep options |
| Board resets when the radio transmits | Meter burden voltage on a low range | Check the drop at peak current; use an auto-ranging instrument |
| Radio events look smaller than expected | Sample rate too low | Raise the sample rate until event charge stops changing |
| Average changes with capture length | Partial cycles or a rare event inside the capture | Capture whole cycles; measure rare events separately |
| Floor rises after an error or retry | Peripheral left on, or a runtime PM reference never released | Mark the error path with the GPIO and compare floors before and after |
| Floor differs between identical boards | Leakage in a component or assembly residue | Measure several boards; isolate sections with jumpers |
| Floor fine at 25 °C, high outdoors | Leakage rising with temperature | Measure at temperature extremes; read the datasheet’s temperature data |
Back-powering through I/O pins
A connected tool can power your board through its signal lines. If a USB serial adapter holds its transmit line high while your board is meant to be asleep or switched off, current flows into the microcontroller’s receive pin and through its protection structures into the supply rail. The board then draws less from the meter than it really uses, or stays partly alive when it should be off. The fix is the one in Figure 1: unplug the tool, or make sure neither side drives a pin into an unpowered or sleeping device.
The two errors that matter most
The first is measuring a development board and believing the number. It makes the design look worse than it is, and it can send firmware work after current that the product board never draws. The second is measuring a debug build with a probe attached. It can make the design look worse, or, with a meter on the wrong range, it can hide resets that would show up in the field.
From trace to battery life estimate
Once you have measured numbers for sleep, each wake-up and its frequency, enter them in the battery life calculator in place of the estimates. The difference between the two runs shows which assumption was wrong.
Example (fictional). Loamwick’s requirement FW-002 says the LW-1 probe must “Run 3 years on two AA lithium cells,” verified by “Measured average current on 5 boards, battery life calculator.” The calculator’s default example for the probe assumes 4 µA sleep, 12 sensor wake-ups an hour at 150 ms and 3.2 mA, and 3,600 radio events an hour at 2.5 ms and 6 mA, with 3,000 mAh, 85 percent usable and 1 percent self-discharge a year. That gives 24.0 µA and 12.1 years.
The team measures five Rev D probes with the setup in Figure 1. The sleep floor averages 5.1 µA across the five boards. Sensor wake-ups take 180 ms at 3.4 mA, longer than planned because the moisture sensor needs extra settling time. Radio events average 6.3 mA for 2.5 ms.
With those inputs, the calculator gives an average of 26.3 µA and an estimated 11.1 years. The radio share is 59.9 percent, sleep 19.3 percent, sensor wake-ups 7.8 percent and self-discharge 13.0 percent.
Two mistakes would have changed the story. The first capture, on a debug build with the debug probe attached, showed a 38 µA floor; with that floor the estimate falls to 4.9 years. Measured on a development kit with 10 µA of extra board current, the floor would be 15.1 µA and the estimate 8.0 years.
The measured 11.1 years is still a laboratory number. It assumes the cell delivers its rated capacity at your loads and temperatures, and that the field behaves like the bench. Why battery life falls short of the estimate explains the derating for pulse loads, cold and field radio retries that turns a bench number into one you can promise.
Add the rare events
Periodic states are only part of the average. A daily sync, a reconnect after the gateway restarts, or a firmware update each adds charge that a one-hour capture will not contain. Measure each one once, then spread it over its period.
For example, suppose a hypothetical daily sync keeps the radio busy for 20 seconds at 8 mA. That is 160 mC a day, or about 1.85 µA averaged over the day, which is a third of the 5.1 µA sleep floor in the Loamwick example. A firmware update over Bluetooth LE, at the BLE update time calculator’s default of 36.6 seconds and the battery calculator’s default 6 mA, is about 0.22 C each time. Six a year average out to about 0.04 µA, which is negligible. Measuring each event once tells you which ones belong in the estimate.
Which numbers to improve first
The calculator’s share breakdown tells you where effort pays. In the example, the radio is 60 percent of the average, so halving radio time does far more than halving the sleep floor. Measure before optimizing: the state you assume dominates may not be the one that does.
Make the measurement repeatable
A sleep current measured once at bring-up says nothing about the release you ship a year later. Put the measurement into the release process, so a regression is caught before devices leave the building.
Two practices cover most of it. First, keep the written procedure and the configuration record from the step-by-step section, and run it on the same boards for each release candidate. Second, automate a sleep-floor check on a hardware rig: put the board to sleep, record for a fixed window, and fail the build when the floor rises more than a set margin above the last release. Firmware testing with CI and a hardware-in-the-loop rig shows how a current meter fits into such a rig.
Record the results in the release notes and the release report. The firmware release checklist already includes “Battery and current draw checked against the last release.” A sleep floor that creeps up by a few microamps per release is easy to miss in a single test and obvious in a table.
Close the loop with field data
The bench measures one board at a time under known conditions; the field measures every board under real ones. Have the firmware count time spent awake in each state and report it with the loaded battery voltage. If the field’s wake time per day is double the bench figure, the estimate is wrong for a reason you can now find, such as retries at the edge of range, and the bench procedure needs a test for it.
When a chip is still being chosen
The same method works on development kits during chip selection, with one change: measure the chip’s supply on a kit that lets you cut it, and treat the result as a comparison between candidates, not as your product’s number. Choosing a microcontroller covers what else to weigh alongside sleep current.
What to do this week
Start with the setup and the record; the numbers follow.
- Add a measurement point to the next board revision: a jumper or strap in the battery path, and a second one before the microcontroller’s supply.
- Reserve a GPIO for state marking and route it to a test point.
- Choose an instrument by its lowest-range resolution, range switching speed and total voltage drop at your peak current.
- Build a measurement configuration of the release firmware, with debug-in-sleep options off and logging as it ships.
- Measure five boards with the debugger and serial adapter unplugged, over whole cycles, and record the spread.
- Enter the numbers in the battery life calculator, compare with the estimate, and work on the largest share first.
- Add a sleep-floor check to every release.
Fumbar is a Denver company that writes embedded firmware and builds the update path for hardware startups. Our low-power design service covers power profiling, sleep states and battery life budgets, using measurements like these. If your measured numbers and your estimate disagree and you want a second reader, you can request a firmware review.
