Custom battery charging levels

Hi, When I boot my ThinkPad into Windows, I can set the battery to operate in long-life mode. It then only charges up to 90% capacity, and won't start charging until it has dropped below 80% capacity. This is claimed to make the battery live longer -- and so far the battery HAS lasted much better than they have in previous laptops. (Of course, if I'm going to a conference, I can configure the battery to charge up to 100% again easily) I wondered if there is any way to achieve this behaviour in Linux? cheers, Toby

On 13/08/12 16:24, Toby Corkindale wrote:
Hi, When I boot my ThinkPad into Windows, I can set the battery to operate in long-life mode. It then only charges up to 90% capacity, and won't start charging until it has dropped below 80% capacity.
This is claimed to make the battery live longer -- and so far the battery HAS lasted much better than they have in previous laptops.
(Of course, if I'm going to a conference, I can configure the battery to charge up to 100% again easily)
I wondered if there is any way to achieve this behaviour in Linux?
cheers, Toby _______________________________________________
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes. Roger

On 13.08.12 17:09, Roger wrote:
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes.
The Thinkpad I've had since the start of the year gives over three hours with Debian/LXE installed. Well, that's what acpid says - I've only run it for around two hours at a time, and then there's a predicted nearly an hour left. On NEC laptops, one with Debian, one with Ubuntu, I had about the same, but with a sharp taper at the end. Erik -- Withdrawals from Spain in May were 41.3 billion euros and are now up to 163 billion in total. Switzerland, meanwhile, is buying 3 billion euros a day with newly printed Swiss francs to try to keep its currency down because of all the money flooding into Zurich. http://www.abc.net.au/news/2012-08-01/kohler-era-of-deleveraging/4168778

I get about 10hrs from my new thinkpad with the 9 cell battery and fedora 17. Not sure exactly, don't run it straight without suspension. Runs in 7-18 watts depending on wireless, screen brightness, processor usage... Bianca - on my phone, please excuse my brevity On Aug 13, 2012 6:29 PM, "Erik Christiansen" <dvalin@internode.on.net> wrote:
On 13.08.12 17:09, Roger wrote:
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes.
The Thinkpad I've had since the start of the year gives over three hours with Debian/LXE installed. Well, that's what acpid says - I've only run it for around two hours at a time, and then there's a predicted nearly an hour left. On NEC laptops, one with Debian, one with Ubuntu, I had about the same, but with a sharp taper at the end.
Erik
-- Withdrawals from Spain in May were 41.3 billion euros and are now up to 163 billion in total. Switzerland, meanwhile, is buying 3 billion euros a day with newly printed Swiss francs to try to keep its currency down because of all the money flooding into Zurich. http://www.abc.net.au/news/2012-08-01/kohler-era-of-deleveraging/4168778 _______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

Bianca Gibson wrote:
I get about 10hrs from my new thinkpad with the 9 cell battery and fedora 17.
Mine's bigger ;-P 14hrs TF101 (inc. dock) w/vendor's android 2.6.36 and oneiric[*]. [*] not my fault. Previous netbook exploded before I finished setting this one up with wheezy armhf :-( 2012-08-13T08:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T09:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T10:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T11:17:01+10:00 elba battery: battery:98% dock_battery:90% 2012-08-13T12:17:01+10:00 elba battery: battery:98% dock_battery:79% 2012-08-13T13:17:02+10:00 elba battery: battery:98% dock_battery:66% 2012-08-13T14:17:01+10:00 elba battery: battery:98% dock_battery:53% 2012-08-13T15:17:01+10:00 elba battery: battery:98% dock_battery:40% 2012-08-13T16:17:01+10:00 elba battery: battery:98% dock_battery:26% 2012-08-13T17:17:01+10:00 elba battery: battery:98% dock_battery:13% 2012-08-13T18:17:01+10:00 elba battery: battery:95% dock_battery:3% 2012-08-13T19:17:01+10:00 elba battery: battery:88% dock_battery:3% $ cat /etc/cron.hourly/battery #!/bin/sh cd /sys/class/power_supply for i in * do c="$(egrep -x '[0-9]+' "$i"/capacity 2>/dev/null)" && printf ' %s:%s%%' "$i" "$c" done | logger -t battery

Actually, I can do better :P. I can put a slice on the bottum (an extra 9 cells). Then it runs for 2 days (including leaving it suspended overnight) without charging. I can take my laptop, leave my charger at home, go to uni, stay at a friends house, go back to uni for another day without a problem :). I'm curious how much I can squeeze out if I tune it. I didn't expect it to be this energy efficient, so I thought I'd need the slice to avoid charging at uni (can be a pain to get to a powerpoint). I thought my customisations would hurt it's power consumption more. Bianca On 13 August 2012 19:25, Trent W. Buck <trentbuck@gmail.com> wrote:
Bianca Gibson wrote:
I get about 10hrs from my new thinkpad with the 9 cell battery and fedora 17.
Mine's bigger ;-P 14hrs TF101 (inc. dock) w/vendor's android 2.6.36 and oneiric[*].
[*] not my fault. Previous netbook exploded before I finished setting this one up with wheezy armhf :-(
2012-08-13T08:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T09:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T10:17:01+10:00 elba battery: battery:98% dock_battery:100% 2012-08-13T11:17:01+10:00 elba battery: battery:98% dock_battery:90% 2012-08-13T12:17:01+10:00 elba battery: battery:98% dock_battery:79% 2012-08-13T13:17:02+10:00 elba battery: battery:98% dock_battery:66% 2012-08-13T14:17:01+10:00 elba battery: battery:98% dock_battery:53% 2012-08-13T15:17:01+10:00 elba battery: battery:98% dock_battery:40% 2012-08-13T16:17:01+10:00 elba battery: battery:98% dock_battery:26% 2012-08-13T17:17:01+10:00 elba battery: battery:98% dock_battery:13% 2012-08-13T18:17:01+10:00 elba battery: battery:95% dock_battery:3% 2012-08-13T19:17:01+10:00 elba battery: battery:88% dock_battery:3%
$ cat /etc/cron.hourly/battery #!/bin/sh cd /sys/class/power_supply for i in * do c="$(egrep -x '[0-9]+' "$i"/capacity 2>/dev/null)" && printf ' %s:%s%%' "$i" "$c" done | logger -t battery _______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

On 13.08.12 18:29, Erik Christiansen wrote:
On 13.08.12 17:09, Roger wrote:
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes.
The Thinkpad I've had since the start of the year gives over three hours with Debian/LXE installed.
That's with bog standard batteries, AFAICT, so directly comparable with your case, Roger, Erik -- If you stew apples like cranberries, they taste more like prunes than rhubarb does. - Groucho Marx

Roger wrote:
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes.
Is that the with the default install, or after you optimized it? If the former, would you like to discuss techniques to reduce power consumption?

On 13/08/12 19:06, Trent W. Buck wrote:
Roger wrote:
I wish that Linux was easier on batteries. In win 7 both my daughter's batteries lasted around 3 hours. One installed Ubuntu 11.04 and the battery dropped to 70 minutes, the other installed 12.04 and battery lasts about 48 minutes. Is that the with the default install, or after you optimized it?
If the former, would you like to discuss techniques to reduce power consumption? _______________________________________________
Yes with default install, I know nothing about optimising but would be pleased to learn, thanks. Techniques to reduce power would be most helpful but we must also consider that one daughter does 3D modelling in Blender and the other manipulates large .raw images. thanks in advance Roger

Roger wrote:
Yes with default install, I know nothing about optimising but would be pleased to learn, thanks. Techniques to reduce power would be most helpful but we must also consider that one daughter does 3D modelling in Blender and the other manipulates large .raw images. thanks in advance
Darn, now you've put me on the spot. I'm lazy so I'm gonna leave this in my TODO list and hopefully get back to you this weekend.

On 13/08/12 16:24, Toby Corkindale wrote:
Hi, When I boot my ThinkPad into Windows, I can set the battery to operate in long-life mode. It then only charges up to 90% capacity, and won't start charging until it has dropped below 80% capacity.
This is claimed to make the battery live longer -- and so far the battery HAS lasted much better than they have in previous laptops.
(Of course, if I'm going to a conference, I can configure the battery to charge up to 100% again easily)
I wondered if there is any way to achieve this behaviour in Linux?
There seems to have been some confusion regarding my post, above. It's my fault for not being clearer. I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time. With other laptops, I've noticed that after a year or two of use, they become nearly useless on battery. This Lenovo is doing really well after a couple, and I am assuming it's from the above behaviour. (But could be wrong.. maybe battery tech suddenly became much better? I doubt it.) -T

On Mon, Aug 13, 2012, at 08:54 PM, Toby Corkindale wrote:
On 13/08/12 16:24, Toby Corkindale wrote:
Hi, When I boot my ThinkPad into Windows, I can set the battery to operate in long-life mode. It then only charges up to 90% capacity, and won't start charging until it has dropped below 80% capacity.
This is claimed to make the battery live longer -- and so far the battery HAS lasted much better than they have in previous laptops.
(Of course, if I'm going to a conference, I can configure the battery to charge up to 100% again easily)
I wondered if there is any way to achieve this behaviour in Linux?
There seems to have been some confusion regarding my post, above. It's my fault for not being clearer.
I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
With other laptops, I've noticed that after a year or two of use, they become nearly useless on battery. This Lenovo is doing really well after a couple, and I am assuming it's from the above behaviour. (But could be wrong.. maybe battery tech suddenly became much better? I doubt it.)
Hi Toby. I have been setting up a ThinkPad T61 with Ubuntu 12.04 LTS over the last few days and have done two things: 1. Installed the laptop-mode-tools package, which bundles up a number of power-saving and laptop-specific tweaks: http://samwel.tk/laptop_mode/ 2. Started looking at tp_smapi, which includes the feature that I think you are wanting. The arch wiki has a good overview: https://wiki.archlinux.org/index.php/Tp_smapi "It's bad for most laptop batteries to hold a full charge for long periods of time. You should try to keep your battery in the 40-80% charged range, unless you need the battery life for extended periods of time... tp_smapi lets you control the start and stop charging threshold to do just that. " And there is a lot of info at the (fantastic) ThinkWiki site: http://www.thinkwiki.org/wiki/Tp_smapi There are Ubuntu and Debian packages for tp_smapi. I will let you know how I go with it. Would be interested in other people's thoughts on best practices with battery management on Linux. Regards Graeme

Thanks Graeme, tp_smapi looks like exactly the thing I was looking for. Cheers! Toby On 13/08/12 22:10, Graeme Cross wrote:
"It's bad for most laptop batteries to hold a full charge for long periods of time. You should try to keep your battery in the 40-80% charged range, unless you need the battery life for extended periods of time... tp_smapi lets you control the start and stop charging threshold to do just that. "
And there is a lot of info at the (fantastic) ThinkWiki site:
http://www.thinkwiki.org/wiki/Tp_smapi
There are Ubuntu and Debian packages for tp_smapi.
-- .signature

With other laptops, I've noticed that after a year or two of use, they become nearly useless on battery.
AIUI this feature is built into lithium chemistries. If you don't like it, buy (heavy!) batteries using a different chemistry.
I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries. * * * AIUI your original question was how to get the same functionality (stop charging at 90%) while under Linux. That will depend on vendor- or hardware-specific drivers for your thinkpad, possibly something like acpi-thinkpad.ko. And if it doesn't exist, then you can't have it (unless you keep a dual-boot Windows install around purely for the purpose of toggling between stop-at-90% and stop-at-100%). Sorry. I didn't mention that initially because I was hoping someone that actually owns a thinkpad would reply with more specific details. :-(

On Tue, Aug 14, 2012 at 2:28 AM, Trent W. Buck <trentbuck@gmail.com> wrote:
AIUI this feature is built into lithium chemistries. If you don't like it, buy (heavy!) batteries using a different chemistry.
I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries.
I run two Panasonic toughbooks both with lithium cell packs, it has a mode
in the BIOS that restricts charging to 80% to prolong battery life when permanently connected to an external PSU as might happen when mounted to the dash of a police car or ambulance so if that practice is no good for lithium tech then why would a manufacturer implement it on their hardware ?
* * *
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main
-- Mark "Hiddensoul" Clohesy Mob Phone: (+61) 406 417 877 Email: hiddensoul@twistedsouls.com G-Talk: mark.clohesy@gmail.com - www.shed.twistedsouls.com - GNU/Linux.. Linux Counter #457297 "I would love to change the world, but they won't give me the source code" "Linux is user friendly...its just selective about who its friends are" "Never underestimate the bandwidth of a V8 station wagon full of tapes hurtling down the highway" "The difference between e-mail and regular mail is that computers handle e-mail, and computers never decide to come to work one day and shoot all the other computers"

I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries.
Heat does seem to reduce a batteries operational life, and putting the last 20% of charge in a battery causes it to get hotter than the first 80%, so it seems reasonable that not trying to push the last 20% of charge into it would increase its life. This wouldn't be true for batteries that suffered a "memory effect", but lithium batteries (in pretty much every laptop) don't, or at least don't in the chemical sense like the NiCd batteries did. I'm sure google will find some useful studies on this, as well as stuff that people heard from some bloke in the pub :) James

I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries.
Heat does seem to reduce a batteries operational life, and putting the last 20% of charge in a battery causes it to get hotter than the first 80%, so it seems reasonable that not trying to push the last 20% of charge into it would increase its life. This wouldn't be true for batteries that suffered a "memory effect", but lithium batteries (in pretty much every laptop) don't, or at least don't in the chemical sense like the NiCd batteries did.
I'm sure google will find some useful studies on this, as well as stuff that people heard from some bloke in the pub :)
This page http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batt... has a few tables showing charge level vs discharge cycles before battery death. In particular: 4.30 (110% charged) 150-250 cycles 4.20 (100% charged) 300-500 cycles 4.10 (90% charged) 600-1000 cycles 4.00 (70% charged) 1200-2000 cycles 3.92 (50% charged) 2400-4000 cycles So I guess 80% is the sweet spot of battery life vs battery usefulness... only ever charging to 50% would give you 8x the battery life, but then each cycle is only giving you half the value and you risk discharging deeply more often which is even worse (see other tables on the link). James

On 14/08/12 12:28, Trent W. Buck wrote:
With other laptops, I've noticed that after a year or two of use, they become nearly useless on battery.
AIUI this feature is built into lithium chemistries. If you don't like it, buy (heavy!) batteries using a different chemistry.
No! It doesn't have to be this way.. The battery in my thinkpad has lasted a couple of years and still holds a good charge. I've been only charging the battery up to ~85% or thereabouts, as recommended by the manufacturer to prolong the lifespan, and it seems to have worked. (Unless the battery is made out of some superior kind of Lithium chemistry?)
I was talking about maintaining a battery which keeps its ability to hold a full charge. ie. By only charging the battery to ~90%, you can discharge/recharge it many more times, and still get close to the original life out of it, rather than if you charged it to 100% every time.
If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries.
It's not some bloke at the pub - it's the laptop manufacturer. You'd hope they knew best.
AIUI your original question was how to get the same functionality (stop charging at 90%) while under Linux. That will depend on vendor- or hardware-specific drivers for your thinkpad, possibly something like acpi-thinkpad.ko. And if it doesn't exist, then you can't have it (unless you keep a dual-boot Windows install around purely for the purpose of toggling between stop-at-90% and stop-at-100%). Sorry.
I didn't mention that initially because I was hoping someone that actually owns a thinkpad would reply with more specific details.
You must have missed Graeme's post the other day then - he mentioned a utility that provides this functionality. tp_smapi. Unfortunately not built into the Linux kernel, but there's an Ubuntu dkms package for it. I haven't tried it out yet -- my lappie wasn't on the list of supported models on the wiki page, and I had other stuff to do last night. -Toby

If that's based on what "some bloke in the pub told me", I strongly counsel you to check if it applies to the chemistry you're using. This is not my field, but I know that best practices are not portable between e.g. NiMH and Li chemistries.
It's not some bloke at the pub - it's the laptop manufacturer. You'd hope they knew best.
Unless they were shady and wanted you to burn through batteries faster so they could sell you more ;) James

Toby Corkindale wrote:
It's not some bloke at the pub - it's the laptop manufacturer. You'd hope they knew best.
Well, I trust the independent battery expert guy, then the battery vendor, *then* the laptop vendor :-) But point taken.
You must have missed Graeme's post the other day then - he mentioned a utility that provides this functionality. tp_smapi.
Yes, sorry. I wrote the above reply before I got to the tp_smapi post this morning. Bad twb, no biscuit.

On 14/08/2012, at 17:44, "Trent W. Buck" <trentbuck@gmail.com> wrote:
Toby Corkindale wrote:
It's not some bloke at the pub - it's the laptop manufacturer. You'd hope they knew best.
Well, I trust the independent battery expert guy, then the battery vendor, *then* the laptop vendor :-) But point taken.
You must have missed Graeme's post the other day then - he mentioned a utility that provides this functionality. tp_smapi.
Yes, sorry. I wrote the above reply before I got to the tp_smapi post this morning.
Intel's powertop package has been invaluable to me in the past to determine what is waking up a Linux laptop, and increasing battery lifetime by following its recommendations
participants (9)
-
Bianca Gibson
-
Erik Christiansen
-
Graeme Cross
-
hannah commodore
-
Hiddensoul (Mark Clohesy)
-
James Harper
-
Roger
-
Toby Corkindale
-
Trent W. Buck