stop charging laptop battery when full

Ian Smith smithi at nimnet.asn.au
Sun Jan 22 16:46:52 UTC 2017


In freebsd-questions Digest, Vol 659, Issue 8, Message: 12
On Fri, 20 Jan 2017 21:08:26 +0100 Matthias Apitz <guru at unixarea.de> wrote:
 > El d?a Friday, January 20, 2017 a las 01:53:50PM -0500, Sergei Akhmatdinov escribi?:
 > > On Fri, 20 Jan 2017 18:11:25 +0100
 > > Matthias Apitz <guru at unixarea.de> wrote:
 > > > I can ask the current capacity (and other values) of the battery with:
 > > > [snip]
 > > > While charging, is there a way to stop the charging when
 > > > hw.acpi.battery.life reached 100 to protect the (LI-ion) battery?
 > > 
 > > Such functionality should be provided by your battery's internal circuitry.
 > > Think about it, it wouldn't be safe for any consumer to buy a laptop which
 > > doesn't switch to DC power when the battery is full.

Indeed.  Since some early very nasty fires and even explosions of laptop 
Li-ion batteries, manufacturers tend to be over-paranoid about correctly 
(ie safely) charging batteries in many different environments.  "BrandX 
laptop fire brings down jetliner" is BrandX's worst nightmare ..

 > I'm not sure about this. Let's assume the power provided by the charger
 > it withdrawn "somehow" from the battery and the laptop runs only on the power
 > provided by the charger. The battery will now start to drain itself (due to
 > its internal resistor value). When it will start to charge again, and
 > how?

That's not hard to monitor on any laptop.  E.g my Lenovo X200 commences 
charging when reported remaining capacity drops below about nominal 95%

smithi at x200:/root % acpiconf -i0 | egrep 'State|Remain|Present'
State:                  high
Remaining capacity:     98%
Remaining time:         unknown
Present rate:           0 mW
Present voltage:        12394 mV

You could write a script that appends that and more, after a datestamp, 
to a logfile every (say) hour, switching to perhaps once per minute 
whileever [ $state != "high" ] .. ie while discharging or charging, and 
such state changes can be detected using devd(8), example below.

This machine has been alive on AC power for days, and at this rate I'll
expect a recharge in perhaps a week, on form.  My very old Thinkpad T23 
battery is only good for about half an hour unplagged, just a brownout 
UPS really; it tends to self-discharge down to ~95% every 3 or 4 days.

Jon Radel's post all rang true for me, and I've been using rechargeable 
batteries of various chemistries since the mid '70s.  The article linked 
to is among the best I've seen, thanks Jon .. repeated for convenience:

http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries

 > And why all the hints say: Once fully charged, disconnect the laptop
 > from charger?

I really haven't seen such suggestions for years; certainly IBM now 
Lenovo are designed for safe 24/7 connection by naive users, though they 
suggest an occasional full discharge / recharge cycle to condition the 
battery's coulomb counter SMBus chip, which leads me to emphasise one 
link in the above article that is useful to know (and do) with Li-ion:

http://batteryuniversity.com/learn/article/battery_calibration

 > Will it lead to some endless charge/discharge cycle?

If it's working right, yes, but not more often than every few days with 
a battery in good condition,  This is how to treat Li-ion, whereas NiCaD 
benefited from mild trickle charging.  NiMH is somewhat different again.

 > I was asking for some method to disconnect the laptop completely from
 > the charger, either internally or, for example, by some external device,
 > receiving the signal via Wifi and cutting the charger from the outlet.

While it may be fun on a RPi, Arduino etc, there's no need; your laptop 
and battery makers had better! be trustworthy about this .. I do suggest 
scripting and logging discharge/charge cycles, whether regular use or 
deep enough to recalibrate the battery, as a far safer sort of fun :)

See devd.conf(5) under system ACPI, subsystem CMBAT.  Your laptop's 
particular ACPI may or may not produce useful notifications.  I have:

notify 10 {
        match "system"          "ACPI";
        match "subsystem"       "CMBAT";
        action                  "/root/bin/acpi_cmbat $notify";
};

#!/bin/sh
# acpi_cmbat 27/6/14 for CMBAT notifies.  After /etc/rc.d/power_profile
# At 3%, 20% & 80%, dischg & chg, also at every change of AC|battery.
logger -t acpi_cmbat -p daemon.notice "CMBAT notify = $1"
/root/bin/x200stat >> /root/acpi_cmbat_events.log
echo "CMBAT status: notify = $1" >> /root/acpi_cmbat_events.log

cheers, Ian


More information about the freebsd-questions mailing list