Librem 5 battery charge calibration

For me, the battery charge calibration of Librem 5 gets off quite rapidly, measured by

  1. upower, that after only a day or two shows a growing discrepancy between energy-full and energy-full-design
    Easiest way to view just that: upower -d | grep energy-full
  2. the fact that battery drain below a certain percentage happens very quickly

This results in the battery percent in the indicator bar quickly becoming unreliable and that the phone usually has less power than I think it has. It could also mean, but I am not certain about this, that the phone believes it is fully charged before it actually is.

I know the “energy-full” drift can partly be explained by different charging cycles, where less frequent charging is preferable. However, I like to wake up to a fully charged phone and therefore charge throughout the night. I also like to have as much charge as possible when I leave home to reduce the likelihood of the battery discharging completely before I return.

I am aware of discussions on this forum about different ways to recalibrate the battery charge by various lengthy processes involving turning the phone off, remove/reinsert the battery while phone connected to power, etc. My preferred way of doing this is simply turning the phone off, remove/reinsert battery and let it restart. After that my energy-full and energy-full-design always align perfectly.

I am confident that there is or soon will be a better way of coping with this on the L5. With the current battery drain even with the phone idle (I fully respect the challenges with this), I don’t want the calibration issue on top to make the situation even less optimal.

What are your thoughts and experiences about this?

That’s a sign of no calibration. You want the energy-full value to change as the gauge discovers the battery’s true capacity at the moment, which almost certainly isn’t going to equal energy-full-design.

On my phone right now, with an almost 2 years old battery:

    energy-full:         11.2639 Wh
    energy-full-design:  13.8572 Wh

The less you take the battery out, the more accurate energy-full has a chance to be.

2 Likes

So what is the recommended way to calibrate? Also, is this something that could be done through software in the future? I have yet to experience energy-full being lower than energy-full-design, by the way. I am currently at:

energy-full:         14,1047 Wh
energy-full-design:  13,8572 Wh

after pulling the battery about 3 hrs ago.

The gauge calibrates itself continuously while the battery is in use. It loses all calibration once you take the battery out.

If you often unplug and plug it back in while the battery is near 100%, you may end up with elevated energy-full value and the gauge believing that the battery has more charge than it actually has, so avoid doing that. Otherwise, the energy-full estimate should get more accurate with each charging cycle (accurate to the real battery capacity, not to energy-full-design).

3 Likes

Thanks @dos for explaining this, seems I have misunderstood most of the battery magic. Running full charge cycles, though, is problematic if it makes me leave home with e.g. only half charge and will be away from a charger for more than 4-5 hours. I have a spare battery to carry with me, but using that will again lose all calibration. I often end up “topping up” the battery just to make sure. There is, of course, the option of carrying a power bank, but that isn’t always desirable either.

1 Like

I have two batteries and also tinker with the phone, requiring taking the battery out. Any chance of getting somehow more persistent memory of previous calibrations? A selection/profile of a manually identified battery (“A”, “B”, “C” etc.)?

1 Like

It is theoretically possible to save the calibration data to restore it later, but we have no way to identify the battery, so you’d have to manage it manually. I have no intention to implement that, but MAX17055’s datasheets should have all the required information should you want to try it yourself :wink:

@tomoqv Just give it a few full charge cycles before reverting to your regular behavior and it should already be better.

3 Likes

One additional thing to note is that upower is a poor way to check for what gauge reports, as it’s not updating its energy-full value until a reboot (or daemon restart).

The actual values reported by the gauge can be found in /sys/class/power_supply/max170xx_battery.

1 Like

My actual values are:

    energy-full:         30.1395 Wh
    energy-full-design:  13.8572 Wh
    energy-rate:         0.952684 W
    voltage:             3.87375 V
    time to empty:       28.2 hours
    percentage:          89%

which are fare away from making any sense. I have not taken out the battery since ages. And from time to time my L5 shuts down due to battery empty (because I felled into sleep). What is the best advice now to get energy-full to a reasonable value?

This is unreasonable indeed. Could you post (or send me) a graph showing your battery usage pattern from the last week? You can use gnome-power-statistics from gnome-power-manager package. Make sure to enable scale-to-fit for it as it won’t fit the screen otherwise. Here’s an example graph of how it may look like:

Also, provide the output of cat /sys/class/power_supply/max170xx_battery/uevent.

1 Like

Here we go:

1 Like

Looks like you somehow got the estimated charge_full value to be so high that the gauge stopped reliably detecting the end of charge (notice how it never reaches 100%), so it can’t adjust it down to reasonable values.

Charge the battery to full (until the red LED goes off), then turn the phone off, take the battery out for a few seconds and put it back in. Then let it discharge to 0 and charge it back to 100% afterwards. This should give the gauge enough rope to make its estimations better.

Although, to be sure: could you send another screenshot with the checkboxes at the bottom set to the same states as on my one? Smoothing may make this chart misleading.

Here is the screenshot again as requested:

And the requested output is:

purism@pureos:~$ cat /sys/class/power_supply/max170xx_battery/uevent
POWER_SUPPLY_NAME=max170xx_battery
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=6254
POWER_SUPPLY_VOLTAGE_MAX=4220000
POWER_SUPPLY_VOLTAGE_MIN=3080000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3300000
POWER_SUPPLY_VOLTAGE_NOW=4208281
POWER_SUPPLY_VOLTAGE_AVG=4209453
POWER_SUPPLY_VOLTAGE_OCV=4025625
POWER_SUPPLY_CAPACITY=93
POWER_SUPPLY_CHARGE_FULL_DESIGN=4199160
POWER_SUPPLY_CHARGE_FULL=9133173
POWER_SUPPLY_CHARGE_NOW=8569286
POWER_SUPPLY_CHARGE_COUNTER=21895620
POWER_SUPPLY_CHARGE_TERM_CURRENT=159343
POWER_SUPPLY_TEMP=348
POWER_SUPPLY_TEMP_ALERT_MIN=-1280
POWER_SUPPLY_TEMP_ALERT_MAX=1270
POWER_SUPPLY_TEMP_MIN=-2147483648
POWER_SUPPLY_TEMP_MAX=700
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_SCOPE=System
POWER_SUPPLY_TIME_TO_EMPTY_NOW=368634
POWER_SUPPLY_CURRENT_NOW=780781
POWER_SUPPLY_CURRENT_AVG=790154
1 Like

So yeah, do as above ^^^^

Will obey and report back. :slight_smile:

I did:

1. charged full (until red LED off)
2. powered down
3. took battery off for a short moment
4. powered on (~7:20pm)
   upower -d 
   ...
   energy-full:         14.075 Wh
   energy-full-design:  13.8572 Wh
5. let it run out of power
6. reboot and charging starts at 5:52 CEST
   energy-full:         14.075 Wh
   energy-full-design:  13.8572 Wh
7. reached full (LED off, 100%) at ~9:30 CEST

@dos, I followed your procedure some days ago and as I saw that the value for energy-full is again growing, I installed a cron job:

# watch the growing value of energy-full
#
12 8-22 * * 0-6 (date ; upower -d | grep energy-full | head -2) >> /home/purism/energy-full.log

here is the log:

Sat 01 Apr 2023 11:04:57 AM CEST
    energy-full:         14.1938 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 11:10:01 CEST 2023
    energy-full:         14.1938 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 16:12:01 CEST 2023
    energy-full:         14.1938 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 17:00:01 CEST 2023
    energy-full:         14.1938 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 18:00:01 CEST 2023
    energy-full:         14.1938 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 19:00:01 CEST 2023
    energy-full:         14.3323 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 20:12:02 CEST 2023
    energy-full:         14.5006 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 21:12:01 CEST 2023
    energy-full:         14.5006 Wh
    energy-full-design:  13.8572 Wh
Sat Apr  1 22:12:01 CEST 2023
    energy-full:         14.5006 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 09:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 10:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 11:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 12:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 13:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 14:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 15:12:01 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 16:12:02 CEST 2023
    energy-full:         14.5105 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 17:12:01 CEST 2023
    energy-full:         14.6986 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 18:12:01 CEST 2023
    energy-full:         14.7975 Wh
    energy-full-design:  13.8572 Wh
Sun Apr  2 19:12:02 CEST 2023
    energy-full:         14.9361 Wh
    energy-full-design:  13.8572 Wh
1 Like

I am posting this in this thread too, where it belongs.
About a day ago, my L5 showed the following:

energy-full:         18,0441 Wh
energy-full-design:  13,8572 Wh

Today, I get this:

energy-full:         19,1626 Wh
energy-full-design:  13,8572 Wh

@dos Whatever the battery calibration does, even with long charging cycles (~20%->100%) it seems to notoriously fail. The phone’s energy-full has been increasing steadily over the past week.

I am at a loss here on how to operate this phone in a way where battery calibration improves instead of deteriorates over time.

1 Like

Discharging just to 20% is useless, it doesn’t give the gauge a chance to adjust itself in case of overshooting. It’s important to discharge to 0% and charge to 100% when you’re trying to calibrate the gauge.

Ok, I see, but it is rather awkward to wait out a complete battery drain before recharging. I have done that at occasions, but often the gauge doesn’t seem to be fully calibrated even after such a cycle. Am I supposed to do this discharge/recharge cycle regularly to keep the calibration where I want it to be or is it enough to do this only once in a while?