Go Down

Topic: Low Battery Monitoring for LiPo (Read 9769 times) previous topic - next topic

drbogger

I want to connect a LiPo Battery to a Analog Input on the Arduino, but I'm not sure if I should connect through a resistor or not?

LiPo --> Analog Input
OR
Lipo --> Resistor --> Analog Input

What would all you guys recommend?
What are the Pros and Cons?

sdturner

If you are talking about less than 5V you can connect it directly, but I recommend using a series resistor and it's not a bad idea to add a capacitor for some filtering. Any resistor from a few K Ohms up to 100K should be good.

E40racer

What voltage is your Lipo? I use a 2 cell 7,4V Lipo for my Rover/robot, I monitor the battery voltage with a voltage divider consisting of 2 10K resistors.
www.bajdi.com

drbogger

My LiPo Battery is 3.7v.

And if I add a resistor to it, what calculation would I use to code it to detect the voltage?
And what size filtering cap? 0.1uF?

fkeel

3.7 is well inside the acceptable range for the analog inputs.

1024 should be 5v and 0 should be 0v - do the math :-)

You don't need to add a resistor, though it cant harm either.
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

drbogger

So I shouldn't add a resistor? or?
What about a filtering cap?

fkeel

if you are just interested in reading the voltage, you can go ahead and do it (make sure you have common ground) without shorting anything out.

however, if you plan on having it hooked up continuously, you probably want to add a resistor to limit current draw.

Maybe someone with more knowledge wants to chime in? I am not exactly sure how it actually works. just speaking from experience.
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

drbogger

It's going to be hooked up permanently, cuz its monitoring its own battery to enter a low power mode as the battery gets low.

So... Yeah...  Can anyone share some knowledge with me?

Thanks all for your help! :)

fkeel

well just throw in a resistor. the higher the value, the less current the arduino will draw for monitoring. I dont know how much the arduino would draw without the resistor. I believe its not much. Get out a multimeter and check if you want to know the exact numbers :-)
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

PeterH


well just throw in a resistor. the higher the value, the less current the arduino will draw for monitoring. I dont know how much the arduino would draw without the resistor. I believe its not much. Get out a multimeter and check if you want to know the exact numbers :-)


Are you proposing to add a series resister to reduce the current drawn through the Aduino's ADC? What would that achieve - it's a high impedance input, isn't it?

The only use I can see for a resister would be as a pair forming a voltage divider to bring a higher voltage into a range the Arduino can measure. The downside of that would be a continuous current leak through the voltage divider - bit of an own goal if you're monitoring the Arduino's own battery.

drbogger

So would you recommend hooking it up without any resistors or capacitors?

drbogger

So if I hook it up directly with no components, It should be fine for long-term use, right?

SirNickity

I might consider the series resistor (use 10K -- or whatever you'd like, but 10K is a fine value) just to prevent catastrophe in the event that something bad happens at the analog input.  For instance, if it somehow mistakenly gets turned into an output set to LOW, you would have a short to ground.  The resistor would limit this to merely a vampiric waste of power.  Although, it would do nothing for protection if that input ever turns into a HIGH output.  A diode would solve that, but then introduce a voltage drop that you'll have to account for.

A series resistor alone shouldn't influence the measured voltage too greatly.  It's not designed as a voltage divider, just limiting current flow.  A cap in parallel with the battery (maybe 1-47uF?), as close as possible to the analog input, would help smooth out results in the case where you measure the voltage while something else is making sudden high-current demands.  Again, a diode between the battery and the input (before the cap) would ensure those sudden loads can't drain the cap.

In all seriousness, you might just want to consider a dedicated battery monitoring IC.  DIY is great and all, but Lithium-based batteries are not as tolerant as other chemistries.  There's plenty of opportunity to make a really big mess.

sdturner

One thing I neglected in my original response was that I assumed you are using a 5V Arduino. If you are using a 3.3V board then don't connect a 3.7V battery directly.

Assuming a 5V Arduino: Connect Battery - to the GND on the board. Connect Battery + to one end of a 10K resistor and the other end of the resistor to the analog input pin. It doesn't have to be 10K, it can be just about anything from a few hundred ohms to a few hundred K ohms. Use the following formula in your code:

Voltage = 5 * Counts / 1023

If you have a 3.3V Arduino then you need to use a voltage divider to reduce the voltage at the ADC http://en.wikipedia.org/wiki/Voltage_divider. Connect Battery - to GND on the board and Battery + to 2 resistors in series. The end of the 2 resistors is connected to GND and the middle point is connected to your analog input pin. You want the resistors to be as large as possible because they are going to drain current from the battery. Using two 10K resistors and 3.7V they will draw 185 uA continuously. Depending on the capacity of your battery that could be significant. I recommend resistors between 100K and 500K range. You can calculate what the voltage is at the mid-point using the first formula and the value when you read the analog pin is calculated with the second formula. R1 is assumed to be the resistor between Batt + and the Analog Input and R2 is between the Analog Input and GND:

Voltage(at the pin) = VBatt * R2 / (R1 + R2)
     and
ADC Counts = VPin * 1023 / 3.3  <== Replace 3.3 with 5.0 if using 5V system

From those two equations we get the following formula which can be used by your software:

VBatt = (Counts * 3.3 / 1023) * (R1 + R2) / R2     <== Replace 3.3 with 5.0 if using a 5V system

Based on what I've read you probably shouldn't worry about a capacitor. If you have a lot of noise in your system, then adding a capacitor across R2 (from Analog pin to GND) will filter out some of the noise. The formulas for the filter are a little more complicated, so I suggest a 1uF capacitor. If it is still noisy, try 10uF or ask again, telling us your resistor values and how much noise you are getting.

drbogger

Quote

One thing I neglected in my original response was that I assumed you are using a 5V Arduino. If you are using a 3.3V board then don't connect a 3.7V battery directly.


1. I am using 5V Arduino... The power is going through a boost converter.

Quote

Assuming a 5V Arduino: Connect Battery - to the GND on the board. Connect Battery + to one end of a 10K resistor and the other end of the resistor to the analog input pin. It doesn't have to be 10K, it can be just about anything from a few hundred ohms to a few hundred K ohms. Use the following formula in your code:

Voltage = 5 * Counts / 1023


1. When you say Counts, you mean the reading returned by the Arduino, right?
1. If I use a 10k Resistor, will there be a voltage drop I have to take into account?
3. I am also using a external AREF connected directly to the 5v supply line, will I have to change any calculations due to this?

Quote

Voltage(at the pin) = VBatt * R2 / (R1 + R2)
     and
ADC Counts = VPin * 1023 / 3.3  <== Replace 3.3 with 5.0 if using 5V system

From those two equations we get the following formula which can be used by your software:

VBatt = (Counts * 3.3 / 1023) * (R1 + R2) / R2     <== Replace 3.3 with 5.0 if using a 5V system


1. Which calculation should I use for 5v Arduino with battery connected to a series 10k Resistor?

Quote

Based on what I've read you probably shouldn't worry about a capacitor. If you have a lot of noise in your system, then adding a capacitor across R2 (from Analog pin to GND) will filter out some of the noise. The formulas for the filter are a little more complicated, so I suggest a 1uF capacitor. If it is still noisy, try 10uF or ask again, telling us your resistor values and how much noise you are getting.


1. I do have a 40mm cooling fan and a 5v servo connected to the system, so would you still recommend the 1uF filtering cap?

Go Up