Low current battery monitoring

I want to run a micro-controller from a 1S lipo through a 3V linear regulator. I need to measure the battery voltage however. The problem with using a voltage divider is that it would drain the battery over time which may or may not have protection circuitry built in. Since the AVR I'm using has a recommended input impedance of no higher than 10K I can't make the divider too large either.

Can anyone suggest a solution that would allow me to monitor this voltage without killing an unprotected battery over a couple of months? The circuit might enter deep sleep mode for an extended period meaning a voltage divider solution would consume the most power.

I ended up using both Hanno and Andy's solution. Thanks for all the input. Can only choose one answer unfortunately.

The voltage divider needs to join the MCU in deep-sleep mode then... This can be achieved with a P channel FET (for instance).... When the MCU wakes up, it will want to measure the battery voltage so what it can do is turn on a circuit formed around a P channel FET that connects the battery +V to the voltage divider: -

The ADC input is shown to the right and there will be no voltage reaching it unless the MCU has activated the BC547 via the 10k resistor. Without activation, the P channel FET is turned off and virtually open circuit. If you can program the MCU to have a pull-down on its control pin when asleep that should be it, else add another (say) 10k resistor from that point to ground - this ensures the P channel FET is completely off.

A small word of warning, choose a P channel fet with low leakage current when off else there will be a slight drain on battery life but most fets are going to be under 100nA and many in the region of 1nA.

One final thing - how does the voltage regulator perform on it's standby current when the micro is off - do you need to take care of it as well?

• I'm using the MCP1802 which has 25uA Q current, this part works fine. Thanks for the suggestion, exactly the type of solution I was looking for. – s3c Apr 5 '13 at 11:29
• why would you use a P-Chan with transitor and not a single N-Channel fet? – jme Dec 6 '13 at 2:40
• @jme - the ADC and MCU is referenced to ground and so it makes sense to switch the higher voltage feed. If I used an N channel device there would still be a drain permanently through the top resistor and thru the parasitic diodes in the MCU when it is in sleep mode. – Andy aka Dec 6 '13 at 11:12
• @Andyaka what id the N-Fet was reversed so that the diode was reversed to not allow the current to flow to the ADC resistors? – jme Dec 9 '13 at 1:02
• @jme "Why not use a low side switch (e.g. N-ch FET or μC i/o pin)?" is a good question. Here's why. The battery voltage can be greater than Vcc. When the low side switch is opened, then the battery voltage will appear on the A/D pin. That could lead to the burnage of the A/D, or to a leakage of the battery through the protection diodes on the A/D pin. Related thread. – Nick Alexeev Sep 4 '14 at 1:42

When you need to find out only when the battery is going to be dead (or give a warning shortly before that), you don't need to measure the its voltage directly. The output voltage of the regulator will fall below 3V before the battery reaches its minimum voltage. So you could measure the supply voltage of the micro controller.

Depending on its actual capabilities, you can do that without using a voltage divider. For an example, look the the ADC datasheet for a PIC12F1822, (on page 141):

The PIC has an internal voltage reference, and can measure its value (the 'FVR buffer' which goes into the multiplexer). But it can also use the supply voltage as reference for ADC measurements (the ADPREF selector on the top).

Given that, one can simply measure the voltage reference with respect to the supply voltage, and get the supply voltage as an result. In the case of the 12F1822, the internal reference is 2.048V, and the ADC has 10 bit resolution. So when the supply voltage drops below 3.0V, the ADC result goes higher than 699:

$$ADCresult=1024*\frac{V_{in}}{V_{ref}}$$ which in our case is $$ADCresult=1024*\frac{2.048V}{V_{supply}}$$

Note that lower supply voltage means higher ADC results, since input voltage and reference voltage are swapped to the usual way. You can convert this formula to find out the actual supply voltage, given the ADC result.

Do you really need the linear regulator? Running the µC at full battery voltage will make things a lot easier. Besides, the regulator and the µC will always consume power, even in power-save modes, continuously draining the battery. Have a look at the data sheets and keep that in mind.

Because the ADC input (of a common sample-and-hold ADC, like that in an AVR µC) will only sink current when actually sampling a value, the transient low input impedance can be compensated for by simply adding a capacitor:

simulate this circuit – Schematic created using CircuitLab

The maximum sampling frequency will of course be limited this way since the capacitor will need time to re-charge through the large resistor before the next sampling is done, but I assume you will not be measuring more than, say, once a second anyway.

The time required to re-charge the capacitor can be set by varying its capacity and/or R1. Larger R1 = less "loss" of energy + lower max. sampling frequency. Smaller capacity will be charged quicker for a given resistor and so on.
You will want to maximize R1's value, and may then need to minimize the value of C1 to achive the desired sampling frequency.

The minimum capacity depends on the amount of charge the ADC will draw for a sample, which in turn is determined by the capacity of the ADC's sample buffer. For AVR devices I seem to remember that this value is specified in the datasheet. For other µCs I cannot tell, but the 1µF in the diagram will probably be more than enough in any case, and can possibly be reduced by a factor of 10 or so. The ADC's specs will tell.

Edit:

I found this in Atmel's datasheet for the ATmega1284p. The S&H buffer's capacitor is specified to 14 pico-farads, so a couple of nano-farads for C1 should be plenty.

See for instance the discussion here.

• The linear regulator will be in turn be controlled by a ultra low current voltage detector, effectively removing both the uC and the regulator from the circuit should the battery drain below a certain value. – s3c Apr 5 '13 at 11:24
• Ok, but is the regulator required for the µC supply, or can the µC be powered directly by Vbat, in which case it may work without any voltage divider. – JimmyB Apr 5 '13 at 13:04
• I seem to understand now that you're not actually asking how the device can be built to use minimum power, but rather only how to make sure the LiPo is not destroyed. Is this correct? – JimmyB Apr 5 '13 at 13:07
• Yes, the regulator is required for the uC supply. Using minimal power is preferred but not my main concern. – s3c Apr 5 '13 at 13:16
• What does the output of the voltage detector you mentioned look like? – JimmyB Apr 5 '13 at 13:17