The Coin-Cell Year

A CR2032 holds 240 mAh and a year has 8,760 hours. Divide them and the design is one number: 27 microamps, averaged over every sleep, burst and sag.

Design a Bluetooth LE device that lives 365 days on one coin cell, and learn why the average current is only half the story.

Slide the advertising interval, pick a peak current, then wear the cell down. Two numbers fight: the days the charge lasts and the days the voltage survives. Then we build the budget, piece by piece, from a bare cell to a shipped design.

You need Ohm’s law (voltage equals current times resistance) and a rough idea of Bluetooth advertising (a device that shouts its name at fixed intervals). We build the rest from zero.

Built from primary sources: the Energizer CR2032 datasheet, the nRF52840 Product Specification, the TI TPS7A02 and TPS62740 datasheets, Nordic’s course Designing Low-Power Bluetooth LE Products and the Zephyr GAP header. The models on this page are models, and the chapters say which numbers are datasheet values and which are illustrative.

Spend the cell

251 ms

Capacity 240 mAh to 2.0 V and 3.0 V nominal: Energizer CR2032 datasheet. Sleep 1.5 µA and the 4.8 mA radio burst: nRF52840 Product Specification (12 mA and 25 mA are illustrative). The cell’s resistance growth, the burst length (0.8 ms, three per event) and the 10 µF capacitor are illustrative model choices.

Chapter 0

A Year Is a Budget

Divide one coin cell by one year and find the single number every later choice must respect

Picture a small tag on a warehouse door. It tells a phone nearby whether the door is open. Nobody wants to climb a ladder to change its battery. The product team asks for one thing: “It must run a year on a coin cell.”

That sentence is a budget in disguise. A CR2032 is a lithium coin cell, 20 mm wide and 3.2 mm thick. Its datasheet says it holds 240 mAh (milliamp-hours): enough charge to supply 240 mA for one hour, or 1 mA for 240 hours. The Energizer datasheet rates that figure down to 2.0 V, at a slow 15 kilohm load.

A year has 365 × 24 = 8,760 hours. So the cell can give an average current of 240 mAh ÷ 8,760 h = 0.0274 mA. That is 27.4 µA (microamps, millionths of an amp). Spend more than that on average and the cell dies early. Spend less and you have margin.

Iavg
The average current the whole device may draw, over every second of its life, sleeping and awake.
Q
The charge the cell can give: 240 mAh, or 240,000 µAh (microamp-hours).
T
The life you want, in hours. One year is 8,760 hours.

240,000 µAh ÷ 8,760 h = 27.4 µA (the cell also loses about 0.27 µA to self-discharge, so the real allowance is about 27.1 µA)

Why the number is so small

27 µA is tiny. A phone idles at thousands of times that. Nordic’s course on low-power design makes the point with two averages: 12 µA and 1200 µA. A product that empties its battery in weeks instead of years is not competitive. A hundred times more current means a hundred times fewer days.

Play with it. The ruler below is logarithmic, so each step to the right is ten times more current. Slide your device’s average current and watch the days.

Divide the cell by the year

The yellow line is the 27 µA budget. Slide the average current of your device across it, or press a preset.

12 µA

240 mAh to 2.0 V at 15 kilohm and 3.0 V nominal: Energizer CR2032 datasheet. The 12 and 1200 µA examples: Nordic Developer Academy, “Designing Low-Power Bluetooth LE Products”. Self-discharge of about 1% a year is a typical claim for lithium coin cells, not a datasheet value. The days are charge only: Chapters 1, 4 and 5 show why that is optimistic.

Two things hide in that tidy number. First, it is an average. A radio burst of 5 mA is 180 times the budget, so the device must spend nearly all its time asleep. Chapters 2 and 3 build that duty table.

Second, a coin cell is not an ideal tank of charge. It has resistance, so a big burst makes its voltage sag. If the sag crosses the chip’s floor, the chip resets with charge still left in the cell. Chapters 1, 4 and 5 explain that. Chapters 6 and 7 hunt the quiet leaks, and Chapter 8 shows how to measure the result.

All the examples run on an nRF52840, a 64 MHz Arm Cortex-M4 Bluetooth LE chip from Nordic that runs from 1.7 V to 5.5 V. The same ideas apply to any Cortex-M part, for example an STM32 low-power series. Numbers change. The method does not. If you have not met Bluetooth advertising yet, the previous lesson builds it from the radio up, and Sleep and the Battery Budget gives the general power maths.

Three kinds of cost

Every microamp in the budget belongs to one of three buckets. The first is the floor: what the device draws while it does nothing. That is the sleeping chip, the regulator and the leaks. It is always on, so it is paid every second of the year.

The second is the events: advertising, sensor reads and phone syncs. Each costs a fixed charge, and you pay it as often as it happens. The third is the losses: charge that never reaches the work, such as self-discharge and the stranded charge left when a burst resets the chip. Good design attacks all three, and the order matters. A tiny floor makes events the main cost. Cheap events make the floor the main cost.

A quick check shows how hard the target is. Ask for two years instead of one. The allowance halves to 13.7 µA. Ask for five years and it falls to 5.5 µA, which is only a few times the chip’s own sleep floor. That is why long-life products use a larger cell, a primary battery with more charge, or a harvested supply. A coin cell is the right size for a year, not for a decade.

The road

  1. The cell is a battery plus a resistor: where the 240 mAh really comes from, and why voltage falls under load.
  2. The duty table: average current as a sum over states.
  3. The advertising interval: the one knob that moves the average most.
  4. Peak current and sag: what the average hides.
  5. Brown-out: the floor, the reset loop, and what firmware can do about it.
  6. Regulators and quiescent current: the part that never sleeps.
  7. Hunting leaks: the microamps that eat the year.
  8. Measuring it: a power profiler, a cursor, and an honest average.
  9. The budget game: hit 365 days without a single early reset.
  10. Field guide: numbers, checklist, code and sources.
A cell holds 240 mAh and your device averages 120 µA. About how long does the charge last?

Chapter 1

The Cell Is a Battery Plus a Resistor

Read a coin-cell datasheet and see why a bigger burst always pulls the voltage lower

You put a fresh CR2032 in a multimeter. It reads 3.0 V. Now you clip a small LED across it, and the meter reads 2.8 V. Nothing is wrong. The cell has lost 0.2 V because a current is flowing through the cell itself.

Every real battery behaves like an ideal voltage source with a small resistor in series. Engineers call this the Thevenin model: a perfect source Voc (the open-circuit voltage, what you read with nothing attached) behind an internal resistance R. Think of a garden hose: the tap pressure is Voc, and a narrow kink is R. More flow, more pressure lost in the kink.

Vterm
The voltage your chip actually sees at the cell’s two pins while the load runs.
Voc
The open-circuit voltage: about 3.0 V for a new CR2032, falling as the cell empties.
I
The current the device draws right now, in amps.
R
The internal resistance in ohms. It grows as the cell is used up.

What the datasheet says

The Energizer CR2032 datasheet lists a lithium and manganese dioxide cell with a nominal voltage of 3.0 V and a typical capacity of 240 mAh. Read the fine print: that capacity is “to 2.0 volts” and “rated at 15K ohms at 21°C”. A 15 kilohm load draws only 0.19 mA, from the datasheet’s own line “typical drain at 2.9 V”. So 240 mAh is the answer to a gentle, warm question.

The datasheet also lists a typical IR (internal resistance) of 10,000 to 40,000 mΩ, which is 10 to 40 ohms. Its pulse charts show the resistance climbing as the cell is used. The vertical axis of its resistance graph runs from 0 to 120 ohms, so late in life the cell is far from a perfect source.

Two of its test pulses are worth knowing. One draws about 6.8 mA at 2.7 V, from a 400 ohm load, for 2 seconds, 12 times a day. Another draws about 23 mA at 2.7 V, from a 120 ohm load, for 1 ms every 15 ms. A cell that sits at 3.0 V open-circuit drops to 2.7 V at 23 mA. That is a 0.3 V loss. Divide: 0.3 V ÷ 0.023 A is about 13 ohms.

Try it. Pick one of the datasheet’s own loads and drag the cell from new to spent.

Load the cell

The dashed curve is the cell with nothing attached. The solid curve is what the chip sees under the chosen load. Drag the playhead to wear the cell.

10%

The three loads are the datasheet’s own test currents (Energizer CR2032, 21°C). The curve shapes are illustrative: Voc is nearly flat near 2.9 V then falls to 2.0 V, and R grows from 12 Ω to about 150 Ω at the very end. The datasheet quotes its 2.7 V at a point in its own test, so the model can differ by 0.1 V.

Three things stand out. At 0.19 mA the terminal voltage tracks Voc almost exactly, because 0.19 mA × 12 Ω is only 2 mV. At 23 mA the curve sits a visible step lower. And near the end, the Voc curve itself falls fast, so a modest load pushes the terminal voltage below the chip’s floor long before the charge is gone.

Why capacity depends on the question

The cell does not stop at 240 mAh. It stops when your chip stops working. The datasheet says “to 2.0 volts”. Your chip may need 1.7 V, or 2.4 V, or 3.0 V. A chip with a higher floor wastes the tail of the discharge curve. A chip with a lower floor uses more of it. A heavy pulse effectively raises the floor, because you must clear it at the bottom of the sag, not at rest.

That is why a design needs three numbers from the datasheet, not one: capacity (how much charge), voltage curve (where the floor cuts it off) and internal resistance (how deep each burst digs). We will use all three in Chapters 4 and 5.

Measure the resistance yourself

Do not trust a typical value for a design that runs on the edge. Measure R on your own cell with two loads. Read the voltage with a light load, then with a heavy one, and let the difference tell you R.

  1. Light load (illustrative readings). Read V1 with a 15 kΩ resistor on the cell: 0.19 mA, 2.95 V.
  2. Heavy load. Read V2 with a 150 Ω resistor, which draws about 17 mA, for a short time: 2.62 V.
  3. Subtract. The voltage fell by 0.33 V while the current rose by about 17 mA.
  4. Divide. R = ΔV ÷ ΔI = 0.33 V ÷ 0.017 A = 19 Ω. That sits inside the datasheet’s typical 10 to 40 Ω.

Take the reading fast, within a second. A cell under a steady load changes as it warms and as its chemistry settles, so a slow reading mixes R with other effects. Repeat on a worn cell and on a cold one. A cell that reads 19 Ω new and 90 Ω after months of use is the cell that resets your product on day 300.

The failure here is trusting the multimeter. A meter has a very high input resistance and draws almost nothing, so it always reads Voc. The symptom is a pile of returned products with “good” cells. The measurement is the two-load test above, or a scope on the supply pin during a burst. The fix is to design for the worst R you can expect, not the typical one.

A cell has Voc = 2.9 V and R = 30 Ω. The device draws a 20 mA burst. What does the chip see at the bottom of the burst?

Chapter 2

The Duty Table

Add up every state your device visits, weighted by how long it stays there, and read the average

Think of your device as a person with a day job. Most hours it sleeps. A few times an hour it wakes, does something, and goes back to bed. To know how much energy the person burns in a day, you do not look at the busiest minute. You list each activity, how much it costs, and how long it lasts.

That list is a duty table. Each row is a state: a stretch of time in which the device draws a roughly steady current. The duty cycle of a state is the fraction of time spent in it. A radio that is on for 2.4 ms out of every 1,000 ms has a duty cycle of 0.24%.

From rows to an average

Current is charge per second. So a burst of 4.8 mA lasting 2.4 ms moves 4.8 mA × 2.4 ms = 11.52 microcoulombs (µC) of charge. One µC per second is exactly one µA. That unit trick is the whole method: turn every row into charge per event, divide by the time between events, and you have microamps.

Iavg
The average current of the whole device over one repeating period.
Ik
The current in state k, for example 1.5 µA asleep or 4.8 mA with the radio sending.
tk
How long state k lasts in one period. Use the same time unit for every row.
T
The period: the time after which the whole pattern repeats.

Here is a full worked table for the door tag. Its firmware advertises every 1 s, reads a sensor every 30 s, and syncs with a phone every 15 minutes. The sleep row comes from the nRF52840 Product Specification: 1.5 µA at 3 V in System ON with the RTC running and no RAM retained. Firmware that keeps its variables in RAM draws more, so read the RAM-retention rows for your build. The burst current of 4.8 mA is the same document’s radio TX figure at 0 dBm. The sensor and sync rows are illustrative.

  1. Sleep: 1.5 µA, all the time. Contribution: 1.5 µA.
  2. Advertising: 11.52 µC per event, once per second. 11.52 µC ÷ 1 s = 11.52 µA.
  3. Sensor read: 1.2 mA × 25 ms = 30 µC, once per 30 s. 30 ÷ 30 = 1.0 µA.
  4. Phone sync: 3 mA average for 4 s = 12,000 µC, once per 900 s. 12,000 ÷ 900 = 13.33 µA.
  5. Self-discharge: 0.27 µA.

Add them: 1.5 + 11.52 + 1.0 + 13.33 + 0.27 = 27.6 µA. That sits right on the 27.4 µA budget. Notice what dominates. The sleep row is the smallest of the big rows. The bursts, spread over the whole period, are what the year is made of.

Fill in the duty table

Change how often each activity happens. The bar shows who spends the budget. The yellow line is 27.4 µA.

1.0 s
30 s
15 min
StateCurrentOn per hourAverage

Sleep 1.5 µA and the 4.8 mA radio burst: nRF52840 Product Specification. One advertising event is modelled as three 0.8 ms bursts, one per channel (illustrative). The sensor row (1.2 mA for 25 ms) and the sync row (3 mA for 4 s) are illustrative, not measured.

The failure: quoting the wrong number

A common mistake is to write “the radio draws 4.8 mA” in the spec and divide 240 mAh by it. That gives 50 hours. The symptom is a battery estimate off by a factor of a hundred. The measurement that catches it is a current trace over one full period. The fix is the table above: weight every current by its time.

The opposite mistake is just as common. Someone measures only the sleep state, 1.5 µA, and promises 18 years. A trace over a full period finds the bursts. Always measure a whole repeating pattern, not a quiet moment (Chapter 8).

The row people forget: the CPU

Our table has the radio, a sensor and a sync, but your firmware also computes. Every wake-up runs code: it reads the sensor, builds the packet, updates a state machine. The CPU draws current while it runs. The nRF52840 Product Specification gives 52 µA per MHz running CoreMark from flash. At 64 MHz that is 64 × 52 µA = 3.3 mA.

Now count the time. Suppose each wake-up costs 1 ms of CPU: 3.3 mA × 1 ms = 3.3 µC. If that happens once a second, the CPU row adds 3.3 µA, which is nearly a third of the advertising cost. If sloppy code takes 10 ms per wake-up, it adds 33 µA and the year is gone. The CPU row is the one you control completely, and it is paid in code you wrote.

Two habits keep it small. Do the least possible work on each wake-up, and let hardware wait for you. Timers, the radio and DMA (a unit that moves data without the CPU) can run while the CPU sleeps. The rule of thumb is simple: every millisecond awake at full speed (3.3 µC) costs about as much charge as 0.7 milliseconds of the radio sending (3.4 µC at 4.8 mA).

On real hardware. Use an nRF52840 DK and a power profiler such as Nordic’s PPK2. Run the firmware with advertising every 1 s, capture 10 s, and place cursors across exactly 10 events. Compare the average the tool reports with this table.
A device sleeps at 2 µA. Once a minute it draws 6 mA for 10 ms. What is its average current?

Chapter 3

The Advertising Interval Is the Big Knob

Halve the time between radio events and you double their share of the budget, so pick the slowest interval the product can bear

The door tag needs a phone to notice it. It does that by advertising: sending a short packet, called an advertisement, that says “I am here, and this is my data.” A phone that listens will hear it. Nobody connects. Nobody pairs. The tag just talks, and the phone just listens.

One advertising event sends the same packet on up to three radio channels, numbered 37, 38 and 39, one after another. The previous lesson shows that sequence on a timeline. Each send is a short burst in which the radio warms up, transmits, and shuts down. The time between the starts of two events is the advertising interval.

The Bluetooth stack counts the interval in units of 0.625 ms. The Zephyr header gap.h names the usual choices. Fast advertising uses 30 to 60 ms (values 0x0030 to 0x0060). Slow advertising uses 1 s to 1.2 s (values 0x0640 to 0x0780). For example 0x0640 is 1,600 units, and 1,600 × 0.625 ms = 1,000 ms.

Why the curve is a reciprocal

Each event costs a fixed charge, call it Qev. In Chapter 2, three bursts of 0.8 ms at 4.8 mA gave 11.52 µC. If one event happens every T seconds, the average current from advertising is Qev ÷ T. Make T half as long and the current doubles. Plot it and you get a hyperbola: steep on the left, flat on the right.

Iadv
The average current that advertising alone adds, in µA.
Qev
The charge of one advertising event, in µC. Here 11.52 µC.
T
The advertising interval in seconds.
Tmin
The shortest interval that still meets the budget.
Ibudget
The total average allowed: 27.4 µA for one year.
Iother
Everything else in the duty table: sleep, sensors, sync, self-discharge.

Worked example. Suppose sleep and self-discharge cost 1.77 µA and nothing else runs. Then Iother = 1.77 µA and the room left is 27.4 − 1.77 = 25.63 µA. So Tmin = 11.52 µC ÷ 25.63 µA = 0.45 s. At 100 ms the same device averages 11.52 ÷ 0.1 + 1.77 = 117 µA, which lasts only 85 days.

Trade latency for life

The curve is the life of a device that only sleeps and advertises. Slide the interval, and choose how heavy each event is. The two shaded bands are Zephyr’s fast and slow ranges.

500 ms

Fast (30 to 60 ms) and slow (1 to 1.2 s) ranges: Zephyr include/zephyr/bluetooth/gap.h. 4.8 mA burst and 1.5 µA sleep: nRF52840 Product Specification. Event sizes are illustrative: 0.8 ms bursts, and a scan reply adds roughly 0.35 ms of receive at 4.6 mA and 0.35 ms of send at 4.8 mA per channel.

Latency is what you buy with the interval

A slow interval is not free either. The phone may need several events to catch one. If the interval is 2 s and the phone scans only part of the time, the door state can arrive many seconds late. So the interval is a product decision: how stale may the data be?

Once a phone connects, the same trade appears again. Current falls as the connection interval grows, and the peripheral latency (the number of connection events the device may skip when it has nothing to say) cuts it further. Zephyr’s recommended minimum initial connection interval is 30 ms, which is 24 units of 1.25 ms. Nordic’s course on BLE power optimisation lists advertising interval, connection interval, peripheral latency, TX power and PHY as the levers.

A common design: advertise slowly (1 s) while idle, and speed up for a few seconds only when something happens. The average stays low, and the user still sees a fast response when they press the button.

The same trade inside a connection

Advertising is the idle mode. When the phone connects, both sides agree a schedule: one short exchange every connection interval. Each exchange is a connection event, and it costs charge even when nothing useful moves. Here is a worked example with illustrative numbers. Say an empty event costs 8 µC.

  1. Interval 30 ms. 33 events a second × 8 µC = 267 µA. Ten times the whole budget.
  2. Interval 1 s. One event a second: 8 µA.
  3. Interval 1 s with peripheral latency 4. The device may skip 4 events when it has no data, so it wakes about once every 5 s: 1.6 µA.

Latency has a price. If the device skips 4 events, a message from the phone may wait up to 5 s. A button press from the device can still force an immediate event. So the design question is again: how stale may the other side’s commands be? A thermometer can wait seconds. A door lock cannot.

The phone has a say too. It owns the connection and may reject or change what the device asks for. Always measure the interval you really got, not the one you requested. The previous lesson shows how to read the agreed parameters.

On real hardware. On an nRF52840 DK, build the Zephyr peripheral sample, set the advertising interval to 1 s, then to 100 ms. Measure with a PPK2 over ten events. The average should rise by about 10 times minus the sleep floor.
A device advertises every 500 ms at 11.52 µC per event. It moves to every 2 s. What happens to the advertising part of its average current?

Chapter 4

Peak Current and the Voltage Sag

See what the average hides: a short burst can drag the cell under the chip’s floor, and a small capacitor can stop it

The tag works on the bench for a week. You ship ten units. After four months two of them stop reporting. You open them, swap in a fresh cell, and they work again. You test the old cells with a meter: 2.6 V. That looks healthy. So why did the devices die?

The meter measured the cell at rest. The chip lives through bursts. When the radio starts, the current jumps from microamps to milliamps in a few microseconds. In Chapter 1 you saw Vterm = Voc − I × R. At 12 mA and 90 Ω that loss is 1.1 V. The chip sees the loaded voltage for the length of the burst, not the rested one.

A capacitor is a tiny local tank

Put a capacitor across the chip’s supply pins. A capacitor stores charge, like a small water tank beside the tap. During a burst, the chip drinks from the tank first. The cell refills the tank through its internal resistance R. A bigger tank, or a slower burst, means less sag.

Model it. The cell is Voc behind R. The capacitor C sits between R and the load. The load pulls a constant current I for a time tb. The voltage at the chip then follows a simple curve:

V(t)
The voltage at the chip, t milliseconds after the burst starts.
Voc
The cell’s open-circuit voltage at its current wear.
I × R
The worst-case drop: what you lose with no capacitor at all.
R
The cell’s internal resistance, in ohms.
RC
The time constant. R in ohms times C in microfarads gives microseconds. Divide by 1,000 for milliseconds. A burst much shorter than RC barely sags.

The sag is smaller than I × R by the factor (1 − e−tb/RC). That factor is near 1 when the burst outlasts RC, and near 0 when it is far shorter. That is the whole job of a bulk capacitor: make RC much longer than the burst.

Worked example. The cell is 93% used. From Chapter 1’s model, Voc = 2.55 V and R = 93 Ω. The burst is 12 mA for 0.8 ms (a radio plus a sensor).

  1. No capacitor. Drop = 0.012 A × 93 Ω = 1.11 V. The chip sees 2.55 − 1.11 = 1.44 V. That is under 1.7 V: reset.
  2. 10 µF. RC = 93 Ω × 10 µF = 0.93 ms. Factor = 1 − e−0.8/0.93 = 0.58. Drop = 1.11 × 0.58 = 0.64 V. The chip sees 1.91 V. It survives.
  3. 100 µF. RC = 9.3 ms. Factor = 1 − e−0.8/9.3 = 0.083. Drop = 0.09 V. The chip sees 2.46 V. Comfortable.

Drag the sag

The blue line is the voltage at the chip. The red dashed line is the 1.7 V floor. Raise the current or the wear until the line dips under it, then rescue it with the capacitor.

12 mA
0.8 ms
10 µF
93%

The chip floor of 1.7 V is the nRF52840 minimum supply. The cell (Voc and R against wear) is the illustrative model from Chapter 1, anchored to the Energizer datasheet’s 10 to 40 Ω typical resistance. The equation is exact for an ideal capacitor and a constant-current burst; real capacitors add series resistance and lose capacity under DC bias.

Failure, measurement, fix

Symptom. Resets that happen only at the moment the radio or an LED starts, mostly in older cells or in the cold. A bench supply never shows them, because a bench supply has a near-zero R.

Measurement. Put an oscilloscope on the chip’s VDD pin, trigger on the falling edge, and run the burst from a real coin cell (or from a bench supply with a series resistor of 50 to 100 Ω set to mimic an old cell). Read the lowest point of the trace. It must stay above the floor with margin.

Fix. Three levers, in order of cost. Shorten or stagger the peak: do not run the radio, the sensor and the LED at once. Add a bulk capacitor close to the chip, chosen so RC exceeds the burst. Or use a converter that draws less current from the cell for the same power (Chapter 6).

Choosing the capacitor

How big must the capacitor be? Start with a bound. In the first moments of a burst the cell barely helps, because R holds it back. The capacitor supplies nearly all the charge, so the voltage falls by ΔV = I × t ÷ C. Solve for C: C = I × t ÷ ΔV.

Worked example. A 12 mA burst lasts 0.8 ms. You can afford to lose 0.2 V. Then C = 0.012 A × 0.0008 s ÷ 0.2 V = 48 µF. That is an upper bound, because the cell does help a little, so a 47 µF part is a safe first choice. The exact formula from this chapter then tells you the true margin.

Three practical traps follow. A ceramic capacitor loses much of its capacity when it sits at a DC voltage, so a 47 µF part may act like 20 µF at 3 V. A capacitor has series resistance (ESR), which adds its own drop. And a leaky capacitor, such as some electrolytic types, adds a steady leak to the floor (Chapter 7). Choose a low-leakage part, put it right at the chip’s supply pins, and check its data at your voltage.

One more fix is free: shape the burst. If the radio, the sensor and the LED start in the same instant, their currents add. Start them one after another, a few hundred microseconds apart, and the peak falls while the charge stays the same.

On real hardware. On an nRF52840 DK powered from a CR2032 holder, probe VDD with a scope and trigger on the burst. Repeat with a 10 µF and a 100 µF capacitor across VDD, and with a 100 Ω resistor in series to imitate an old cell.
An old cell has R = 80 Ω. A 15 mA burst lasts much longer than RC. What drop appears at the chip, roughly?

Chapter 5

Brown-Out: The Floor and the Firmware

Follow one cell across its whole life, find the day the burst first fails, and teach the firmware to see it coming

A light bulb on a weak supply gets dim before it goes out. A chip is not so gentle. Below its minimum supply voltage, its logic stops being reliable. It may stall, run wrong code, or reset. Engineers call a dip into that zone a brown-out, from the dimming lights of a power grid under strain.

The nRF52840 Product Specification gives a supply range of 1.7 V to 5.5 V. That 1.7 V is the floor used in every chart on this page. It is not a safety margin. It is the edge. Another part has another edge, so always read your own chip’s datasheet.

What the sag does across a cell’s life

Chapter 4 looked at one burst on one day. Now move the cell along its life. Voc falls slowly, then quickly. R rises slowly, then quickly. The lowest voltage of each burst is Voc minus the drop, so it falls at an accelerating pace. At some day it crosses the floor. That is the failure day.

After that day the cell still holds charge. The charge you cannot reach is stranded capacity. In the hero you saw it as a dashed box. In this model a 25 mA LED burst with no capacitor strands about 15% of the cell, and the same burst with 10 µF strands about 12%. Cold makes it worse: the cell’s resistance rises as temperature falls, so the same burst digs deeper. The Energizer ratings are all at 21°C. The cold factor in the device below is an illustrative doubling of R, not a datasheet value.

Ride the whole discharge

The blue line is the lowest voltage of a burst on each day of a 27.4 µA life. The purple line is the warning threshold your firmware sets. Pick a burst, a capacitor and the cold, and find the failure day.

2.4 V

Illustrative cell model (Chapter 1) at a steady 27.4 µA, so the cell is spent at day 365. The 1.7 V floor is the nRF52840 minimum supply. The nrfx headers name the nRF52 power-failure thresholds from V17 to V28. A 10 µF or 100 µF capacitor is assumed lossless.

The reset loop

Here is the nasty part. The chip resets at the bottom of the burst. The load disappears, the cell voltage recovers, and the chip boots. Boot is quick. Soon the firmware starts the radio again, the burst returns, and the chip resets again. The device sits in a reset loop, drawing boot current over and over, and it drains the very charge it could not use.

You see it as a device that is “alive” on a meter but silent on the air. A power trace shows the same ramp repeating. Log the chip’s reset-reason register at every boot and count the resets. A burst of resets with no software cause points at the supply. The Product Specification for your part says which reset sets which bit.

Let the firmware see it coming

The nRF52 family has a power-failure comparator (POF). You set a threshold in the POFCON register. When the supply falls below it, the chip raises a POFWARN event, which can fire an interrupt. The nrfx hardware layer exposes it as NRF_POWER_EVENT_POFWARN, with thresholds NRF_POWER_POFTHR_V17 up to V28.

Set the threshold above the floor, say 2.4 V. The warning then arrives while the chip is still healthy. The handler does the cheap, safe things: skip the LED, stretch the advertising interval, stop writing flash (the flash and power-fail lesson shows why), and set a “low battery” flag in the advertisement so the phone can tell the user.

c/* sketch: arm the nRF52 power-failure comparator (nrfx HAL names) */
static volatile bool low_batt;

void pof_init(void) {
    nrf_power_pofcon_set(NRF_POWER, true, NRF_POWER_POFTHR_V24);  /* warn below 2.4 V */
    nrf_power_int_enable(NRF_POWER, NRF_POWER_INT_POFWARN_MASK);
    NVIC_EnableIRQ(POWER_CLOCK_IRQn);
}
void POWER_CLOCK_IRQHandler(void) {
    if (nrf_power_event_check(NRF_POWER, NRF_POWER_EVENT_POFWARN)) {
        nrf_power_event_clear(NRF_POWER, NRF_POWER_EVENT_POFWARN);
        low_batt = true;                 /* main loop: no LED, slow advertising, no flash writes */
    }
}

One caution. The warning can fire during the bottom of a normal burst and clear a moment later. So the handler should only set a flag, and the main loop should count several warnings before it changes behaviour. Otherwise one cold morning flips the device into limp mode for good.

Do not trust the voltage as a fuel gauge

It is tempting to report battery percent from the cell voltage. A lithium manganese dioxide coin cell makes that hard. In the model, Voc moves only from 2.95 V to 2.87 V over the first 85% of the charge, a change of under 0.1 V. Then it drops fast. A reading of 2.9 V could mean 10% used or 80% used.

Two better signals exist. The first is the warning itself: it marks the start of the steep part, so it is a good “replace soon” flag. The second is a charge ledger: the firmware counts its own events and adds up the charge from a table of known costs, as in the code of the last chapter. The ledger needs no measurement hardware, and it can be reset when the user changes the cell.

Before the radio starts, a careful device also reads its own supply. The nRF52 analog-to-digital converter can sample the supply pin (VDD) as an input. If the reading is low, the firmware can wait, slow down, or send only the cheap burst. The test costs a few microcoulombs and saves a reset loop.

Last, add hysteresis. If the device enters limp mode below 2.4 V, do not leave it above 2.4 V. Wait for 2.6 V, or for a new cell. Without it the device flips between modes on every cold morning, and every flip is a restart of work.

On real hardware. Power an nRF52840 DK from a bench supply set to 3.0 V behind a 50 Ω series resistor. Run a 12 mA burst and step the supply down in 0.1 V steps. Note the voltage at which POFWARN fires and the voltage at which the chip resets. Repeat with 100 µF across VDD.
A device resets on every radio burst, yet the cell reads 2.5 V at rest with a meter. What is the most likely cause?

Chapter 6

Regulators and the Current They Never Stop Drinking

Compare no regulator, a leaky LDO, a nano LDO and a buck converter, and see who spends the 27 microamps before your code even runs

Imagine a night guard who works for free but has one habit: he keeps one lamp lit all night. The lamp costs little by the hour. Over a year it costs more than everything else in the building. A voltage regulator is that guard. Its lamp is its quiescent current, written Iq: the current the regulator burns just to stay alive, even with nothing connected.

A regulator turns the cell’s changing voltage into a steady rail for a sensor or a chip. There are two common kinds. A linear regulator, or LDO (low dropout), acts like a variable resistor in series with the load. It throws away the extra voltage as heat. A buck converter switches an inductor on and off to step the voltage down, so it wastes much less at high loads, but it needs an inductor and has its own quiescent current.

The first question: do you need one?

The nRF52840 runs from 1.7 V to 5.5 V, so a CR2032 can power it directly, from 3.0 V all the way down to the floor. No external regulator means no Iq. The chip has its own internal regulators and an on-chip buck. In nrfx it is enabled by the DCDCEN register (nrf_power_dcdcen_set(NRF_POWER, true)), and it needs an external inductor on the board. It lowers the radio current for the same output power, because it steps the supply down to the core voltage without burning the difference as heat.

An external regulator earns its place when another part, a sensor or a display driver, needs a rail the cell cannot give. Then you must choose it with care.

Two numbers from two real datasheets

The TI TPS7A02 is a nanopower LDO. Its datasheet lists a typical Iq of 25 nA, even in dropout, and 3 nA in shutdown. Its input range is 1.5 V to 6.0 V and it is rated for 200 mA.

The TI TPS62740 is a buck converter built for coin cells. The datasheet lists a typical Iq of 360 nA, an input range of 2.2 V to 5.5 V, and up to 90% efficiency at a 10 µA output current. Look at that input range. The cell dies at 2.0 V by the Energizer rating. This converter stops working at 2.2 V. The regulator raises the effective floor, and that strands charge.

Now do the arithmetic for a 1.8 V sensor rail that averages 10 µA, fed from a 3.0 V cell.

  1. Generic LDO, Iq 50 µA (illustrative). An LDO passes the load current straight through. Battery current = 10 + 50 = 60 µA. That is more than twice the entire year’s budget.
  2. TPS7A02, Iq 25 nA. Battery current = 10 + 0.025 = 10.03 µA. The LDO wastes voltage, not current, so only the Iq adds.
  3. TPS62740, 90% efficient, Iq 0.36 µA. The converter trades volts for amps. Power out = 1.8 V × 10 µA = 18 µW. Power in = 18 ÷ 0.9 = 20 µW. Current from a 3.0 V cell = 20 ÷ 3.0 = 6.67 µA, plus about 0.36 µA: 7.0 µA.

So at light loads the nanopower LDO is almost free and the buck is best. At the burst, the picture shifts further: a 12 mA pulse on the 1.8 V rail pulls 12 mA from the cell through an LDO but only 12 × 0.6 ÷ 0.9 = 8 mA through the buck. Less cell current means less sag (Chapter 4). The buck helps twice.

Who pays for the rail?

A 1.8 V rail runs from a 3.0 V cell. Set its average and its burst load. Each bar is the average current the cell must give. The line is the 27.4 µA budget.

10 µA
12 mA

TPS7A02: 25 nA Iq, 1.5 to 6.0 V input (TI datasheet). TPS62740: 360 nA Iq, 2.2 to 5.5 V input, up to 90% efficiency at 10 µA (TI datasheet). The 90% is taken as the efficiency at every load, which flatters it at the burst. The generic LDO (50 µA Iq) and the 0.1 V dropout are illustrative. The cell is the Chapter 1 model at 3.0 V; usable charge uses a 0.8 ms burst and 10 µF.

Failure, measurement, fix

Symptom. A sleep current of 60 µA on a board whose chip sleeps at 1.5 µA. Measurement. Remove the regulator’s load (cut the rail with a jumper) and read the current with the load unpowered; what remains is Iq plus leaks. Fix. Choose a regulator whose Iq is under a tenth of your budget, check that its minimum input is below your chip’s floor, and switch off a rail you do not need (a load switch, or the regulator’s enable pin) instead of leaving it lit.

Switch it off instead of regulating it

The cheapest regulator is the one that is off. Most sensors are needed for a few milliseconds every few seconds. If the sensor idles at 3 µA, a year of idling costs more than ten of its readings. A load switch cuts its power between reads, so it draws nothing.

The TPS62740 datasheet shows the idea: its buck converter includes a slew-rate-controlled load switch with a typical on-resistance of 0.6 Ω, which distributes the rail to a sub-system you use only sometimes. The slew control matters for a second reason. A sensor with a large input capacitor draws a sharp inrush current when power arrives. A gentle ramp keeps that inrush from sagging the cell (Chapter 4).

The trade is time. A sensor that was off needs a start-up delay before its first good reading, often a few milliseconds, during which you pay its active current. So switch off only when the gap between reads is much longer than the start-up. Do the sum: idle current times the gap, against active current times the start-up time. Whichever is smaller wins.

Worked example. A sensor idles at 3 µA and is read every 30 s. Idle: 3 µA × 30 s = 90 µC. Off with a 5 ms start-up at 1.2 mA: 1.2 mA × 5 ms = 6 µC. Switching it off saves 84 µC every 30 s, which is 2.8 µA of average current.

On real hardware. On an nRF52840 DK, compare the current in System ON idle with DCDCEN off and on, and with the on-board regulator path versus a bench supply at 3.0 V on the nRF power pins. Use the PPK2 in source meter mode.
A 1.8 V rail averages 20 µA and is fed from a 3.0 V cell through an ideal LDO with Iq = 25 nA. How much average current does the cell give?

Chapter 7

Hunting the Leaks

Find the quiet microamps that sit outside your code, and learn to prove each one with Ohm’s law or a measurement

You built the table. It says 12 µA. You power the board and the meter says 79 µA. The firmware is not at fault; the chip is asleep. Something else on the board is drinking. The job now is a hunt, and the culprits are boring: a resistor, a sensor that never went to sleep, a flash chip still awake.

A leak is a steady current that flows when it should not. It does not show up in your duty table because no code causes it. It shows up only in a measurement of the whole board.

Ohm’s law finds the first suspect

A pull-up resistor ties a signal wire to the supply, so the wire reads high when nothing drives it. That is useful. But if a sensor pulls the wire low while it waits, current flows from the supply, through the resistor, into the sensor. Ohm’s law gives it: I = V ÷ R.

Ileak
The steady current wasted in the resistor, in amps.
V
The voltage across it. For a pull-up held low, that is the whole supply, about 3.0 V.
R
The resistance in ohms. Bigger R leaks less.

Worked example. A 100 kΩ pull-up held low: 3.0 V ÷ 100,000 Ω = 30 µA. That one resistor is bigger than the whole 27.4 µA budget. A 10 kΩ pull-up would leak 300 µA. A battery-monitor divider of 1 MΩ plus 1 MΩ across the cell leaks 3.0 ÷ 2,000,000 = 1.5 µA, as much as the chip’s whole sleep floor.

The other suspects cannot be computed. You must measure or read a datasheet. A serial flash chip left awake can draw tens of microamps until firmware sends it a deep power-down command. A sensor idles at a few microamps until its shutdown pin is used. A pin set as an input and left floating can pick up noise and toggle its input buffer. Nordic’s course on power measurement lists GPIO leakage, floating inputs and debugger interference among the usual causes of misleading readings. A debug probe that keeps the chip’s debug logic powered adds current too.

Fix the board

The clean duty table is 12 µA. Every suspect starts broken. Press one to fix it and watch the total fall. Can you reach the yellow budget line?

The 30 µA and 1.5 µA rows are Ohm’s law (V ÷ R at 3.0 V). The other leaks (3, 15, 2, 12 and 3 µA) and the clean 12 µA are illustrative sizes for teaching, not measurements of any part. Your own board will differ; that is why you measure.

The hunting method

  1. Know your references. The nRF52840 Product Specification gives 0.4 µA in System OFF (no RAM retention) and 1.5 µA in System ON with the RTC running, both at 3 V. Measure those first on your setup. If you cannot reproduce them, your measurement is wrong, not your firmware.
  2. Strip the board. Remove or isolate every part except the chip, a cell and the profiler. Measure sleep.
  3. Add one thing back. Re-attach one part, measure again, write down the step. The part that adds the most is your first fix.
  4. Fix by design. Raise the resistor, drive the pin high when idle, send the flash to deep power-down, use the shutdown pin, or put the part on a switched rail (Chapter 6).
  5. Re-measure the whole duty cycle. A fix can move a cost into the burst, so always finish with a full period trace (Chapter 8).

The firmware habit that keeps the board clean: before every sleep, walk a short list. Pins that nothing drives are set to a defined state. Peripherals are stopped. The flash and the sensors are in their lowest mode. In Zephyr that is usually done by suspending devices with runtime power management rather than leaving them idle.

Configure every pin before you sleep

A microcontroller pin has several states. As an output it drives high or low. As an input it can sense, and the sensing circuit (the input buffer) uses a little current when the pin floats near the middle of its range. A floating input, one connected to nothing, can drift, flip the buffer, and waste charge. The cure is to give every unused pin a known state before sleep: drive it, pull it, or disconnect its buffer.

c/* sketch: put pins in their lowest-leak state before sleeping (nrfx HAL names) */
static void pins_for_sleep(void) {
    for (uint32_t pin = 0; pin < NUM_PINS; pin++) {
        if (pin_is_used(pin)) continue;        /* board table: leave used pins alone */
        nrf_gpio_cfg_default(pin);               /* input, buffer disconnected: no leak */
    }
    nrf_gpio_pin_set(PIN_SENSOR_PULLUP_EN);   /* idle level that stops the 100 k pull-up leak */
    flash_deep_power_down();                  /* your driver: send the chip its sleep command */
    sensor_shutdown();                       /* your driver: use the shutdown pin or register */
}

Now a worked bisection, with the leak sizes used in the device above. The board reads 79 µA. You lift the pull-up: 49 µA. You send the flash to deep power-down: 34 µA. You unplug the debug probe: 22 µA. You shut the sensor down: 19 µA. The capacitor swap, the floating pin and the battery divider bring it to 16, 14 and then 12.3 µA, which is the clean duty table. Each step names a culprit and a size. That is the whole method, and it needs only a profiler and a screwdriver. Keep a log of the readings, so the next board starts from your notes.

On real hardware. Take an nRF52840 DK, cut or disable what the board lets you (the on-board debugger interface and LEDs add current), and measure System OFF, then System ON idle. Then add one external part at a time.
A 220 kΩ pull-up on a 3.0 V rail is held low by a switch that is closed all day. About how much current does it waste?

Chapter 8

Measuring It Honestly

Place a window on a current trace the right way, and see how a slow meter or a careless cursor reports the wrong average

You clip a multimeter in series with the cell. It flickers: 2 µA, 450 µA, 3 µA. You read it at a calm moment and write 3 µA in your report. The product then lasts three weeks. The meter was not broken. It was too slow for a signal that spends 99.8% of its time quiet and 0.2% in a burst.

A current that swings between microamps and milliamps needs a tool built for that. Nordic’s course on power measurement uses the Power Profiler Kit II (PPK2) and lists the choices that matter: shunt resistors, dynamic range and sampling rate. Equipment like power analyzers, oscilloscopes and multimeters each fit different jobs. The course warns that credible-looking values can be misleading or wrong, and it uses the System OFF and System ON idle states as known references.

Two ways to be wrong

A sample is one reading of the current at one instant. If a meter takes samples too rarely, it can step right over a burst. This is aliasing: a fast event looks like nothing, or looks like a different event. A burst of 0.8 ms sampled every 10 ms is seen only if a sample happens to land in it.

The second error is the window. The average of a repeating signal is exact only over whole periods. Cut a window that holds 1.5 periods and you count one burst twice as heavily as the sleep time around it. The Nordic exercise on advertising power practices exactly this: cursor placement and data extraction for periodic signals.

Iavg
The average current you report.
W
The window: the time between your two cursors. Use a whole number of periods.
i(t)
The true current at time t, with every burst in it.
N
The number of samples inside the window.
ik
The k-th sample. The sum only works if samples are dense enough to land in every burst, or if each sample averages its whole interval.

Read the trace

A device advertises every 1 s. Each event has three 0.8 ms bursts at 4.8 mA. Choose how fast your meter samples and where you put the window.

137 ms

A model, not an instrument. Signal: 1.5 µA sleep plus 0.27 µA self-discharge, three 0.8 ms bursts of 4.8 mA spaced 1 ms apart, once per second (the nRF52840 figures from Chapter 2). The bursts begin at time 0 of every period. “Average each interval” models a meter that integrates between samples.

The cursor method, step by step

  1. Find the period. Look for the repeating pattern. Here it is 1 s.
  2. Place the left cursor on an identical point of the pattern, for example the start of a burst.
  3. Place the right cursor exactly N periods later. N = 10 gives ten events; more is better.
  4. Read the average between cursors. The tool computes the integral for you.
  5. Turn it into life. Life in days = 240,000 µAh ÷ Iavg ÷ 24, then apply the loss from sag (Chapters 4 and 5), which no average shows.

Two more habits keep the number honest. Measure on the real target with the real cell or a source that mimics its resistance, because a bench supply hides sag. And run long enough to catch the slow events: a phone sync every 15 minutes will not appear in a 10 s capture, so add it to the table from its own capture.

Setup errors the trace will not show

A current meter works by passing the current through a small shunt resistor and measuring the voltage across it. That raises a problem. The current spans a range of about 3,000 to 1: 1.5 µA asleep, 4.8 mA in a burst. One shunt cannot serve both ends. A big shunt gives a readable voltage at 1.5 µA, but at 4.8 mA it drops so much that it starves the chip. Instruments switch shunts or ranges to cope, and the switch can leave a glitch in the trace. That is what the course means by dynamic range.

The shunt also adds its own drop, called burden voltage. Worked example: a 10 Ω range resistor carrying a 4.8 mA burst drops 0.048 V. The chip sees 48 mV less than the cell gives. On a worn cell that can tip a measurement run into a reset that the real product would not have. A source-meter mode avoids this by supplying the voltage itself, but then it hides the sag of the real cell. So use the mode that matches the question: source mode for the clean average, a real cell for the sag.

Other sources of error come from the board, as Chapter 7 showed: a debugger left connected, a floating pin, firmware that has not yet reached sleep. The cure is the known-reference habit. Measure System OFF and System ON idle first, and only then trust a number from your own firmware.

Finally, turn the average into a promise. Take 13.29 µA for the advertising pattern, add the sensor and sync rows from their own captures, and divide: life = 240,000 µAh ÷ Iavg ÷ 24 days. Then subtract the stranded charge the sag test found. State the answer with its conditions: temperature, cell wear and capacitor.

On real hardware. With an nRF52840 DK and a PPK2, capture 30 s of advertising at 1 s. Put the cursors across 10 events and note the average. Move the window by half a period and see how little it changes. Then change the cursors to span 1.5 periods and watch the error.
You capture a signal that repeats every 1 s and place cursors 1.5 s apart. What is wrong?

Chapter 9

The Budget Game: Hit 365 Days

Use every lever from the lesson at once, and ship a design that survives a year and every burst

You now hold seven levers. The advertising interval sets the radio’s share (Chapter 3). The capacitor and the cell wear set the sag (Chapter 4). The firmware warning sheds load before a reset (Chapter 5). The regulator sets the rail’s cost and the floor (Chapter 6). The board either leaks or it does not (Chapter 7). And the duty table adds them up (Chapter 2).

The game below gives you three real-feeling products. Each has fixed needs: how stale its data may be, how often it senses and syncs, how big its worst burst is, and what its sensor rail draws. You choose the rest. A design ships only when three checks pass at once.

  1. Average. The total average current is at or under 27.4 µA, so the charge lasts 365 days.
  2. Latency. The advertising interval is no longer than the product allows.
  3. Floor. The worst burst never drags the chip under the regulator’s input floor before day 365, counting the charge the floor strands.

A hint without a spoiler: the three products fail in three different ways. One is beaten by the radio, one by a quiet regulator, one by the sag. Read the red check lines, change one lever, and read them again. That loop is how real power engineers work, with a profiler instead of a canvas.

Ship a one-year device

Pick a product, then set the five levers. Green means the check passes. Ship when all three are green.

1.0 s

All three products are made up for the exercise. Chip and cell numbers come from the nRF52840 Product Specification, the Energizer CR2032 datasheet and the TI datasheets used in earlier chapters; sensor, sync, leak and burst sizes are illustrative. “Shed load at warning” means the 2.4 V warning drops the extra bursts, leaving only the 4.8 mA radio burst.

What the game teaches

Every product above passes with a different recipe, and none passes with the defaults. That is the point. A coin-cell year is not one clever trick. It is a series of small, checked decisions, each justified by a number from a datasheet or a trace.

When a design fails, ask which table row owns the failure. If the average is high, look at the duty table. If the latency check fails, you asked the product for something the radio cannot afford. If the floor check fails, look at the burst and the capacitor, not the average.

A worked solution: the door tag

Stop here if you want to solve it yourself. If you want to check your work, here is one path for the door tag. The product allows 1.2 s of staleness, so the advertising interval can reach 1.2 s. That costs 11.52 ÷ 1.2 = 9.6 µA.

  1. Floor. Sleep and self-discharge: 1.77 µA.
  2. Events. Advertising 9.6 µA, sensor reads 1.0 µA, a sync every 30 min: 12,000 µC ÷ 1,800 s = 6.67 µA.
  3. Rail. The 8 µA sensor rail through the TPS7A02 costs 8.03 µA.
  4. Total. 1.77 + 9.6 + 1.0 + 6.67 + 8.03 = 27.07 µA. That is just under 27.4, but only with all leaks fixed.
  5. Floor check. The worst burst is 4.8 + 4 = 8.8 mA. With no capacitor it fails at 92% of the cell, around day 340. With 100 µF it never fails.

Notice how thin the margin is: 0.33 µA. A real product would aim for a 20% margin. The buck converter gives it, with a total of 24.7 µA, but it raises the input floor to 2.2 V, so it needs the capacitor too. There is no free lunch, only trades you can now count.

Why the three products fail differently

Each product is built to teach one lesson. The door tag has a short staleness limit, so its interval cannot grow. It lives or dies on the regulator and the capacitor. The room thermometer reads a hungry sensor, so the sensor row and the rail dominate; the buck converter wins the average but costs floor. The asset tracker has a big 15 mA extra burst, so the average looks fine while the sag kills it. Try each, and notice that the same lever helps one product and hurts another.

That is the real skill. A checklist gives you the levers. The numbers tell you which one to pull this time.

A design averages 22 µA (it passes) but resets on day 310. Which lever is the best first try?

Chapter 10

Field Guide: The Coin-Cell Year on One Page

Review the method, keep the numbers and the code, and find the next lessons and the sources behind this one

The one-paragraph summary

A CR2032 gives 240 mAh, which spread over 8,760 hours is a 27.4 µA average budget. A duty table turns every state into charge per event and adds them up. The advertising interval is the biggest knob because event current scales as one over the interval. Averages hide bursts: the cell is a source with an internal resistance that grows with wear, so a burst makes the voltage sag, and a bulk capacitor flattens the dip. Below the chip’s floor the device resets in a loop and strands charge. A power-failure warning lets firmware shed load first. A regulator’s quiescent current and its input floor can cost more than the chip. Leaks hide outside your code. And you only know the truth by measuring whole periods with a fast, honest profiler.

The numbers that matter

WhatNumberWhere it comes from
CR2032 capacity240 mAh to 2.0 V, at 15 kΩ, 21°C; 3.0 V nominalEnergizer CR2032 datasheet
CR2032 internal resistance10 to 40 Ω typical; resistance graph axis to 120 ΩEnergizer CR2032 datasheet
CR2032 test loads0.19 mA at 2.9 V (15 kΩ); about 6.8 mA at 2.7 V (400 Ω); about 23 mA at 2.7 V (120 Ω)Energizer CR2032 datasheet
One-year budget240 mAh ÷ 8,760 h = 27.4 µAArithmetic (Chapter 0)
nRF52840 supply1.7 V to 5.5 V; on-chip DC/DC and LDOnRF52840 Product Specification
nRF52840 sleepSystem OFF 0.4 µA; System ON idle 1.5 µA (RTC), both 3 VnRF52840 Product Specification
nRF52840 radioTX 4.8 mA peak at 0 dBm; RX 4.6 mA peaknRF52840 Product Specification
TPS7A02 LDOIq 25 nA; input 1.5 to 6.0 V; 200 mATI TPS7A02 datasheet
TPS62740 buckIq 360 nA; input 2.2 to 5.5 V; up to 90% at 10 µATI TPS62740 datasheet
Advertising rangesFast 30 to 60 ms; slow 1 to 1.2 s; units of 0.625 msZephyr gap.h
Initial connection intervalRecommended minimum 30 ms (24 units of 1.25 ms)Zephyr gap.h
Why averages matter12 µA against 1200 µA is a 100 times difference in lifeNordic Developer Academy course
One advertising event (model)3 × 0.8 ms × 4.8 mA = 11.52 µCIllustrative, built from the radio figure
Sag with a capacitorV = Voc − I R (1 − e−t/RC)Derived from a Thevenin source and a capacitor

The ship checklist

  1. Write the budget: capacity ÷ hours, minus self-discharge.
  2. Build the duty table with a measured or datasheet current for every state.
  3. Pick the slowest advertising and connection settings the product allows.
  4. Find the worst burst. Compute or scope the lowest voltage at the chip with a worn cell and with the cold.
  5. Add a bulk capacitor so RC outlasts the burst, and stagger loads.
  6. Arm a power-failure warning above the floor and decide what to shed.
  7. Check every regulator for Iq and for its input floor.
  8. Hunt leaks by adding parts back one at a time. Verify System OFF and System ON idle first.
  9. Measure whole periods, with a fast profiler, on the target.
  10. Keep the table in the repository and check it in tests.

The core as code

This sketch keeps the duty table as data and computes the average and the life. It runs on a laptop in a unit test, so a change to an interval that breaks the budget fails the build before it reaches a battery. Currents are in nanoamps and times in microseconds to keep the arithmetic in integers.

c/* budget.c: the duty table as data, with a build-time check */
#include <stdint.h>

typedef struct {
    const char *name;
    uint32_t current_nA;     /* while in this state */
    uint32_t on_us;          /* time in the state, per event */
    uint32_t every_ms;       /* time between events */
} duty_t;

static const duty_t TABLE[] = {
    { "sleep",       1500,    1000000, 1000  },  /* nRF52840 System ON, RTC: 1.5 uA */
    { "advertise",  4800000,     2400, 1000  },  /* 4.8 mA, 3 bursts of 0.8 ms */
    { "sensor",     1200000,    25000, 30000 },  /* illustrative */
    { "phone sync", 3000000,  4000000, 900000 },  /* illustrative */
};
enum { SELF_DISCHARGE_nA = 270, CAPACITY_uAh = 240000, BUDGET_nA = 27400 };

uint64_t average_nA(void) {
    uint64_t sum = SELF_DISCHARGE_nA;
    for (unsigned i = 0; i < sizeof TABLE / sizeof TABLE[0]; i++) {
        /* nA x (us on / us between) = average nA for this row */
        sum += (uint64_t)TABLE[i].current_nA * TABLE[i].on_us / ((uint64_t)TABLE[i].every_ms * 1000);
    }
    return sum;
}
uint32_t life_days(void) {          /* charge-limited; Chapters 4 and 5 trim it for sag */
    return (uint32_t)((uint64_t)CAPACITY_uAh * 1000 / average_nA() / 24);
}
/* in the test: assert(average_nA() <= BUDGET_nA); assert(life_days() >= 365); */

With the table above the sum is 1,500 + 11,520 + 1,000 + 13,333 + 270 = 27,623 nA. That is just over the 27,400 nA line, so the test fails and tells you to slow something down. This is the Chapter 2 table, written so a machine can guard it.

What this lesson is, and is not

Every device here is a model. They run in your browser, with a cell model fitted around datasheet numbers and clearly marked illustrative values. They show the shape of the trade, not your board. The chip numbers come from datasheets and the checks come from measuring a real target. Examples use an nRF52840 and a Zephyr or nrfx style; a Cortex-M part from another vendor, such as an STM32 low-power series, has its own sleep modes and its own floor, but the same budget method applies.

Where this sits

BLE from Radio to GATT built the radio side: advertising, connection events and the intervals you tuned here. Sleep and the Battery Budget gives the general power maths. Flash, Filesystems and Power-Fail covers what a brown-out does to stored data.

Keep going

The takeaway. A year on a coin cell is not luck and not one trick. It is a budget of 27 microamps, a table that adds up every state, a cell model that predicts the sag, and a measurement that proves it on the real board.

Sources and credit

This lesson is our own work, built from primary sources. Check any number against them before you design:

Now press Present or Teach and explain, from memory, how to turn a CR2032 into a one-year device: the budget number, the duty table, the knob that moves it most, the burst the average hides, and the check that stops the reset loop. Then go back to the instrument at the top, set a 12 mA burst on a nearly spent cell, and find the interval and the fix that keep the year.

The Coin-Cell Year
Previous: BLE from radio to GATT · Sleep and the battery budget · Back to Gleams