From owner-freebsd-questions@freebsd.org Sun Jan 22 16:46:52 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6565CBD1CA for ; Sun, 22 Jan 2017 16:46:52 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA034AFD for ; Sun, 22 Jan 2017 16:46:50 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id v0MGfNVh067909; Mon, 23 Jan 2017 03:41:24 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Mon, 23 Jan 2017 03:41:23 +1100 (EST) From: Ian Smith To: Matthias Apitz cc: Jon Radel , freebsd-questions@freebsd.org Subject: Re: stop charging laptop battery when full In-Reply-To: Message-ID: <20170123005213.T59687@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:46:52 -0000 In freebsd-questions Digest, Vol 659, Issue 8, Message: 12 On Fri, 20 Jan 2017 21:08:26 +0100 Matthias Apitz 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 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@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