Fuel gauge accuracy

I have a particle Electron connected to a 6600mA battery and charging via USB. Unfortunately, I’m having trouble getting any meaningful or accurate results from the fuel gauge.

Here are some of the issues:

  • The % never gets over 85.00% - I understand other people have seen the same.
  • The Electron is unable to power up when the voltage is below 3.7V
  • The voltage and % seem to bear very little relationship to one another.
  • The readings change wildly if the Electron is restarted e.g. before restart - 3.94V, 65% directly after restart 4.01V, 85%.

It seems like the gauge is re-calibrated each time the Electron boots up, but it never seems to get it right.

Here are some of my measurements if anyone is interested - https://docs.google.com/a/easy-ip.net/spreadsheets/d/1lFG0c2sZBJZKGdsfIVLDvRRBtltW7A7UTMN3C8kCXig/edit?usp=sharing

Here’s the code I’m using to initialise the gauge.

PMIC pmic;


void ElectronBattery::doSetup()

  if (!pmic.setChargeCurrent(0,0,1,0,0,0))
    log("Unable to set charging current to 1024mA", LOG_ERROR);    

  if (!pmic.setInputCurrentLimit(CHARGING_CURRENT_LIMIT))
    log(String::format("Unable to set charging limit to %dmA", CHARGING_CURRENT_LIMIT), LOG_ERROR);    

String ElectronBattery::doGetStatus()
  return String::format("%1.2fV, %2.3f", voltage, level) + "%";

bool ElectronBattery::doUpdate()
  String previousStatus = getStatus();

  voltage = 0.0;
  level = 0.0;

  #if (PLATFORM_ID == 10) // Electron
    voltage = fuelGauge->getVCell();
    level = fuelGauge->getSoC();

  if (getStatus() != previousStatus) 
    log(getStatus(), LOG_DEBUG2);  

    (getStatus() != previousStatus);    

Is there any way to improve the accuracy of the fuel gauge?

It’s hard to judge whether the fuel gauge is accurate or not simply by eyeballing some numbers.

There are lots going on and the relationship between li-ion voltage and SoC is not linear.

  • The max charge is set at 85% for safety. You can override this but you are responsible for any lithium battery problems. I would not set this above 90% unless you are testing in a fire-proof lab setting.
  • The minimum Vin on the Electron datasheet is 3.9V so that is operating as specified.
  • Voltage and charge do not related well in lithium batteries. The fuel gauge is counting charge (coulombs) applied to the battery.
  • I do believe that the fuel gauge re-calibrates on restart and makes an assumption about the charge of the batttery.

The fuel gage is not counting current, it’s strictly voltage based.

1 Like

I will admit to trying to simplify things a bit. The charging IC has trickle, pre-charge, constant current (fast charge), and constant voltage charging modes. See Figure 11 in the datasheet.

When the constant current phase ends and the device enters the constant voltage phase, it is hard to know what the actual state of charge is. The reliable indicator is the charging current at that point since the voltage will be constant.

Most LiPo charge states can be semi-accurately measure by simply looking at the voltage of the battery since it’s very linear as it goes from 100% full to 0% empty.

This is why a lot of simple LIPo fuel gauges are Voltage based only. TI makes some that take current in and out and cell impedance into account for the ultimate accuracy but they are more complicated and expensive solutions.

The Fuel Gauge needs time for the battery voltage to settle down to be close to accurate. A good method would be a full charge and discharge to get a new battery SOC on track.

The Fuel gauge quick start code just makes the fuel gauge guess what the current SOC is when it’s first powered on after having no power. Normally the fuel gauge stays powered on even during some sleep modes to prevent the SOC from fluctuating all over the place after it wakes up from sleep.

The PMIC chip handles charging and current limitations set via firmware, it does measure current but it has no relationship or communication with the fuel gauge.

We do know when the RED charging LED goes out when your charging that the charging current has dropped below 50mA which basically means the preset charging voltage has been reached and the incoming current has dropped below 50mA so the battery is essentially at that voltage with very little charging current.

I have tried to raise the charging voltage but I still did not get the fuel gauge to hit 100% full. The charging LED started acting weird also so I just went back to the default charging settings. I did increase the charging current though.

The battery that comes with the Electron has an attached battery protection PCB that protects the battery from Over Discharge, Over Charge, and short circuit conditions by its self. So even if you tried to overcharge the battery the protection PCB on the battery would stop the incoming power source to prevent overcharging the battery.

If the battery reading 85% when full drives you crazy you can use the map() function to scale the 0-85% to 0-100% charge. I did just that and it works just fine.

1 Like

Where did you get that graph? It is very useful and seems to relate well to one of my electrons. Is it specific to particle batteries or LiPo in general. From the particle electron FuelGage I am getting 4.08v and SOC of ~69% on one unit and 4.05v and ~85% on a different unit. This makes it difficult to use your approach for sleeping when charge gets low that you have posted elsewhere.
I think I will just use the voltage and calculate percent charge myself from from your graph. What do you think?
thanks, john

It’s a standard 3.7v LiPo discharge graph I found when searching Google.

The only time you should see this SOC variance is on the top end of the voltage scale. The SOC readings as the battery voltage falls should be pretty accurate on all your Electrons, and thus the code I shared will work just fine for going into sleep mode when the SOC get’s low.

You can scale your battery readings which should usually always reach 80+% full when fully charged.

So scale 0-85% SoC to 0-100% SOC readings and limit the SOC reading from going over 100. This will allow you to see a full 0-100% SoC range you’re used to seeing on all your other devices.

@bko @RWB
I have a 3 cell 6600mAh lipo . Can the fuel gauge on the Electron accurately measure the charge stored in a multi-cell lipo directly connected to the on-board JST connector ? Or does the lipo have to be connected (via an adapter) to the micro-USB port??
Also, can the Electron charge a multi-cell lipo to it’s max/safe capacity (connected directly to the on-board JST)?

The PMIC is for measuring and charging single 3.7vcell LiPo & LiIon cells.

It can measure capacity on multiple cells if they are in parallel.

The battery input will not accept more than a single 3.7v cells voltage range, so series battery packs with higher voltages are not an option.

The battery SOC only works on battery packs connected to the JST or Li+ pins on the Electron. Batteries that you want to use and charge do not connect via the USB port.

The PMIC will charge a multi-cell parallel battery pack back to 4-4.2v.