2
\$\begingroup\$

How do I read the internal reference voltages of the Arduino (Ardino Mega, ATmega2560, specifically the 2.56v reference) with respect to the input voltage?

I'm trying to measure the remaining battery capacity of a device through a voltage divider. The Vcc going into the Arduino is also hooked up to the battery and thus varies as well. I've measured the internal 2.56v reference so I know approximately what it should be regardless of the varying Vcc voltage but I can't find any simple documentation on exactly how to measure that particular internal reference voltage with respect to the Vcc.

\$\endgroup\$
1

1 Answer 1

3
\$\begingroup\$

You're trying to measure the battery voltage, but you need a stable reference point. This is precisely what you use the internal reference for.

Let's assume that your battery pack is a LiPo pack and has a nominal voltage of 3.7V and you want to shut things down when you get to 3.1V.

Now, the internal reference you have is 2.56V, so even at the cutoff point, 3.1V is too high. Let's chop this in half with the voltage divider you already have.

Now, the nominal voltage you'll see through the divider is 1.85V. Perfect! You can now use your internal reference for your ADC readings. In this case, 1.85V is what you'll see at the ADC for a battery voltage of 3.7V and 1.55V at the ADC is your cut off of 3.1V.

\$\endgroup\$
3
  • \$\begingroup\$ What you are saying is probably correct but it means I will have to change the voltage divider which i don't want to do (already soldered on multiple boards)...but its probably the best solution compared to fiddling around and trying to compensate for an unreliable Vcc as a reference voltage. \$\endgroup\$
    – Faken
    Commented Sep 20, 2012 at 12:39
  • \$\begingroup\$ Yeah - fair enough. That 1.1V reference trick seems interesting too to avoid needing external circuitry. \$\endgroup\$ Commented Sep 20, 2012 at 15:23
  • \$\begingroup\$ It does, but there are drawbacks. 10% accuracy, for one, limited range for another, and the possibility that it is different for every unique Nano. Here is an article that describes some of the challenges to getting a truly accurate reading by measuring it against the Vcc as per the OP: provideyourown.com/2012/… \$\endgroup\$
    – SDsolar
    Commented Jul 20, 2017 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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