Go Down

Topic: Possible to measure 12.6v battery with arduino input? (Read 1 time) previous topic - next topic

lpbug

So I have a 3s 800mAh that I would like to use to power my arduino uno, but at the same time I would like to use one of the analog pins to monitor the voltage. Is this possible? Also, I know the maximum current the arduino input can handle is 40 mA and I'm scared that hooking it up will fry my board. Is there a way I can calculate how much current will flow through if I connect a fully powered lipo at 12.6V to my Uno (would Ohm's law be the right track? If there is a resistance value for the Arduino's input?).

Thanks in advance for all the help.

runaway_pancake

#1
Jun 02, 2013, 12:51 am Last Edit: Jun 02, 2013, 12:55 am by Runaway Pancake Reason: 1
With the attached circuit, the voltage at "A0" will be one-third of the battery voltage.

> > > Analog input must not be greater than A-ref (and must not be greater than 5V)
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

zoomkat

You might consider using a pot in a variable voltage divider configuration.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

borref


So I have a 3s 800mAh that I would like to use to power my arduino uno, but at the same time I would like to use one of the analog pins to monitor the voltage. Is this possible? Also, I know the maximum current the arduino input can handle is 40 mA and I'm scared that hooking it up will fry my board. Is there a way I can calculate how much current will flow through if I connect a fully powered lipo at 12.6V to my Uno (would Ohm's law be the right track? If there is a resistance value for the Arduino's input?).

Thanks in advance for all the help.

The analog input resistance is very high (about 100M Ohm) and so current flowing into the input pin is insignificant. The problem however is that when voltage exceeds about 5.3V, a protective diode opens and will connect your input directly (zero Ohm) to 5V. This will more than likely damage your Arduino microcontroller when connected to a 12.6V battery and so you must avoid this.

A common solution is to use a voltage divider. Two resistors in series from battery plus to ground are used to drop the center point voltage to within the 5V range.

Another solution is to use a zener diode (use 8.2V for a 3S lipo) connected from battery plus to a 1k resistor to ground. This will drop the center point voltage to about 4.4V for a fully charged battery and give a better dynamic range than is possible with a resistor/resistor divider.

Avoid using a pot as a voltage divider (other than for lab testing). The wiper on these devices typically rely on mechanical contact and are susceptible to failure.

lpbug

Thanks for the tips everyone- would the voltage divider be wasteful in terms of energy lost in the resistor? Perhaps I can read it every 30 seconds or minute?

PeterH


would the voltage divider be wasteful in terms of energy lost in the resistor?


You would size the resistors so that the current drawn is small enough to be ignored.

Go Up