Voltage divider for arduino: only small resistors? - Page 1
Forum section: electronics / beginners

author: anvoice
author_rank: Frequent Contributor
timestamp: September 10, 2017, 10:34:17 pm
content: I'd like to measure a 3S LiPo battery voltage (12.6V max) using an arduino (5V). I know the max recommended impedance to be connected to the analog measurement pins is about 10K, but I read about a certain trick someone applied to use resistances in the 10M range for the divider:https://jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/.By using a 0.1uF resistor connected in parallel with the bottom (closer to ground) resistor, they were able to measure the voltage with good accuracy and stability. I was hoping to replicate this to minimize the battery drain during measurement. However, when I tried the same, I notice that as soon as I attach a capacitor (I only have 0.01uF and 1uF, so I tried both) to the circuit, the measured voltage at the divider drops significantly. In fact the apparent resistances on the resistors change as well, e.g. my 1.2M resistor now measures as 500K. Clearly something is going wrong, and it's a bit beyond my knowledge right now.So the question is two-fold: could anyone explain what might be going on in this circuit, and is it in fact possible to use the higher value resistances, or should I stick to the 10K range?Thank you.

author: Yansi
author_rank: Super Contributor
timestamp: September 10, 2017, 11:10:09 pm
content: The capacitor makes the impedance look lower, when the internal sample and hold circuitry inside the ADC tries to charge its sampling capacitor. When that happens, the ADC pulls some small amount of current for a short time //microseconds//. If the measured voltage source impedance is high, then you measure inaccurately, because the ADC sampling capacitor could not charge enough, because the source impedance was too high.Therefore there is a limit of how big the impedance can be, to still be able to measure voltage correctly.Connecting a cap to the input analog pin (when the voltage source impedance is very high) makes possible for the ADC to pull the current to charge its sampling capacitor quickly.Adding a capacitor there can NOT affect the impedance of the votlage divider. You're doing something wrong. Draw us a circuit diagram please, how you connected everything together.Note: If you do not want to drain the battery at all, then disconnect the divider, when not measuring voltage of the battery. For example using a mosfet. (Choose one with especially low leakage current if possible.)

author: anvoice
author_rank: Frequent Contributor
timestamp: September 11, 2017, 01:44:25 am
content: Attached is the circuit I'm making. The 2 resistors on top are merely a crude tuning of the resistor to maximize my measured voltage range on the arduino, you can view them as 1 resistor I believe.The thing is, the circuit is so simple, I don't see what I could be doing wrong. Please correct me if there's an obvious error.Edit:Ok, I think I figured it out... I forgot to connect the arduino to common ground with the rest of the circuit.Now everything behaves as expected. Not sure how to explain the behavior I saw anyway, but apparently the dissimilar grounds didn't play well with the capacitor.

author: mikerj
author_rank: Super Contributor
timestamp: September 11, 2017, 11:56:08 am
content: Note that adding a capacitor only helps with the current transient when the s/h capacitor in the ADC is switched to the required input. A capacitor will not help with errors introduced by any leakage currents.

author: tooki
author_rank: Super Contributor
timestamp: September 11, 2017, 03:27:23 pm
content: FWIW, I would just use a device designed precisely for this purpose, like the INA219 or INA226 power monitor ICs. You can get them mounted on a breakout board for a few bucks on eBay. There are arduino libraries for them, so they're super easy to use. They're also amazingly accurate --in my tests, staying within a few counts of a 6.5 digit DMM.

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 11, 2017, 05:23:26 pm
content: Quote from: anvoice on September 10, 2017, 10:34:17 pmToooo big resistor latter.read at mega adc port spec,need lower resistance below 10k.put 4k7 .regards pierreEnvoyé de mon iPad en utilisant Tapatalk

author: anvoice
author_rank: Frequent Contributor
timestamp: September 12, 2017, 12:09:03 am
content: Quote from: tooki on September 11, 2017, 03:27:23 pmThanks, I'm still learning so I don't know about all the IC choices out there! I'll definitely look into that.Quote from: perieanuo on September 11, 2017, 05:23:26 pmYep I know that, but the capacitor is supposed to be a "trick" to circumvent that restriction, hence my question.

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 12, 2017, 07:56:56 am
content: QuoteI allready tried that, in fact that's the error source.I'm also ,ot talking theory, I made amp/voltmeter with an arduino pro mini in my variable DC power supply with some 1.3" oled SH1106, works ok.Of course I have capacitors on the source output, both filtering and RF reject and diodeSo I think the only mistake is resistors value.the rest is discussion, just try and post results.regards,pierre

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2017, 09:53:14 pm
content: Quote from: Yansi on September 10, 2017, 11:10:09 pmThat's a good idea. Another option is a BJT, which will have a lower leakage current, than a MOSFET, but the on voltage will be slightly higher and current required to turn it on is greater, than a MOSFET.

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 13, 2017, 05:30:16 am
content: Mosfet rules baby!!Envoyé de mon HUAWEI NXT-L29 en utilisant Tapatalk

author: danadak
author_rank: Super Contributor
timestamp: September 13, 2017, 11:31:41 am
content: Voltage divider values tradeoff -1) Power2) Noise3) Offsets4) Precision5) AccuracyRegards, Dana.

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 13, 2017, 05:54:11 pm
content: Quote from: danadak on September 13, 2017, 11:31:41 amFor his application it's sooo easy to touch the accuracy by sw means.measure Vcc, integrate,measure I or V, correction,integrate also, use value.it's not 6 digits dmm just 10 mV precision voltage.Your observations are veery good for professional use not a simple li bat management imhoEnvoyé de mon iPad en utilisant Tapatalk