You are not logged in.

#1 2014-02-11 14:01:40

frazer
Member
Registered: 2013-12-09
Posts: 60

[SOLVED] Laptop battery callibration

Hello all,

I wondered, (being the sort of person that regularly rebuilds his laptop,) when calibrating the potential time left in a laptop battery it is advised to let the battery run flat so that the hardware knows more precisely when the battery will run out in future - my question is where is this information stored?  Is there memory storage within the battery pack, laptop or upon the HDD?  I.e: upon a rebuild is this information lost?

Many thanks for scratching this itch!

Frazer

Last edited by frazer (2014-03-01 15:08:09)

Offline

#2 2014-02-11 15:55:41

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] Laptop battery callibration

Hi

Just found this: https://bbs.archlinux.org/viewtopic.php?id=154857

So I would say battery firmware. Would mean no, not lost.

Also see e.g. the PDF that comes on second place for google "laptop battery information firmware", looks neat (Edit: Title: "Battery Firmware Hacking") wink.
(Can't link it here cause it's too much PITA to get a PDF URL from gooo... sad (Edit: Oh, thanks anonymous_user, see below!) !)

Cheers

Last edited by rebootl (2014-02-13 16:29:47)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#3 2014-02-11 19:50:35

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [SOLVED] Laptop battery callibration

Offline

#4 2014-02-11 22:43:34

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: [SOLVED] Laptop battery callibration


You're just jealous because the voices only talk to me.

Offline

#5 2014-02-13 21:51:10

frazer
Member
Registered: 2013-12-09
Posts: 60

Re: [SOLVED] Laptop battery callibration

Thanks very much everyone!

Mmmm - 'smart' battery hacking?  I have enough to worry me already...

I still have the 'complete discharge, then charge, occasionally' pattern burnt into my brain.  I've tried, but I can't seem to get it out of there?!?

Offline

#6 2014-03-01 10:52:32

frazer
Member
Registered: 2013-12-09
Posts: 60

Re: [SOLVED] Laptop battery callibration

Hi all,

Thank you very much for all the info - I feel a bit of a twit to ask, but could somebody please tell me how to close this post as answered?

I'm glad I posted on Newbie Corner...

Offline

#7 2014-03-01 10:56:31

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] Laptop battery callibration

Edit your first post and add [SOLVED] to the title. Regards


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#8 2014-03-01 11:34:51

Alber
Member
From: Spain - España
Registered: 2011-11-11
Posts: 227

Re: [SOLVED] Laptop battery callibration


Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.

Offline

#9 2014-03-01 15:07:24

frazer
Member
Registered: 2013-12-09
Posts: 60

Re: [SOLVED] Laptop battery callibration

Thank you very much.

Offline

#10 2014-03-01 21:58:44

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Laptop battery callibration

General-purpose tips: http://www.reddit.com/r/askscience/comm … laptop_to/ .
Now he does have more than enough material to cover.

Offline

#11 2014-03-02 11:32:36

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] Laptop battery callibration

Ah, (one more), here's I little script I wrote once to monitor my battery status:

#!/bin/bash
#
# Shell script to check battery status and perform a shutdown
#  or another action at a critical low battery status
#
### Check if on ac power and exit if yes

if grep -q 1 /sys/class/power_supply/AC/online; then
  exit 0
fi

## Debug print
#echo "On Battery"

### Get the battery values
ENERGY_FULL_DESIGN=`cat /sys/class/power_supply/BAT0/energy_full_design`
ENERGY_FULL_LAST=`cat /sys/class/power_supply/BAT0/energy_full`
ENERGY_NOW=`cat /sys/class/power_supply/BAT0/energy_now`

### Set low and critical values in percent
ENERGY_LOW_PRC="20"
ENERGY_CRITICAL_PRC="10"

### Calculate current energy values in percent
#    (using ENERGY_FULL_DESIGN to eventually get more accurrate values)
ENERGY_NOW_PRC=$((ENERGY_NOW*100/ENERGY_FULL_DESIGN))

## Debug prints
#echo $ENERGY_NOW_PRC

## Debug setting
#ENERGY_NOW_PRC=9

### Perform the checks and take actions
if [ $ENERGY_NOW_PRC -le $ENERGY_LOW_PRC ] && [ $ENERGY_NOW_PRC -gt $ENERGY_CRITICAL_PRC ]
then
	# send a warning to all terminals (login) and the X server (using xmessage)
	wall <<HERE
Warning: Battery low ! Remaining power at $ENERGY_NOW_PRC%
Will perform auto-shutdown at $ENERGY_CRITICAL_PRC%
HERE
	echo -e "Warning: Battery low ! (Remaining power at $ENERGY_NOW_PRC%)\nWill perform auto-shutdown at $ENERGY_CRITICAL_PRC%." | xmessage -file -

	# log event
	logger "Battery low warning triggered by ACPI, warning sent to login terminals and X..."
fi

if [ $ENERGY_NOW_PRC -le $ENERGY_CRITICAL_PRC ]
then
	# initiate timed shutdown in one minute
	shutdown -h +1 &
	# send message to X
	echo -e "Battery reached critical energy level, shutdown initiated !\nSystem will go DOWN in one minute.\nUse shutdown -c to cancel." | xmessage -file -

	# log event
	logger "Battery critical triggered by ACPI, shutdown initiated in one minute..."
fi

Note that I used /sys/class/power_supply/BAT0/energy_full_design as 100%. This is the design value of the battery. I would say it doesn't change, even w/ a calibration.

So when using this value you always get the "real" amount of loading. This is what i3-wm does in it's status bar as well.

Regards

Edit: The script does look for /sys/class/power_supply/BAT0/energy_full but it's not used.
If I'm right you wouldn't have to worry about calibration at all.

Last edited by rebootl (2014-03-02 12:21:56)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

Board footer

Powered by FluxBB