Battery dropping from 40% to 0 in a few minutes

When this happened before on my L5, I suspected a faulty battery, so I swapped it to my spare battery. Yesterday, this happened again.

Below is the battery stats from upower -d
Does it show any signs that the battery is going bad?

Device: /org/freedesktop/UPower/devices/battery_max170xx_battery
  native-path:          max170xx_battery
  power supply:         yes
  updated:              tor 19 jan 2023 17:23:03 (98 seconds ago)
  has history:          yes
  has statistics:       yes
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              17,2918 Wh
    energy-empty:        0 Wh
    energy-full:         21,8746 Wh
    energy-full-design:  13,8572 Wh
    energy-rate:         0,581506 W
    voltage:             3,83937 V
    time to empty:       29,7 hours
    percentage:          79%
    temperature:         45,5 degrees C
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (rate):
    1674145383	0,582	discharging

I don’t have a L5 and I am definitely not a battery expert, but “energy-full” being nearly twice the “energy-full-design” capacity is very strange. Normally that number would be lower than the design number as the battery wears. It seems like it thinks the battery is nearly twice as big as it actually is?

1 Like

That would explain it being empty at nearly half “capacity.”

1 Like

Those two values should be the same (I think, or at least very, very close in their values), therefore please take out your Librem 5 battery during charging of it (you’ll see there 0%), and reinsert it again. Please charge reinserted battery until red LED light goes off (this should help there as well).

1 Like

I’ve had this happen to me once before. When I asked about this in the Purism community/general Matrix room, I was told that the battery calibration got skewed over time. Following the calibration reset instructions below seemed to work for me.

Here are the screenshots I took at the time:

Transcript from the Matrix room (with names removed):

[Me] Anyone have any idea why I got this weird power drain on my Librem 5? I literally saw the battery percentage tick down in the span of 30 seconds from around 47% down to 4%. I only had Wi-Fi enabled, and Firefox open with Teddit (Reddit frontend open) as far as open apps go, not including background apps.
[Purism staff] oh 30 seconds? It could be that the battery calibration is off
[Purism staff] power off, remove battery, reinsert battery, and do a full discharge/charge cycle
[Purism staff] over time my battery calibration skewed because I mostly have this phone plugged in at my desk or at a laptop dock, and it only runs for an extended time on battery when I run quick errands, As a result the battery monitor eventually became inaccurate


I wonder if battery calibration reset / or optimization can be performed programmatically without battery removal. Apple had to figure it out since the battery cannot be removed. Or where it watches those two values and if they go out of wack it asks to re-calibrate at a certain time e.g. when phone has been on the charger say 5 hours and based on provided PD settings knowns that the battery theoretically must be at full charge, resetting the values at that time.

1 Like

Calibration off seems to be the case. Powered off the phone, removed battery, waited about a minute or so and reinserted battery. Came back at 30% (from 62%) after booting up again.

Yes, it can be. It’s however much easier and quicker to turn the phone off, take the battery out for a moment and then have the kernel automatically configure the battery gauge back at boot instead of having to take care of that by yourself - especially when in the general case you usually want the calibration data to be retained for as long as possible.

In OPs case, it appears that the gauge has been configured with wrong values. It can happen for example when booting Jumpdrive as the first thing after putting the battery in and then never taking it out again (Jumpdrive defaults to Birch’s device tree, which had a battery with completely different parameters than what’s in Evergreen).