# State of Charge Values

Hi

I have an electron which on the console says that the battery charge is 96%

If my code I have

``````int batteryLife = fuel.getSoC();
Particle.publish("SOC", String(batteryLife));
``````

This publishes a value around 80 when the battery of the console is 96%. The 96% sounds right because it is on power.

Are we using the wrong function?

From the FuelGauge reference documentation:
`Note that in most cases, "fully charged" state (red charging LED goes off) will result in a SoC of 80%, not 100%.`

How is the 96% battery on the vitals in the console determined?

You got me there. Maybe theyâ€™re using raw voltage levels or something.

Device vitals represent scaled up SoC levels.

3 Likes

From what I can tell, the scaling factor is 85% - i.e. if SoC shows 85, then console displays 100%. At least that math works on the devices Iâ€™ve looked at. The charge controller is set to a safe level so as not to overcharge the battery.

I believe the Device Vitals assume that the default Li-Po termination voltage of 4.112 V is used.
The Fuel Gauge reports the actual SOC depending on the voltage when sampled.

Hereâ€™s an example for a Boron being recharged by a small Solar Panel this morning.
The Boronâ€™s PMIC setting `setChargeVoltage(4208)` is used, instead of the 4.112 V (default).
Note: be sure to monitor the enclosure temperature when charging to 4.208 V.

Fuel Gauge reports 92% SOC @ 4.14V. This is the actual condition, regardless of the charge termination voltage.

Device Vitals reports 100% SOC (since itâ€™s higher than 4.112V default), but it also shows as â€śChargingâ€ť since thatâ€™s indeed whatâ€™s happening to reach the 4.208 charge Voltage.

The Fuel Gauge will give you the best answer. Itâ€™s the percentage remaining of the Li-Poâ€™s actual capacity.
Thatâ€™s why Fuel Gauge reports ~85â€™ish % when â€śfullyâ€ť charged to the 4.112 V (default), because the Li-Po isnâ€™t actually â€śfullâ€ťâ€¦for safety reasons.

3 Likes