I want to measure the battery voltage on my arduino pro mini (3.3V version), which runs from a Li-ion smartphone battery (max 4.2V).

I used the typical voltage divider setup with R1 = 5.6M and R2 = 2M, because of this formula:

// ((R1+R2)/R2)*1.1 = Vmax = 4.2 Volts // 4.2/1023 = Volts per bit = 0.004105572 float batteryV = sensorValue * 0.004105572; int batteryPcnt = sensorValue / 10;

But it doesn't seem to work.. currently it is giving me a voltage of 1.28V, but my multimeter is measuring 3.86V.

What am I doing wrong?

  • \$\begingroup\$ Start with smallest value not over 100k and see how it works. ADC bias current and input offset current flowing in equivalent input resistance of the divider want to produce a voltage rather less than 1 LSB of the ADC. Look up the current values, calculate the voltage of 1 LSB. Go... \$\endgroup\$ – Russell McMahon Apr 8 '16 at 15:09
  • \$\begingroup\$ It's all about reading the small (but very important) print in the data sheet \$\endgroup\$ – Andy aka Apr 8 '16 at 15:12

Well, apparently the input impedance of the Arduino ADC is much lower than you thought. You need to make the resistors of the divider one or two orders of magnitude smaller.

| improve this answer | |
  • \$\begingroup\$ Thanks for the answer. What would be good values for both resistors? I need the voltage measurement to be as accurate as possible \$\endgroup\$ – Henry Apr 8 '16 at 14:40
  • \$\begingroup\$ Not an easy question to answer without knowing the ADC input impedance. You want your resistors to be as small as possible for best accuracy, and as high as possible so not to drain the battery (but not so high as to not behave as a real divider). The best compromise is up to you. If you have no data... experiment, with care. \$\endgroup\$ – Claudio Avi Chami Apr 8 '16 at 14:40
  • \$\begingroup\$ @Henry Here's a post about voltage divider and ADC input impedance. (This and this may be of interest too.) \$\endgroup\$ – Nick Alexeev Apr 9 '16 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.