# What's the best way to measure battery voltage?

#### Roger at CCCC

Joined Jun 8, 2009
17
What's the best way to measure battery voltage?

I want to use an Arduino or Electric Imp to monitor the voltage of its battery every hour or so. But the battery's voltage is higher than the maximum analog input voltage (5 v for Arduino and only 3.3 v for Electric Imp). So the obvious way to do that is with a voltage divider across the battery. But the voltage divider drains the battery even when the battery voltage is not being monitored. So what's another way? Is there an IC that measures battery voltage without a drain on the battery itself? Or what's the best way to turn off the voltage divider when it's not being used to monitor the voltage? Is there an IC to do that? Thanks for any suggestions. I'm sure this question has been answered many times, but I couldn't find a good explanation of the best way to do it.

#### AnalogKid

Joined Aug 1, 2013
10,590
If you have a spare digital output from the arduino, connect it to the gate of a 2N7000 or 7002. Source to GND, Drain to the bottom end of the battery voltage divider. When you want to take a reading, turn on the transistor, take the reading, turn off the transistor. For accurate readings, include the transistor Rdson in the voltage divider calculation.

ak

#### Dodgydave

Joined Jun 22, 2012
10,971
You could use Megaohms or Gigaohms resistor divider.

#### Brownout

Joined Jan 10, 2012
2,390
Typically, input current to microcontrollers is very low ~50 - 100 nA. So you can easily use a voltage divider in the megohm range, which results in very low battery drain, averaging hundreds of thousands of hours of capacity for a typical automotive battery. I see Dodgydave beat me to this point.

If you are still determined to switch off the voltage divider, using a megohm divider connected directly to an I/O is workable. No external swtich is needed.

Last edited:

#### grahamed

Joined Jul 23, 2012
100
If you disconnect the bottom of the divider from 0V then the middle of the divider will be pulled towards the input voltage and current will flow into the sensing pin and through the protection diodes.....

#### Roger at CCCC

Joined Jun 8, 2009
17
Thanks to all responses. Just what I wanted to know !!

#### RichardO

Joined May 4, 2013
2,270
Typically, input current to microcontrollers is very low ~50 - 100 nA. So you can easily use a voltage divider in the megohm range, which results in very low battery drain, averaging hundreds of thousands of hours of capacity for a typical automotive battery. I see Dodgydave beat me to this point.

If you are still determined to switch off the voltage divider, using a megohm divider connected directly to an I/O is workable. No external swtich is needed.
With high value resistors, Microchip recommends a capacitor from the A/D input to ground to average out fluctuations of the input voltage caused by the A/D applying varying capacitive loads to the pin during the conversion process.

#### ian field

Joined Oct 27, 2012
6,536
What's the best way to measure battery voltage?

I want to use an Arduino or Electric Imp to monitor the voltage of its battery every hour or so. But the battery's voltage is higher than the maximum analog input voltage (5 v for Arduino and only 3.3 v for Electric Imp). So the obvious way to do that is with a voltage divider across the battery. But the voltage divider drains the battery even when the battery voltage is not being monitored. So what's another way? Is there an IC that measures battery voltage without a drain on the battery itself? Or what's the best way to turn off the voltage divider when it's not being used to monitor the voltage? Is there an IC to do that? Thanks for any suggestions. I'm sure this question has been answered many times, but I couldn't find a good explanation of the best way to do it.
Connect the battery to the divider via a P-channel MOSFET and use an open collector/drain output to pull the gate down to sample.

#### marcf

Joined Dec 29, 2014
287
I have used the 20Meg resistor in my fluke DVM as the component in a voltage divider in order to measure very small current leakage. (2v = 10 nano amps)

Can you use the same process in an ADC converter to monitor voltages with very little loading?

What are the draw backs of doing this. Seems input capacitance would be one, but if you are measuring DC, so what.

Would the results be consistent from device to device?

Just wondering.