I want to monitor the voltage from a lipo battery pack.
How would I wore the + and - from the battery pack into the Arduino?
- to analog and - to ground?
I want to monitor the voltage from a lipo battery pack.
How would I wore the + and - from the battery pack into the Arduino?
- to analog and - to ground?
Yes. But, do not exceed Vcc (5V) on the analog input (or any input pin).
If your battery is greater than 5V, use a [u]Voltage Divider[/u] (2 resistors). In most applications a total resistance of 10K - 100K is good. (The lower the resistance, the more current flows through the voltage divider and it adds to battery drain.)
Check the [u]Read Analog Voltage Example[/u]. If you use a voltage divider, you'll need to adjust the ratio between the ADC reading and the voltage.
So I would put 2 resistors in series between the + terminal of the battery pack and the Analog pin?
Here's an example. Suppose you had a 12 v. battery voltage. The arduino can't accept voltages higher than 5 v. So pick two resistors, R1 and R2, and wire them in series. They complete a circuit between 12 v. and ground. If R1 is the one at the 12 v. end of the pair, then you need to have 12*R2/(R1 + R2) = 5 (or less than 5); So pick the top resistor R1, let's say, to be 8900 ohms: if you want to use a standard value for the lower resistor, use 3300 ohms, and then the voltage at the center of the divider is 4.45 v. for a 12 v. battery.
Now how do you read it in? on an analog pin you'll get an integer value, call it data.
Then your conversion is volts = float(data)/1023.0*5.v, but that's rerefenced to the 5 v.power supply voltage, assuming you're using a 5 v. Uno with DEFAULT analog reference. To adjust it for the 12 volts, you need to multiply that value by 12.0/4.45.
Marciokoko:
So I would put 2 resistors in series between the + terminal of the battery pack and the Analog pin?
Did you actually look at the links supplied? It does not appear to be so.
Weedpharma
Yes I did weedpharma. They show 2 resistors between the + and - terminals. The issue is, I have a + and - terminal from my battery but I also have to connect it to my arduino. That is where my confusion lies. Vout in the divider would be my out to my analog pin?
Marciokoko:
Yes I did weedpharma. They show 2 resistors between the + and - terminals. The issue is, I have a + and - terminal from my battery but I also have to connect it to my arduino. That is where my confusion lies. Vout in the divider would be my out to my analog pin?
And -battery to Arduino ground.
A 2-resistor voltage divider chops the battery voltage in two.
Part of the battery voltage is across each resistor.
How much across each resistor depends on the resistor ratio.
You use the voltage across the lower resistor, so -batt (ground) and tap (analogue in).
A voltage divider is only needed when the battery voltage is higher than Arduino can handle (5volt on a 5volt Arduino).
A single cell LiPo (~3.7volt) can be measured directly.
A bit of caution there...
Wise to use a 10k resistor between battery+ and pin.
That protects the pin if you're doing something wrong, like forgetiong to turn the Arduino on first.
You may have heard of "phantom powering".
Leo..
Thanks wawa. So like this:
And no, I haven't heard of Phantom powering. I've heard of Phantom loads though.
When your Arduino is off.
And you connect a voltage to a pin.
It tries to power the Arduino through the pin protection diodes.
Leo..