LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-13-2023, 07:17 PM   #1
LinuxMonday
LQ Newbie
 
Registered: Nov 2021
Posts: 10

Rep: Reputation: Disabled
Laptop battery gaining capacity?


Hello everyone,

I posted this to another site's forum, but no one there seemed to have an answer. It was a distro-specific site, so maybe this is a better place for the question?

Here's what I posted and what I'm curious about:

I run a simple script I wrote to log my current laptop battery capacity now and again (so I know when I want to replace it - maybe at 50%?). For a long time, it had been reporting 67%:

Code:
2023-06-17 : Battery 0: design capacity 8850 mAh, last full capacity 5997 mAh = 67%
Then a few weeks ago, no worries but it dropped (as expected as it ages) to 65%:

Code:
2023-06-24 : Battery 0: design capacity 8850 mAh, last full capacity 5778 mAh = 65%
However, (since) then the reported capactity increased to 68%? Not sure what to make of this as I don't imagine the battery is actually getting better.

Code:
2023-07-03 : Battery 0: design capacity 8850 mAh, last full capacity 6073 mAh = 68%
Any thoughts?

Following is my system info, and then following that the bash script I use to report my battery info, in case either are helpful.

Here's my system info:

Code:
System:
  Kernel: 5.15.0-76-generic x86_64 bits: 64 compiler: gcc v: 11.3.0 Desktop: Cinnamon 5.6.8
    tk: GTK 3.24.33 wm: muffin dm: LightDM Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: Dell product: Latitude E6540 v: 00 serial: <superuser required> Chassis:
    type: 9 serial: <superuser required>
  Mobo: Dell model: 0VPH0Y serial: <superuser required> UEFI: Dell v: A26 date: 10/09/2018
Battery:
  ID-1: BAT0 charge: 36.6 Wh (54.3%) condition: 67.4/98.2 Wh (68.6%) volts: 11.1 min: 11.1
    model: Samsung SDI DELL F0D4C36 serial: <filter> status: Discharging
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M325 serial: <filter>
    charge: 55% (should be ignored) status: Discharging
CPU:
  Info: quad core model: Intel Core i7-4700MQ bits: 64 type: MT MCP arch: Haswell rev: 3 cache:
    L1: 256 KiB L2: 1024 KiB L3: 6 MiB
  Speed (MHz): avg: 1365 high: 2560 min/max: 800/3400 cores: 1: 1049 2: 798 3: 798 4: 798 5: 798
    6: 1728 7: 2560 8: 2395 bogomips: 38310
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel 4th Gen Core Processor Integrated Graphics vendor: Dell driver: i915 v: kernel
    ports: active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2, HDMI-A-3, VGA-1 bus-ID: 00:02.0
    chip-ID: 8086:0416
  Device-2: AMD Mars XTX [Radeon HD 8790M] vendor: Dell driver: radeon v: kernel pcie:
    speed: 8 GT/s lanes: 8 ports: active: none empty: VGA-2 bus-ID: 01:00.0 chip-ID: 1002:6606
  Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: ati,modesetting,radeon
    unloaded: fbdev,vesa gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96
  Monitor-1: eDP-1 model: AU Optronics res: 1920x1080 dpi: 142 diag: 394mm (15.5")
  OpenGL: renderer: Mesa Intel HD Graphics 4600 (HSW GT2) v: 4.6 Mesa 22.2.5-0ubuntu0.1~22.04.3
    direct render: Yes
Audio:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio vendor: Dell
    driver: snd_hda_intel v: kernel bus-ID: 00:03.0 chip-ID: 8086:0c0c
  Device-2: Intel 8 Series/C220 Series High Definition Audio vendor: Dell driver: snd_hda_intel
    v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20
  Sound Server-1: ALSA v: k5.15.0-76-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Intel Ethernet I217-LM vendor: Dell driver: e1000e v: kernel port: f080
    bus-ID: 00:19.0 chip-ID: 8086:153a
  IF: eno1 state: down mac: <filter>
  Device-2: Intel Centrino Advanced-N 6235 driver: iwlwifi v: kernel pcie: speed: 2.5 GT/s
    lanes: 1 bus-ID: 03:00.0 chip-ID: 8086:088e
  IF: wlp3s0 state: up mac: <filter>
Bluetooth:
  Device-1: Intel Centrino Bluetooth Wireless Transceiver type: USB driver: btusb v: 0.8
    bus-ID: 2-1.5:3 chip-ID: 8087:07da
  Report: hciconfig ID: hci0 rfk-id: 5 state: up address: <filter> bt-v: 2.1 lmp-v: 4.0
    sub-v: fc00
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 bus-ID: 00:1f.2
    chip-ID: 8086:282a
Drives:
  Local Storage: total: 232.89 GiB used: 49.83 GiB (21.4%)
  ID-1: /dev/sda vendor: EDGE Tech model: SE847-V SSD size: 232.89 GiB speed: 6.0 Gb/s
    serial: <filter>
Partition:
  ID-1: / size: 227.68 GiB used: 49.82 GiB (21.9%) fs: ext4 dev: /dev/sda2
  ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) priority: -2 file: /swapfile
Sensors:
  System Temperatures: cpu: 52.0 C mobo: 50.0 C sodimm: SODIMM C gpu: radeon temp: 44.0 C
  Fan Speeds (RPM): cpu: 3207
Repos:
  Packages: 2279 apt: 2259 flatpak: 20
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list
    1: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https: //brave-browser-apt-release.s3.brave.com/ stable main
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http: //packages.linuxmint.com vera main upstream import backport
    2: deb http: //archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    3: deb http: //archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    4: deb http: //archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
Info:
  Processes: 265 Uptime: 1h 38m Memory: 15.52 GiB used: 1.85 GiB (11.9%) Init: systemd v: 249
  runlevel: 5 Compilers: gcc: 11.3.0 alt: 11/12 Client: Unknown python3.10 client inxi: 3.3.13
And my bash script:

Code:
#/bin/bash
# -----------------------------------------------------------------------------
# FILE PURPOSE AND NOTES:
# Create report of laptop battery health info
# Find codes at https://www.dmtf.org/standards/SMBIOS
# -----------------------------------------------------------------------------

# Set up variables
bios_report=$(cat /sys/class/dmi/id/chassis_type)
report_data="$HOME/System/Logs/Temp/laptop-battery-status.temp"
report_tracking="$HOME/System/Logs/laptop-battery-status.log"
report_latest="$HOME/System/Reports/laptop-battery.report"

echo ".. Compiling laptop battery report to $report_latest"

# Determine machine type, only run this if this is one of the laptops
case $bios_report in
  3|4|5|6|7)
    machine_type="Desktop"
    echo
    make-warning.sh "ERROR: $(hostname) reports it is a $machine_type ($bios_report) machine, and so has no battery"
    echo "$(date +%Y-%m-%d) : Desktop machine, so no battery" > $report_tracking
    echo
    ;;
  8|9|10)
    machine_type="Laptop"
    # Get current battery info and store that in temp data file
    acpi -i > $report_data

    # Pull capacity data from the temp data file and store in tracking log and report files for later use
    echo "$(date +%Y-%m-%d) : $(grep capacity $report_data)" >> $report_tracking
    echo "$(date +%Y-%m-%d) : $(grep capacity $report_data)" > $report_latest
    ;;

  *)
    make-warning.sh "Unable to determine machine type (i.e., Desktop or Laptop)"
    ;;
esac

# Finalize script
log-script.sh $0
 
Old 07-14-2023, 01:13 AM   #2
lvm_
Senior Member
 
Registered: Jul 2020
Posts: 1,383

Rep: Reputation: 463Reputation: 463Reputation: 463Reputation: 463Reputation: 463
These measurements, or rather interpolations as you seldom do a full discharge, are never accurate. Fluctuations of several percent are to be expected.
 
Old 07-14-2023, 01:49 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,673

Rep: Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816Reputation: 7816
there is no proper (any) way to measure the actual parameters of a battery. Therefore the full capacity, charge and other similar data are calculated by some tricky (and obscure) algorithm, based on previously collected usage information.
 
1 members found this post helpful.
Old 07-14-2023, 02:01 AM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,315
Blog Entries: 24

Rep: Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267
As already posted, the actual condition or capacity of a battery at any given time is unknowable. Capacity may be inferred from measurements of previous use, but is dependent on temperature and other physical parameters, and the total history of the device.

A variation of a few percent, or even tens of percent in the output of some loosely specified or unspecified measurement algorithm is pretty much meaningless.

If it runs a while when the lights go out, be happy! If not, buy a new battery.

Last edited by astrogeek; 07-14-2023 at 02:02 AM.
 
Old 07-14-2023, 10:13 PM   #5
LinuxMonday
LQ Newbie
 
Registered: Nov 2021
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks everyone!
 
  


Reply

Tags
battery life


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Best capacity planning or capacity management tool decenter Linux - Software 1 03-27-2015 04:11 PM
[SOLVED] Laptop battery won't charge more than 79%-80% of its capacity. Hungry ghost Linux - Laptop and Netbook 12 10-27-2013 04:52 AM
LXer: Asus offers £10 high-capacity battery upgrade for Eee PC 900 LXer Syndicated Linux News 0 06-01-2008 12:40 PM
Battery Remaining Capacity jay_manikandan Linux - Newbie 2 10-17-2007 04:01 AM
Diminishing battery capacity on an Acer Travelmate 4102WLMi avheretic Linux - Laptop and Netbook 3 08-09-2006 05:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration