Strange getSoC results on Monitor One

Hi,

Have been trying to figure out how to get SoC from the fuel gauge on Monitor One without much success. Not even sure what I do wrong. Charging circuitry is clearly working. Charging stops and resumes depending on the battery voltage as expected, but the Soc values obtained by different means are clearly wrong.
Here is what I get by printing the values out on the same line of code:

fuelGauge.getVCell() = 3.957500 fuelGauge.getSoC() = 137.777344 System.batteryCharge() = 100.000000 power.getChargeVoltageValue() = 4112

This is one unit, the other one we are testing which runs the same firmware is at 3.79V battery voltage and is still reporting 100% SoC.

The vitals on the Particle dash indicate 100% SoC on both cases even after repeated updates.

Any hints are highly appreciated

Hi, it can sometimes get a bit confusing, since there are different ways of looking at the SoC:

1 Like

Thank you.
I have read through all the documentation you reference before posting.
This is why I have printed out and posted the SoC values obtained by different means. Neither of the 2 makes sense given the charge voltage as reported by the system and the actual battery voltage.
Also, regardless of what I do in my code (unless of course I touch the system code), I would expect to see the correct SoC value on the Particle dash.

The getSoC method of FuelGauge returns the value directly from the MAX17043 fuel gauge chip. It's a model gauge; it uses a model of how the battery should perform so it's not entirely dependent on the battery voltage, which is not linearly related to the SoC.

The System.betteryCharge() method uses getNormalizedSoc(), along with some additional logic. The other quirk is that the fuel gauge sometimes returns charge over 100%, which is confusing.

The formula attempts to compensate for this, but as a side effect it can read 100% for some time, even when the battery is discharging.

Here's the formula: