# How to measure 6S LIPO battery juice in percentage from Raspberry Pi?

I've got a Raspberry Pi and I want to use it to measure the percentage of charge which a 6S LIPO battery pack has left which I then send to a server over the internet. I assumed there would be easy ready made sensors for this, but the closest things I found were

After some more searching I found this Texas Instruments Gas Gauge and Battery Management Controller which seems to be able to read out 6 cell LiPo batteries and output the charge over I2C.

So I wonder three things:

1. Am I missing or overlooking something? Isn't there an easy way to measure the percentage of my battery pack from a Raspberry Pi? Aren't there any ready made boards with example code (preferably Python)? I suppose I'm not the first one wanting to do this..
2. If the answer to 1 is "No" I guess I need to build it myself; am I correct that the TI thing I found is something I can use to achieve what I want?
3. I'm a programmer, but an early beginner in electronics. Considering this, how hard is it to use the TI chip to achieve what I want?

Note that I don't need an exact figure. An approximation would be fine.

All tips are welcome!

• Correct measurement of remaining battery charge is an art in itself, just like it seems to be impossible to get a linear fuel tank indicator on a car. But as most things the complexity depends on the level of refinement you want. Measuring the voltage is quite easy and then use a lookup table or something to get the state of charge - but lithium curves are quite flat which means you need a good resolution or only get like 10% indications. Commented Mar 20, 2017 at 19:57
• @Arsenal - good point. I'm not after an exact number. Even an approximation would be fine. Commented Mar 20, 2017 at 20:23

This is the discharge curve for a Panasonic NCR18650B which I believe is a li-Colbalt. The Li-Po is a lithium colbalt.

Discharge is very linear especially with a lower discharge rate.

Li-Po Cutoff Voltage is 3.0V

So you have a 1.2V hysteresis from 4.2 full charge to 3.0 cutoff.

Read it with a ADC board. There are a few sub ten dollar ADC boards for the PI like this: 16 Bit ADC \$9.99

• You need to measure at least current and voltage to get any meaningful soc prediction, from the graph it shows that 3.5V@2C is about 750mAh left, and [email protected] is about 2250mAh left. Commented Feb 7, 2018 at 14:01

LiPo cell voltage drops with temperature, load resistance, State of Charge (SoC), age or condition and initial capacity. One can get a rough gauge at room temp with V at any known load with knowledge of the V @I vs SoC profile.

The most precise method is Coulomb counting with memory using current sensing.

In case you're missing some basic knowledge: Your 6S pack is going to be 25.2V fully charged and around 18V when nearly dead(4.2V - 3.0V). Your cell should have a capacity rating, probably 2-3.5 Amp-hours. Add 6S banks in parallel to add capacity.

Having said all that, no, the Raspberrypi doesn't have an on-board ADC so you cannot measure voltage. You need an ADC. If you're not set on an SOC, some arduinos do have analog input so you can easily design a circuit to scale the 25.2/18 Volts from 100%/0%.

Now, if you'd like to use the TI chip you referenced, the good news is it looks like it does support SMbus, so you could use the smbus(I2C) python library with the raspberrypi. It really depends on what stage of the project you are at in deciding to go with the TI chip. You'll definitely need some additional hardware, soldering, drivers etc to get that up and running.