# Battery Fuel Gauge with Zero Parts and Zero Pins on AVR

It can be nice to know how much battery power you have. It becomes critically important with LiPo batteries since you can permanently damage them by running the voltage down too low. Typically battery voltage detection requires adding a circuit with extra parts and their associated power requirements. Wouldn’t it be great to be able to do this using nothing but software? Read on for a no parts, no pins, no power solution…

## Normal Low Battery Detector Circuit

Here is a typical by-the-book low battery detector for LiPo-powered devices…

The voltage divider R5/R9 scales down the battery voltage, where it is compared to an integrated reference voltage inside U3, which outputs a LOWBAT signal that would typically connect to an input pin on your micro-controller.

This circuit works fine and will indicate when the battery voltage drops below the threshold voltage (about 3.6 volts with the above values), but it has a few drawbacks…

• The voltage divider formed by R5 and R9 is always drawing current – 12uA at the low cutout voltage.
• The comparitor U3 is always drawing current – typically ~2.5uA at the cutout voltage.
• The pull-up resistor R6 is drawing ~7.6uA whenever there is a low battery.
• Requires a dedicated input pin on your micro-controller.
• Requires 5 physical parts that cost money and use up board space.
• Can only detect a single hardwired threshold voltage.
• The threshold voltage depends on the tolerances of R5 and R9, and there is no way to calibrate it.

Do we really need 5 parts, an input pin, and >20uA of constant power draw just to detect a low battery?

Do we really need 5 parts, an input pin, and 20uA of constant power draw just to detect a dead battery?

Power is precious, especially if  you are using an adorably small LiPo battery. And this circuit continues to pull power even after it has detected a low battery condition- there is no way to turn it off. We can do better…

For more detail: Battery Fuel Gauge with Zero Parts and Zero Pins on AVR