[ltp] Laptop battery storage

Guarded Identity linux-thinkpad@linux-thinkpad.org
Sun, 2 Apr 2006 20:42:34 -0500


Did glanced through as many of the replies as I could find.  Did anyone 
mention www.batteryuniversity.com?  That site is pretty damn authoritative.  
I think the site /does/ link to a company that sells something 
battery-related, but the site seems pretty impartial.  I have come to trust 
the data and explanations on the site as valid.  Here's the page that talks 
explicitly about the issue at hand:

http://www.batteryuniversity.com/parttwo-34.htm.

The table in the middle of the page is pretty interesting.  It looks like the 
bottom line is "temperature" and "state of charge".  For this reason, I think 
it's reasonable to use the charge threshold feature of Shem's tp_smapi to 
keep the battery charge low even when the laptop is on and plugged in.  I 
find that almost all the time, there's an outlet nearby, so there's no real 
reason to charge fully unless there's a long road-trip ahead.  I used to be a 
little crazy about this issue, and I'd unplug my battery when on AC, just to 
avoid charging it.  With tp_smapi, I can now leave it plugged in, and I've 
set the start_charge_thresh to 40% and the stop_charge_thresh to 45%.  The 
battery starts charging when below 40% and stops at 45%.  At that point it 
goes into an "idle" state.  

Just a further note about the implementation.  stop_charge_thresh doesn't work 
on many Thinkpads.  According to Shem, it may not ever be implemented.  
However, he pointed out that tp_smapi can forced to emulate 
stop_charge_thresh by using the tp_smapi's force_discharge interface.  This, 
though, involves a polling script or daemon.

Here's what I did.  I am running Ion3 as my window manager, and it's got a 
very. very cool Lua-programmable daemon -- statusd -- that is intended to be 
set up to poll for information, typically from procfs, sysfs, etc, which is 
then displayed on a nice status bar in Ion3.  However, I found that statusd 
is pretty much a general purpose daemon that can not only be used to read 
interfaces, but also write to them too.  So I wrote up a little statusd Lua 
script that reports to enables reporting to statusd all the tp_smapi 
interfaces of interest, but also allows to using force_discharge to emulate 
stop_charge_thresh.  I'm not sure how wide the reception is for this kind of 
script because it's pretty Ion3 specific, but if you're interested you can 
E-mail me about it.

Upon implementing this script, I began thinking a little more about an idea 
(this is where I truly get off topic from "battery storage").  It seems that 
there's a lot of tiny little daemons that I have running that don't do very 
much that's impressive:  ifplugd, sleepd, tpb, tp-scroll.  All of these 
daemons pretty much do some trivial polling of some interface and write to 
some other interface.  For that matter, that's exactly what my little Lua 
script does to.  Lua is kind of like super-light Python.  It's got a very 
small footprint, way smaller than embedded Python.  For instance, 
libpython2.3.so and libpython.so combined take up 1,040 kB of memory.  The 
embedded Lua libraries in total only take up 208 kB.  Furthermore, Lua makes 
a lot of sense for an embedded language.  It's simple/elegant and powerful.  
crond isn't really all that suited for sub-minute polling.  Why not have one 
general purpose daemon, instead of 4 or 5 small daemons that need to be 
independently maintained?  I know a lot of people that might not be inclined 
to code up a proper daemon, but that would be happy write scripts.  We could 
ultimately do *all kinds of cool* event handling with our laptops.  Also, 
some daemons are written way better than others.  The common daemon-related 
code could be factored out.  Also, calls for foreign libraries could be 
modularized to be loaded optionally (like for xosd functionality, which tpbd 
currently uses).  Similarly, various methods of IPC could also be 
modularized.  I'm thinking the daemon would really just be a shell for 
exposing some libraries to Lua, and also some basic mechanisms for polling.  
Really, the proof of concept is already there in statusd.  It's just that 
statusd is, maybe a bit slightly Ion3-centric.

Anyway, my orginal topic: www.batteryuniversity is a good site.  My spin-off 
topic: is a general purpose Lua-powered daemon a good idea?

Cheers,
Sukant


On Thursday 30 March 2006 11:42 am, Mendel Cooper thegrendel-at-theriver.com |
Linux-Thinkpad| wrote:
> Again, possibly discussed before.
>
>
> If you're not running your laptop on battery power, it's a good idea to
> remove the battery and store it. That prolongs its life. It's recommende
> that they be stored at about 50% charge (Why? I don't know.)>
>
> Why? Because those wonderful "smart" LiON batteries only have a limited
> number of charge cycles, something in the range of 200 - 300 or so. And,
> there's an electronic counter inside the battery that keeps count and
> irrevocably turns off the battery when the count is full up. Very clever.
>
> Now, when you keep the battery inside the laptop, even running on AC all
> the time, the battery charge trickles down a percent or two a week. And,
> when the charge drops to 95% *, the BIOS senses this and recharges it
> back to 100%. And, guess, what? That counts as one charge cycle. So,
> in about a year and a half you can use up a brand spanking new battery
> without ever actually using it. Very clever indeed.
>
>    * In some older laptops, the recharging would start at 98%.
>
> Sometimes, those "smart" gadgets are too damn smart for their own good.