I would like to sense the voltage of a LiPo battery with an Arduino Pro Mini behind a 3.3V buck-boost regulator. So, I plan to use a voltage divider with two resistors to get the peak voltage down to 3.3V. What are the maximal resistor values I can use to get an acceptably accurate read on the analog input? I read that the impedance in the data sheet cannot always be trusted.
Since the device will sleep most of the time, the .2mA that a 10k voltage divider would draw would actually matter, so I would like to make it as resistive as possible. On the other hand, the polling frequency may be low.
Any estimations?
ElCaron:
I would like to sense the voltage of a LiPo battery with an Arduino Pro Mini behind a 3.3V buck-boost regulator. So, I plan to use a voltage divider with two resistors to get the peak voltage down to 3.3V. What are the maximal resistor values I can use to get an acceptably accurate read on the analog input? I read that the impedance in the data sheet cannot always be trusted.
Since the device will sleep most of the time, the .2mA that a 10k voltage divider would draw would actually matter, so I would like to make it as resistive as possible. On the other hand, the polling frequency may be low.
Any estimations?
Directly from an AVR datasheet: [b]The ADC is optimized for analog signals with an output impedance of approximately 10 k or less.[/b]
As you correctly noted, a voltage divider to give you this "stiff" of a signal will be a noticeable drain on the battery pack.
Therefore, I have two suggestions:
-
Try to figure out some kind of a switch (analog switch with a fet or maybe a CD4066 if it can take the voltage levels) and connect the voltage divider to the battery only for a reading, then disconnect it again. A CMOS part like the 4066 draws virtually nothing (microamps).
-
Use an op-amp with a very high impedance divider of maybe a 470K to 1meg range and let the op-amp give you the low impedance output to drive the ADC. Note that very high values of divider resistor will be influenced by humidity, board cleanliness (i.e. residual flux) and may not be as stable or accurate as you would like.
That's all I can think of. Maybe someone else has an idea?
Hope this helps.
Forget accuracy and use high resistor values.
Use a resistor divider with a resistor of 100k to 1M to the battery and a resistor 10k to 100k to GND. Select the internal reference, and use the average of about 20 samples.
If it is noise, a small capacitor of 1nF to 10nF can be used parallel with the resistor to GND.
The internal reference is never exactly 1.100V, you have to measure that and use the actual value in the sketch.
It should be no problem to measure the battery voltage with 50mV resolution, probably a lot better.
Thanks, I'll have a first go with a high resistance voltage divider.
Put a capacitor between the divider and the input pin like Peter suggested. This will store a little bit of charge that can feed the analog input when it takes its sample. For a slowly-changing input like battery voltage, you can use almost any value you like. Just choose a capacitor with low leakage as the internal leakage of the capacitor will affect your voltage divider.
Use high value resistors and a 100nF capacitor to ground - its the cap that
makes this low impedance. The Analog inputs have almost infinite input
resistance, but the dynamic impedance is low at high frequencies due to
the sample/hold capacitor on chip. 100nF will totally swamp this.
If you want to measure fast changing signals a capacitor will act as low pass
filter in concert with the divider, so the resistors would need to be smaller
(and if 10k or less the cap isn't really helping any more).
As MarkT says, the problem is not that the analog input has low impedance - it is that it charges a sample-and-hold capacitor. So if you are switching between analog inputs, using less than 10k impedance source can cause the current reading to have the "ghost" of the previous reading.
You can add that capacitor, or just read the same analog input a bunch of times to let it settle.
Impedance by definition includes resistance and capacitance, so it is low impedance!
Z = R + 1 / (j w C)
It is complex.
If the input is steady, it will eventually charge the internal sample-and-hold capacitor even if the source impedance is high.