Somewhere out in the field, a tiny battery-powered sensor is quietly dying. No warning light, no alert, nothing. One day it just stops responding, and nobody knows why until someone finally goes and checks it by hand.
How do you stop that from happening? The obvious answer is measure the battery voltage. But what if the chip you are using was never given an ADC(Analog to Digital Converter) to measure anything with?
No ADC means no voltage reading, right? Not quite. Nordic's nRF5x family, including the nRF51 and nRF52 series, has a sneaky little piece of analog hardware built right into the silicon that does not care about your missing ADC at all. It is called POFCON, the Power Failure Comparator, and it solves the whole problem with almost no power budget.
Here is the story of how it works, and why it beats a traditional voltage divider for this job.
The Familiar Way: ADC + Voltage Divider
This is the setup everyone learns first.
- Two resistors split the battery voltage down to something the ADC can read
- Firmware wakes up, powers on the ADC, takes a sample, powers it back down
- The reading gets compared against a lookup table to decide battery health
You get a real number - a full discharge curve, a percentage remaining, whatever you want.
The catch:
- The divider leaks current constantly, unless you add a switch to gate it (more parts, more GPIOs, more headaches)
- Every ADC read costs power to spin up the analog block, settle, sample, and shut back down
Fine for a device on mains power. Brutal for a coin cell that is supposed to sleep for months.
The Sneaky Way: POFCON
POFCON, short for Power Failure Comparator, is a small analog comparator circuit built directly into the chip's silicon during manufacturing, sitting inside the power management block. It is real hardware, not a software feature - it is there whether you use it or not.
You configure a voltage threshold, and the comparator watches the supply rail against an internal reference. It flags the result the moment the rail crosses the line.
No sampling, no conversion, no ADC involved. It just answers one question: are we above the threshold or below it?
A minimal polling setup at the API level (nRF5 SDK) looks like this:
// Configure the comparator threshold and enable it
nrf_power_pofcon_set(NRF_POWER, true, NRF_POWER_POFTHR_V23); // threshold ~2.3V
// Later, on wake or on a timer, just read the flag
bool battery_low = nrf_power_pofcon_get(NRF_POWER, NULL);
Using nRF Connect SDK / Zephyr instead of the nRF5 SDK? The snippet above is a legacy nRF5 SDK register-level call. In NCS, power-fail detection is configured through devicetree/regulator bindings rather than these direct API calls - check the
nrfx_powerdriver docs for the equivalent on your SDK version before copying this in.
Why this is clever: it uses zero external components and burns almost no power, compared to a divider that leaks current and an ADC that costs power on every read.
- No external divider needed - it watches the internal rail directly
- No ADC powers up, ever
- It exists specifically for chips that skip a full ADC to save die space and cost
This is not a one-chip party trick. Plenty of low-cost, low-power parts skip the ADC for the same reason: cheaper silicon and lower standby current. The name changes depending on who made the chip, but the idea stays the same - a low-power comparator watching the supply rail.
A few places you'll run into it:
- Across the Nordic nRF5x lineup (nRF51, nRF52 series, and some nRF24 parts), it's called POFCON, exactly as covered here
- On STM8 and value-line STM32 parts, the equivalent is usually a Brownout Detector (BOD) or Low Voltage Detector (LVD)
- On other budget Bluetooth SoCs, including parts from vendors like Nations Technologies and Telink, you'll find similar brownout or low-voltage detection hardware, just under their own naming
A quick word of caution before you go looking for one: not every chip has this.
- Some very low-cost parts skip both the ADC and any power-fail comparator, brownout detector, or low-voltage detector entirely
- Do not assume it's there just because the chip is marketed as low power
- Always open the datasheet first, confirm the block actually exists, and check its threshold options before you design your battery monitoring approach around it
The Real Tradeoff
| ADC + Voltage Divider | POFCON | |
|---|---|---|
| What you get | Actual voltage value | Above or below threshold, nothing else |
| Detail level | Full discharge curve possible | One fixed threshold |
| Power cost | Divider leaks current, ADC costs power per read | Barely anything |
| Setup effort | Calibration, lookup tables | Set a threshold and move on |
| Good for | Battery percentage, health tracking over time | A simple low-battery flag, cheap |
If you need the full story of your battery's life, use an ADC. If you just need to know when to shout "replace me," POFCON wins on power every single time.
Wrapping Up
Low-power design is always a game of tradeoffs. The instinct is usually to reach for an ADC by default, but hardware like POFCON is a good reminder that less is sometimes more when battery life is on the line.