# proper voltage divider for battery voltage detection

The solution (and resistor values) depends on the battery/voltage you want to measure.

Yes, this is obvious. I think I would probably split the difference and go with something in between 100k and 1M, like maybe 470 k to 560 k, but the 1M is still not a bad choice.

Grumpy_Mike: That is silly, don't do it. All it does is slow down the response time of the circuit to a new voltage.

All those circuits will not do anything. There is no common ground and 1M is way too high.

But that's part of what I'm trying to do. Use a high resistance to decrease battery drain. Doesn't the capacitor solve the issue?

A cap is an energy storage deice. The energy it stores "costs" more mAh than the analog input whiich draws 160nA .

Doesn't the capacitor solve the issue?

No.

Grumpy_Mike: That is silly, don't do it. All it does is slow down the response time of the circuit to a new voltage.

All those circuits will not do anything. There is no common ground and 1M is way too high.

The capacitor idea is NOT silly IMHO. It allows you to use a large voltage divider to prevent battery drain. 1M is perfectly fine. I am using 2 x 1M to measure a 6..8V battery. Response time is usually not an issue with a battery. Of course you are right with the missing ground connection.

The capacitor idea is NOT silly IMHO. It allows you to use a large voltage divider to prevent battery drain. 1M is perfectly fine. I am using 2 x 1M to measure a 6..8V battery. Response time is usually not an issue with a battery. Of course you are right with the missing ground connection.

The capacitor idea is NOT silly IMHO

As already stated, a capacitor is nothing more than an energy storage device. Once it has charged, that energy has been removed from the battery and is no longer available for anything else. You still have to "pay" for that energy . It is not free. The amount of energy removed from the battery by the cap is more than the 160 nA that the analog input draws so the cap accomplishes nothing. If you use two 470 k resistors for the voltage divider, the total resistance across the battery is 940 k. If you had a 3.7v battery, the drain would 3.9 uA. That is 1/254th of 1 mA so an 1100 mAh battery would last 1100 mAh/3.936170 uA would last 279459.459 hours.

1.1Ah /3.9361702127659574468085106382979e-6 A =279459.45 hours.

279459.45 hours/24 hours = 11644.14375 days

11644.14375 days /365 days = 31.901763 years.

So how silly it that to use a cap to avoid a current drain that would 31.9 years to drain the battery ?

From the data sheet:

The ADC is optimized for analog signals with an output impedance of approximately 10 k or less

So even for a moderate resistor divider a capacitor is needed to keep the input stable during the analog read

The ADC is optimized for analog signals with an output impedance of approximately 10 k or less

Who cares what the OUTPUT impedance is when it is used as an INPUT ?

The INPUT impedance is in the order of 100 Mohms and it only draws 160nA as an analog input.

To even talk about the ADC current draw is silly. There are no scenarios you could come up with where it would be worth discussing.

@raschemmel, you're not reading it right ;) He is talking about the output impedance of the circuit to measure and that IS important ;)

23.6.1 Analog Input Circuitry The analog input circuitry for single ended channels is illustrated in Figure 23-8. An analog source applied to ADCn is subjected to the pin capacitance and input leakage of that pin, regardless of whether that channel is selected as input for the ADC. When the channel is selected, the source must drive the S/H capacitor through the series resistance (combined resistance in the input path). The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less. If such a source is used, the sampling time will be negligible. If a source with higher impedance is used, the sampling time will depend on how long time the source needs to charge the S/H capacitor, with can vary widely. The user is recommended to only use low impedance sources with slowly varying signals, since this minimizes the required charge transfer to the S/H capacitor. Signal components higher than the Nyquist frequency (fADC/2) should not be present for either kind of channels, to avoid distortion from unpredictable signal convolution. The user is advised to remove high frequency components with a low-pass filter before applying the signals as inputs to the ADC.

So in other words , if Zo (of curcuit) >10 k, add cap ?

Yes, and reduce the reading frequency. Because the load of the ADC will play a significant role on the circuit then. Adding a cap gives it some buffer but reduces the response time.

Roger that.

Yes but adding a cap is silly. It does nothing for you. Yes there is a capicitor on the sample and hold to the A/D converter and with such a high input impedance it is going to take time to charge. So the proper way to do this is to read the analogue input twice and if necessary put a delay between the two. An external capacitor is only going to slow down the response, add to the inaccuracy with leakage current and is a thorougher waste of a capacitor.

He has a point.

t = RC

Let R = 10 k

= 10000 * 10 e-9 = 0.0001 S

f = 1/0.0001 S

f = = 10000 samples/per second

Let R = 1 Mohm

C = 10 e-9

t = R* C = 1000000 * 10 e-9

t = 0.01 S

f = 1/0.01 S

f = 100 Hz(100 times slower)

septillion: Adding a cap gives it some buffer but reduces the response time.

Grumpy_Mike: Yes but adding a cap is silly. It does nothing for you. Yes there is a capicitor on the sample and hold to the A/D converter and with such a high input impedance it is going to take time to charge. So the proper way to do this is to read the analogue input twice and if necessary put a delay between the two. An external capacitor is only going to slow down the response, add to the inaccuracy with leakage current and is a thorougher waste of a capacitor.

I'm reading battery voltage, so it's not changing very often, and I'm not reading very often. Response time should not even be an issue. The capacitor has all the time it needs to charge up. I'm not sure leakage current really adds to the inaccuracy, or that much waste. A few uA for small capacitors?

raschemmel: As already stated, a capacitor is nothing more than an energy storage device. ...You still have to "pay" for that energy . It is not free. The amount of energy removed from the battery by the cap is more than the 160 nA that the analog input draws so the cap accomplishes nothing. If you use two 470 k resistors for the voltage divider, the total resistance across the battery is 940 k. If you had a 3.7v battery, the drain would 3.9 uA. That is 1/254th of 1 mA so an 1100 mAh battery would last ...

@raschemmel regarding "the amount of energy removed from the battery by the cap". Aren't leakage current in the order of uA for such small capacitances? Also, 470k resistor is too high to give accurate analog voltage readings.