How to set battery charging thresholds on laptop...

What do you mean by stopped charging ? What thresholds did you set and what is the current level of charge ?

Code:
#!/bin/sh

acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCCS' -i 75

acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCSS' -i 85

The charge cable is plugged into the wall. The battery level is stuck at 79%. It is neither going up or down. Wierd. I expect it to charge up to 85% and stop.


$ acpiconf -i0
Design capacity: 56160 mWh
Last full capacity: 40510 mWh
Technology: secondary (rechargeable)
Design voltage: 10800 mV
Capacity (warn): 2025 mWh
Capacity (low): 200 mWh
Low/warn granularity: 1 mWh
Warn/full granularity: 1 mWh
Model number: 45N1147
Serial number: 340
Type: LION
OEM info: LGC
State: high
Remaining capacity: 79%
Remaining time: unknown
Present rate: 0 mW
Present voltage: 11702 mV

 
Read my previous post again :)

Charge stop threshold : the threshold your battery won't exceed when it's charging.
Charge start threshold : the threshold you have to reach before your battery starts charging again.

So, with a power source connected to you laptop, the battery will stay at 89% for now.
Disconnect the power source, you battery will discharge.
Connect the power source again : if the remaining capacity is higher than 15%, it won't charge; if it's lower than 15% it will charge, up to 95%.

So, if you want your laptop to be "almost charged all the time but not 100%", you should set a start charge threshold higher, like 85% for instance, and a stop charge threshold at 95%. But if you use it almost always connected to a power source, something like 30% / 75% is enough.

I hope that's clearer :)

Ok, solved. After reading the above by Fuzzbox, I think mine is working as intended.

So, when the battery is between the levels defined by "charge start" and "charge stop", the battery will still be charging but at a reduced rate (with just enough A/C juice to maintain the current battery level).
 
As someone who keeps his laptop near AC outlet 99% of the time, I am set start threshold and stop threshold to 50 and 60, respectively. I read somewhere it is best to keep Lithium battery in this range, to maximum battery longevity.

Question: is there a way to disable this threshold temporarily (allow the battery to charge to 100%)?
 
Question: is there a way to disable this threshold temporarily (allow the battery to charge to 100%)?
No such option afaik (tlp indeed has it on Linux with the tlp fullcharge command). I did not manage to trigger a temporary full charge with acpi_call on FreeBSD.
You can only set new thresholds, like 98 start / 99 stop, to get a full charge. I guess we could script that to make it easier...
 
Removing the battery resets the battery controller on some Thinkpads.

It looks like removing the battery on my T440P does NOT reset the battery controller.

Is 0 and 100 the default values for the controller?


acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCCS' -i 0

acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCSS' -i 100
 
How does one get the current set values for the thresholds?
The following works with my ThinkPad:
Start threshold (set/get/calculate):
Code:
% acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCCS' -i 50
0
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCTG' -i 1
818
% calc 818-0x300
    50
Stop threshold (set/get/calculate):
Code:
% acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCSS' -i 90
0
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCSG' -i 1
858
% calc 858-0x300
    90
 
The following works with my ThinkPad:
Start threshold (set/get/calculate):
Code:
% acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCCS' -i 50
0
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCTG' -i 1
818
% calc 818-0x300
    50
Stop threshold (set/get/calculate):
Code:
% acpi_call -p '\_SB_.PCI0.LPC_.EC__.HKEY.BCSS' -i 90
0
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCSG' -i 1
858
% calc 858-0x300
    90
Thanks - so basically you _have to_ set the value first? I see both thresholds being set first and then something else being done on the second lines - followed by the calculation at the end.

Was hoping for a way where one can just query the values - or maybe I didn't understand correctly.
 
basically you _have to_ set the value first?
I think you can get them without setting first, I haven't tried though since I set them in my /etc/rc.local, will need to comment out and reboot computer to verify. I just typed both commands for reference.
 
I think you can get them without setting first, I haven't tried though since I set them in my /etc/rc.local, will need to comment out and reboot computer to verify. I just typed both commands for reference.
Ok - I got the impression that the i flag followed by a number was to set values 🤔
 
Yeah, kind of confusing, agree.
Code:
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCTG' -i 1
818
% acpi_call -p '\_SB.PCI0.LPC.EC.HKEY.BCTG'
2147483648
I'm more confused now - I thought the command should show 0 if it was successful - so with the first line it's setting a value - was it not set properly that the output is 818?

The second line is probably querying some value (I have no idea what tbh) - so that seems more normal to me.

Also - I think it was mentioned by Fuzzbox that the values allowed are between 1-99 for the battery thresholds - if that's true, I'm guessing those might also be the default values set by the manufacturers?

Since most of us here are trying to conserve battery life/have laptops plugged in almost perpetually - what are the ideal values to set for the battery thresholds for longevity of battery life? That's the most important question I'd like to see touched upon.
 
[...] Since most of us here are trying to conserve battery life/have laptops plugged in almost perpetually - what are the ideal values to set for the battery thresholds for longevity of battery life? That's the most important question I'd like to see touched upon.
For me, I've found it practical to set the upper threshold (when the charger stops charging any further) at a lower percentage, say 70%; the lower threshhold I set 5% lower. When you suddenly have to use the laptop on batteries then you have some workable time left. Usually, I know in advance when I'm going to have to use my laptop only relying on the battery; then I switch off the "threshold" charging and let the battery charge to 100% to have the maximum amount of portable usage available. You'll have to estimate or find out by practical experience the time it takes to charge your battery from 70% to 100%; that depends on several factors (like charger characteristics & battery age).

I've found this a nice workable compromise that prolongs battery life; you should experiment which percentage values work best for you.

Given the chemistry of today’s laptop batteries (AFAIK all Li-ion chemistry) a battery suffers the most when exposed to heat and is in a fully charged state; that would be for example: heavy gaming and charging at 100%. When charging nears 100%, battery temperature rises; this is a normal effect of the charging process. On the other side of the state of charge is letting the charge of the battery fall below the "absolute" minimum; this will disable the charging process with a normal charger and you'll have to resort to special measures to revive the battery again. Normal use won't get you into this situation; you could get into this situation for example when you store a battery with a minimum charge and let it sit for a prolonged period; elevated temperatures shortens this prolonged period of time. Generally, it is advised not to store unused batteries with std. li-ion chemistry at 100% but at, say, 40%.

Battery information:

Using and charging batteries constitute a compromise as to the longest possible use on a single charge versus the longest possible battery lifespan. Laptop batteries are usually charged for the maximum usage on battery power on a single charge and are not optimally cooled due to all sorts of practical and economic considerations. Ideally, theoretically, you'd want battery conditions that will give you the maximum amount of energy throughput during its life span; that, however, interferes with the desire to work for a (reasonably) long time on a battery charge. I think that I read somewhere on Battery University that the optimum for maximum energy throughput was to let li-ion batteries cycle between 40% and 70% state of charge.
 
say 70%; the lower threshhold I set 5% lower.
Isn't that too narrow a threshold?
Usually, I know in advance when I'm going to have to use my laptop only relying on the battery; then I switch off the "threshold" charging and let the battery charge to 100% to have the maximum amount of portable usage available.
Are you using some kind of script/hotkey to change values? I might look into doing that - although I wish such things were available without having to resort to scripting.
Given the chemistry of today’s laptop batteries (AFAIK all Li-ion chemistry) a battery suffers the most when exposed to heat and is in a fully charged state; that would be for example: heavy gaming and charging at 100%. When charging nears 100%, battery temperature rises; this is a normal effect of the charging process.
So I'm thinking if we limit the top threshold to 99 (or nearby) - doesn't that stop the battery from charging?
Or does the 99 stop happen by default (from manufacturer settings) and it still eats away at the battery life? (in which case setting it to (near) 99 is virtually meaningless when trying to set the upper threshold.
Thanks - will definitely give this a read soon.
I think that I read somewhere on Battery University that the optimum for maximum energy throughput was to let li-ion batteries cycle between 40% and 70% state of charge.
In which case an upper/lower threshold with the same values makes more sense? (vs the 5% range referred to earlier)
 
Tracker, my main use is stationary in a docking station (AC connected); for that the lower threshold setting is not very relevant. I don't use a special script: the only laptop that facilitates these charging properties is my Thinkpad P50 (still on MS Windows). My other, older laptop with FreeBSD does not have that kind of charging support. Modern (Lenovo) laptops solely have a USB-C charging port (no specialised docking station connector). Depending of how "stationary" your use is and how (un)likely the physical wrangling at the USB-C connector might become, you could decide to charge it to, say 95%, then disconnect it and let the charge fall by normal use to, say 20%. You are then cycling the battery just as most laptop users but "shaving of" the extremes.

Not only charging nearing 100% at high temperatures is bad, also a high state of charge (non-charging) at high temperatures is bad. In the first reference you'll find:
Lithium-ion suffers from stress when exposed to heat, so does keeping a cell at a high charge voltage. A battery dwelling above 30°C (86°F) is considered elevated temperature and for most Li-ion a voltage above 4.10V/cell is deemed as high voltage. Exposing the battery to high temperature and dwelling in a full state-of-charge for an extended time can be more stressful than cycling.
 
thanks Erichans - so the particular laptop model I have actually has 2 batteries - one internal and one external. I guess the battery % remaining/charged is a sum of the two individual batteries?

I was planning to get new batteries and use it more outdoors, hence was wondering about the battery life etc - although mostly its just use at home as of now - that's why if this was handled automatically it would probably have been a blessing.
 
Also because your other thread here it could be helpful if gave the exact brand & type of your laptop and CPU as well (e.g. dmesg -a | grep CPU should work) as it would take away (a lot of) guessing :)

(I don't have a laptop with two batteries but that—I can imagine—could complicate things when monitoring and regulating charging, and the state of charge as a whole for the two batteries ...)
 
The burning question I have is...

Will dev.acpi_ibm.0.batX_charge_start and dev.acpi_ibm.0.batX_charge_stop work for asus? I know in Linux I had to manually configure a few things for permanent solutions.

echo 60 | sudo tee /sys/class/power_supply/BATX/charge_control_end_threshold

Then edit crontab

@reboot root echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold

acpi_call technique was a no go, ec is different, tried searching acpi_asus and acpi_asus_wmi... got the color keyboard back (sorta)

Specs if anyone has ideas...
 
Also because your other thread here it could be helpful if gave the exact brand & type of your laptop and CPU as well (e.g. dmesg -a | grep CPU should work) as it would take away (a lot of) guessing :)

(I don't have a laptop with two batteries but that—I can imagine—could complicate things when monitoring and regulating charging, and the state of charge as a whole for the two batteries ...)
Hah 🙃 - that font problem still persists - as for the double batteries - one internal and one external - a few laptops had this (not sure if the latest ones do) - so it's not very uncommon.

I think the main issue is - despite your good suggestions - the ideas simply aren't as effective on a dual battery setup - isn't it? For eg I'm not sure how one can regulate the charging limit effectively to prolong life when the two batteries (guessing here) essentially discharge one after the other - or would there be different thresholds for both batteries ? 🤔

If I make the thresholds even, say 75 and 25 respectively- it would essentially mean that the first battery is going to go from 50% to 0% (assuming both are equally functional) followed by the second battery going from 100% to 50%. So it's essentially a mess trying to control the thresholds - or is there a better way I wonder
 
The burning question I have is...

Will dev.acpi_ibm.0.batX_charge_start and dev.acpi_ibm.0.batX_charge_stop work for asus? I know in Linux I had to manually configure a few things for permanent solutions.

echo 60 | sudo tee /sys/class/power_supply/BATX/charge_control_end_threshold

Then edit crontab

@reboot root echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold

acpi_call technique was a no go, ec is different, tried searching acpi_asus and acpi_asus_wmi... got the color keyboard back (sorta)

Specs if anyone has ideas...
Yeah never mind won't let FreeBSD fry another laptop battery
 
Back
Top