lipo monitor

I have a 4 cell lipo that I want to monitor with the Arduino Duemilanove.

I'am a Arduino noob, but I managed to monitor one cell. This is how I did that...

I used 2x 10K resistors, didn't know how it supose to work, so I just tried. This way I could read 3.71v on the serial. I first tried to use only one 10K resistor, it worked, but the power led on the arduino started to burn, even when it wasn't connected to USB, so I gues the arduino is using it as a power supply somehow. With the extra resistor it didn't. But even with the resistor it is using power. And I gues I need a 4pin on/off switch to turn on and off both the - of the dean plug power cable of the lipo, but also the - on the recharge plug to prevent power loss on storage.

And I used this code...

But I want to monitor all 4 cells at the same time, so I first tried to read the second cell, and arduino displayed 4.94v! I tested it with my multimeter, and it was 7.54v. So it's was in serie, and the next cell and the next were also in serie. This makes it verry hard for me to simply monitor all cells.

I read about voltage dividers, but I gues I need a different divider for every cell :o

My plan was to display all cells on a lcd display. And calculate the total voltage by counting all cells together. But this plan isn't going to work I gues.

Can someone help me with monitoring all 4 cells? And help me with a circuit drawing? I don't know how exactly use a voltage divider, and what code I need for that. Remember, I'am a noob, so every advise must be in noob language.

With that wiring you may be on track to burn up your arduino. The wire between the resistors should go to the arduino analog input and not the batterys. If you put more than 5v into the analog input, you may damage/kill the arduino.

Bottom line is that if you are going to measure a voltage 5v or less, you just need to connect the battery/arduino grounds together and the batt+ to the arduino analog input. No voltage divider needed. If you want to measure a voltage greater than 5v, you need a voltage divider to limit the arduino input voltage to 5v or less. In the below diagram, the Vin would be connected to the battery + when the battery voltage is greater than 5v, the Vout to the adruino analog input pin, and the ground would be connected to both the battery ground and the arduino ground. The resistors would need to be sized such that the max voltage on Vout is 5v or less. A simple trimmer pot from Radio Shack would be a good replacement for the resistors so the bridge resistances can be simply adjusted as needed.

http://en.wikipedia.org/wiki/File:Impedance_Voltage_divider.png

Because at first I tought I could read 4x 0-5v. But because every cell you read adds up. So to see each cell voltage I need to calculate it. For example, cell 1= 3.7v, it reads 3.7v, easy. cell 2 may read 7.4v. So the scripting must subtract cell1 from the reading of cell2 to show cell 2 voltage. Cell 3 may read 11.1v, and need to subtract cell 1 and 2 to get cell 3 voltage. And cell 4 may read 14.8v, subtract all other cells to get cell 4 voltage.

But to make ik easy. I need to use one type of voltage divider that can detect up to 17v. So it can handle the reading of cell 4. But that cost me accuracy because cell 1 only read 3-4v. So if I want more accuracy I need 4 different voltage dividers that need different code. It's more complicated. And even more complicated to make ranges like, cell 1 2.5-4.5v, cell 2 6-13v.... Thats the most accurate, but I have no idea to do that. It's good enough to make 4 different voltage dividers. But that way, cell 4 will be less accurate than cell 1 reading because of it's higher voltage.

The lipo also powers the arduino from Vin and Gnd. So the Gnd are always attached, but the test I did was with a 12v battery, so I needed to connect "-" somehow, without it the reading was all over the place.

If I understand correctly, it should look like this...

I just tested it, I get a reading of 1.88v on cell1, thats not correct, why? It seems I divided the voltage by a factor of two. Is my circuit correct, but do I need different resistors to not divide it? My previous circuit did work, but not correctly? For cell 1, I don't need a voltage divider, it's never going over 5v. But can I just plugin the "+" of that cell right into the analog-in? Did not dare to try it without resistor.

For cell 1, I don't need a voltage divider, it's never going over 5v. But can I just plugin the "+" of that cell right into the analog-in? Did not dare to try it without resistor.

Yes, cell one's terminal will only go as high as 4.2vdc (at max charged cell voltage) so it can wire directly to a analog input pin as it will 'fit' in the standard 0-5vdc range of the processor chip, no voltage divider required.

Keep in mind that you will have other 'calibration' issues to deal with. The standard Arduino A/D setup is using the board's +5vdc Vcc as the measurement reference. This +5vdc voltage will be slightly different when changing from external voltage to USB voltage. So make sure you 'calibrate' you program using the power source you will normally be using.

For measureing the other three cells you will need three voltage dividers. 20 turn trimmer pots (10k ohms or higher) can make decent voltage dividers that can be adjusted to give the ratio you wish. You will have quite the time getting all the calibration set-up correct for each of the three multi-cell taps to scale correctly and then the subraction factor to obtain individual cell values, but you seem to have a good understanding of what is required.

http://www.allelectronics.com/make-a-store/item/MTPS-10K/10K-MULTITURN-TRIMMER-POT//1.html

Good luck Lefty

If you only need a couple of pots, Radio Shack has some (more expensive, but no handling/shipping charges).

http://www.radioshack.com/family/index.jsp?categoryId=2032275&s=null

thanks for allot of helpfull information.

For 1 cell, I don't need a single resistor? Do I not need to limit the current on the analog in?

The the other three, I want to make a building kit of my project, it would be nice to use resistors instead of pots. With the voltagedivider calculator I can clearly see wich E resistors get what voltage, so it will still be accurate. I will test some after I get my imax b6 charger.

I must say, lipo's are hard to work with because for there variable voltage. I'am going to power some high power leds. They are rated at a voltage drop of 3.6-4.0v, max 2800mA. But the 4 cell lipo can be around 16.8v - 14v. When I calculate at 16.8v the leds are at full power, but when it drops to 14.8v, 30% less. I first going to need to test whats there max voltage after being charged, and with a load of 6A. I hope it won't be so high. Because lipo's seem to have a high peak for a short time of 4.2v, but lowers verry fast to 3.9v. But I don't think it's good to let my leds get a to high current for that small peak, but it's a waste to calculate on the peak.

I know, why use resistors, because I can't get a switching power supply that can transfer 16v to 11.5v at 6-7A. I must accept the waste of energy by the resistors. But it's hard to calculate it.

You may want to look for various UBECs like below that come in various ranges of input voltages and current capacitys.

http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=6233

For 1 cell, I don't need a single resistor? Do I not need to limit the current on the analog in?

No you do not need a single resistor for that case. An Arduino analog input pin has a very very high input resistance (called input impedance) and only draws a few micro-amps of current. You can think of it as self limiting as far as current draw. The only thing you have to be careful about with analog input pins is the the voltage does not exceed the devices Vcc +.5 vdc or more negative voltage then -.5vdc, above or below these levels internal clamping protection diodes start to conduct heavy current and can damage the chip very quickly.

Lefty

For example, are all those "+" wires from the battery from cells in parallel, or from cells in series?

All Li-po single cells have a 4.2vdc max cell voltage. There is a labeling convention used for mult-cell Li-po battery packs that define the pack's configuration. The OPs example would be labeled 4S1P to define a single four series string of cells generating a max 16.8 volt pack terminal voltage. A 3S2P pack would define two, three cell series in parallel.

The pack manufacture much select very closely 'matched cells" when assembling these packs or over time some cells can be come overdischarged or overcharged if their state of charge changes relative to the other cells. Li-Po cells are very intolerent of being over charged or discharged and cell damage or even fire is possible if not carefully dealt with. The better multi-cell packs will have a 'balance' connector in addition to the main power wires so that higher end 'balancing' chargers can ensure that the pack maintains cell balance over time.

The main power wires on the pack are just two wires (+&-) of a gauge suitable for the current ratings of the cells. The connector that the OP drew for us is an optional 'balance monitoring connector' for multi-cell packs that is used for measuring the individual cell's voltage during charging or discharging to ensure the cells are properly balanced. Not all Li-Po packs include this 'balancing connector'. The - terminal is wired to the common pack ground, and each of the + terminals is wired to a series junction point between each of the series cell, of course the first + terminal is wired to the pack's total positive terminal.

Some high end chargers can actually shunt current around higher voltage cells during the end of charge to allow all the cells to reach the same end of charge voltage and therefore maintain the pack's overall balance.

Lefty

We are just guessing, absent any actual details from the OP.

Well his first sentence of his original posting said:

I have a 4 cell lipo that I want to monitor with the Arduino Duemilanove.

That plus the drawing made it clear to me anyway. ;)

Lefty

thanks for the explanation retrolefty.

I do have a 4s1p lipo. Two main power lines, and one balancing plug that I use to monitor it's voltage.

I'am going for three different voltagedividers, and cell 1 without one because it's under 5v. I will calculate the other three, and make the subtractions needed to view individual cells voltage.

Does someone know how long a 4000mAh with a current draw of 6A will keep between 4-4.2v cell voltage range? It's posible I let the leds go over there max rating for a short period of time during this peak. It depents how long the peak last.

Voltage divider calculated...

Cell 1 no divider Cell 2 Range 9.16v 10.000 + 12000 Ohm resistors cell 3 Range 13.62v 10.000 + 5800 Ohm resistors cell 4 Range 17.82v 10.000 + 3900 Ohm resistors

I tested a voltage divider with a 10.000 + 3600 Ohm I had laying around. And tested the 4 cell wires. It worked. My range with a 3600 Ohm was 18.88v, so I changed the code, map 0-1023 to 0-1888.

But I notice that the readings are not that stable. 95% of the readings are stable, but sometimes it spikes a little for a reading of 1-4 at 25ms delay. I don't know why, maybe the arduino power supply? But do someone know what simple code can read only the stable reading? As long as the result is 90-95% of the same readings it's fine, he needs to ditch the 5-10% of the different readings.

I just want a less pending reading.

Does someone know how long a 4000mAh with a current draw of 6A will keep between 4-4.2v cell voltage range?

About 40 mins, however the voltage will not stay in the 4-4,2volt range when using Li-po cells. Li-po cells (like lead acid cells) have a pretty linear discharge curve and the cell voltage will gradually decrease as the cell discharges. Most recommend to stop discharging the cell when it reaches 3.5volts or so, but I think 3.0 in the recommended cut-off from most manufactures. Discharging to below 3.0v can damage the cell.

It’s posible I let the leds go over there max rating for a short period of time during this peak. It depents how long the peak last.

Not sure what you are stating or asking here?

As far as getting occasional jumping values from your analogRead inputs, it does happen. The easiest solution is to take multiple readings, add them all up and then divide by the number of readings taken. That acts like a filter and will give a better representation of your actual cell voltages. 8 reading should be enough to filter the values.

Lefty

I now try to make my 12v 0,12A 1,44Watt fan to work on 15v. I need a resistor. I used a potentiometer and I find I need a 39 Ohm resistor to make this fan work on 12v with a 15v power supply. But the resistor gets verry hot (1/2 watt resistor). I want to know how much watt this resistor is disipating so I can shoose a proper resistor. I have a hard time calculating that, can someone show me how to do that? And what resistor do I need if I decide to use one resistor for 3 the same fans?

12v @ 120 ma (or .120a) would run fine but a tad faster at 15v and at slightly higher current (maybe .140/.150 ma) - but you use a 39 ohm resistor to drop the voltage approx 3v (roughly it works out to be about 6.5v drop per 100 ohms for off hand calculations)...

The 39 ohm resistor your using is in essence shunting about 3v worth of the load so assuming 120ma load that's going to be .36w or just about 1/3w... I would go 2x minimum for resistors so shift up to a 1% 1w or 2w for safety...

I may have this wrong but...

FYI - I am doing a very similar project using 1% resistor divider network and providing a calibration utility for use with a high precision voltmeter - it seems fine in 3S test mode.

I have also worked with Atmega1280 and using the 3 available TTL serial ports to monitor and aquire log output from 3x CellLog8 devices (tapped them pre-TTL->USB chip) which gives me up to 8S per channel and still leaves the TTL->USB output to go to real time PC logging... the beauty is I can split the input parameters and quickly evaluate cell voltages to detect both High Voltage and Low Voltage Condition...

The application for both is an ebike LiPo BMS (actually 18-24S3P 15AH) and eventually it will trigger a shunt board durring charging to keep each cell balanced at maximum charge..

One other feature will be a reduced power mode where the throttle input (hall sensor based so 0-4.7v) will be sampled by the Mega and Output back to the controller... if LVC is tripped (can be multiple stages) throttle will be limited to a maximum preset amount - thus limiting current and maintaining cell at LVC to get a bit more low power out of it for limp mode but without risk of damage to the Lipo cells.

How accurate did your voltage divider circuits come out for the 4v range?

Why are you not just using an LM317 linear to supply a constant 5v from the full 6S pack input... with 17v maximum voltage input and theoretical minimum of 12v (actual minimum of less with undervoltage cells) but if a pack is above 0v (good internal connections) then you should have no issues powering the whole thing via pack (cell 1 gnd to cell 6 positive and the draw will be minescule at best if your output is to be 5v @ say 50-100ma?

Hope it helps!

-Mike