Battery protection in Carolina (Carolite 2)?

For talk and support relating specifically to Puppy derivatives
Post Reply
Message
Author
User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

Battery protection in Carolina (Carolite 2)?

#1 Post by Mike7 »

Hi, guys.

I'm adding a new battery to my Asus eeepc 1000HA, and I ran into a snag. I need some advice from more-experienced users or developers.

I charged the battery up all the way, then unplugged power and started working it down slowly (I thought). At around 15% capacity left (according to vattery) and just an Internet radio station playing, I had to run next door for a semi-emergency. I should have quickly put it into snooze (Ctrl-F1), but I didn't. I figured that Carolite/Carolina (and Puppy in general) had a battery cutout or shutdown at a safe point, 10% or 5%. (Note: I don't use battery power very often.)

When I got back to the computer a half hour later it was completely shut off, and when I powered up again the battery meter said "Charging.1%".

So, did the op sys let the battery run all the way down? Or did it cut out before that (at 10%) and the battery meter reading is wrong? If the battery was allowed to run down too far, has it been severely damaged?

Does this mean that Carolina/Carolite has no battery protection, and I have to eyeball-monitor battery discharge from now on?

Helpful answers will be greatly appreciated.

Mike7
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#2 Post by Mike7 »

On a second discharge I monitored vattery as it got low and saw that there is a small pop-up box that notifies you when the battery is down to 10% (and, I assume, when it gets down to 5%). But you have to be watching the screen at that precise moment or it passes you by.

Isn't there a built-in utility that cuts out the battery (snooze state?) when it gets too low? Or an add-on that will do this?

How about a little help from the forum with this mundane but important issue?

Thanks in advance.

Mike7
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
festus
Posts: 235
Joined: Wed 14 Jan 2015, 19:10

#3 Post by festus »

Hello, Mike7

I do not know if it'll work with Carolina, but take a look here:
http://www.murga-linux.com/puppy/viewto ... 2&start=30

bliss,
festus

User avatar
Moat
Posts: 955
Joined: Tue 16 Jul 2013, 06:04
Location: Mid-mitten

#4 Post by Moat »

Maybe try "xfce4-power-manager", if installed (or install it, as part of the "Xfce Goodies" tray utilities);

http://goodies.xfce.org/projects/applic ... er-manager

I believe this should give you the low battery/shutdown/hibernate/etc control you're looking for...

Bob

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#5 Post by drunkjedi »

If there's a small popup message at 10% and 5%.

Then that same script which gives those message can be modified to suspend/shutdown.....
No need for extra softwares.

Now what script makes those popups?

Edit: In Fatdog there's a Batt-low.sh in usr/bin. I don't have a laptop so never tested this.

It shuts down pc when battery is low it also checks if adapter is connected and doesn't shutdown if it is.

Code: Select all

#!/bin/dash
FONT="10x20"
FLAG=/tmp/batt-low
SAFE_SHUTDOWN_CAPACITY=2
SAFE_SHUTDOWN_FLAG=/tmp/batt-low-monitor

### helpers

# check if ac adapter is attached
is_online() {
	grep -q on-line /proc/acpi/ac_adapter/*/state || 
	grep -q 1 /sys/class/power_supply/*/online 
}

# get remaining capacity
getcap() {
	cat /sys/class/power_supply/*/capacity  | head -n 1
}

# monitor battery and shutdown safely is battery is too low
safe_shutdown() {
	[ -f $SAFE_SHUTDOWN_FLAG ] && exit # only run one instance
	> $SAFE_SHUTDOWN_FLAG
	while ! is_online; do
		if [ $(getcap) -lt $SAFE_SHUTDOWN_CAPACITY ]; then
			poweroff noprompt
			exit
		fi
		sleep 5 # batt is already low, don't waste more by checking too often
	done
	rm -f $SAFE_SHUTDOWN_FLAG
	exit
}


############# main ############

# no warning needed if AC adapter is attached
is_online && exit

# type of message
case $1 in
	critical)
		TYPE=critical
		MG=50 BG=red FG=white TEXT="Battery is critical, shutdown imminent.\nAttach charger now."
		safe_shutdown &
		;;
	low|*)
		TYPE=low
		MG=30 BG=yellow FG=black TEXT="Battery is low.\nPlease attach charger."
		;;		
esac

# only show the message once
FLAG=$FLAG-$TYPE
[ -f $FLAG ] && exit
> $FLAG

# display
if type yaf-splash > /dev/null; then
	# preferred UI
	TEXT=$(printf "$TEXT\n\nClick here to remove this message.")
	yaf-splash -font "$FONT" -outline 0 -margin $MG -bg $BG -fg $FG -text "$TEXT"
else
	# alternative UI
	Xdialog --title "Battery Low" --msgbox "$(printf "$TEXT")" 0 0
fi

# cleanup
rm -f $FLAG

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#6 Post by mistfire »

try cbatticon

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#7 Post by Mike7 »

Hi, all.

cbatticon is not in Carolite, and the battery monitor which is there - vattery - seems to work fine to monitor battery percentage. If cbatticon also shuts off power at a critical low battery discharge percent, that might help to save the battery, but it won't save my work. What I want is to suspend at low battery (10%), with a poweroff at critical battery (5%). I've tested it, and the eeepc hardware suspend permits very little battery drain, so work would be saved for hours before poweroff.

As regards xfce4-power-manager, the Asus eeepc already has a power manager, the "ACPI Tool", with its associated panel item which allows manually switching between Powersave, Performance, and Turbo, or alternatively automatically monitors the power sources and adjusts power usage. I suppose this ACPI Tool also works together with vattery ("vattery-acpitool 0.7"), but how it does that I don't know. Anyway, I don't think it makes sense to add a new power manager when there already is one. They're sure to conflict.

I searched the operating system with the word "batt". There were no .sh files associated with it. The only file I found in the search results that looked vaguely like a battery-related power control was:

/root/.config/xfce4/panel/battery-7.rc

Code: Select all

display_label=false
display_icon=true
display_power=false
display_percentage=false
display_bar=false
display_time=false
tooltip_display_percentage=true
tooltip_display_time=false
low_percentage=10
critical_percentage=5
action_on_low=1
action_on_critical=1
hide_when_full=0
colorA=#8888FF
colorH=#00FF00
colorL=#FFFF00
colorC=#FF0000
command_on_low=
command_on_critical=
Is it possible that a sleep/suspend command could be put into the next-to-last line, and a poweroff command in the last line? If so, what would the commands be?

OTOH, the vattery interface itself has slots for commands at battery low and critical, so if I knew what the sleep/suspend and poweroff commands were maybe I could just slot them in (see attached screenshot) or add them to the vattery config file:

/root/.config/vattery-acpitool/config

Code: Select all

[colors]
charging=#0000ff
draining=#ff0000
background=#ffffff
border=#000000

[percents]
warning=10
critical=5

[commands]
warning=Xdialog --title 'Battery Alert' --msgbox 'Battery is very low' 0 0
critical=Xdialog --title 'Battery Alert' --msgbox 'Battery is critically low' 0 0
Does anyone know what pressing Fn<>F1 on the eeepc actually does, or what file in Carolina, if any, will duplicate the eeepc's hardware sleep/suspend?

Mike7
Attachments
vattery panel interface screenshot.png
(68.89 KiB) Downloaded 216 times
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#8 Post by Mike7 »

This problem was never resolved because no one replied to my last post. However, I'd like to thank those who at least tried to help me.

Cheers.

Mike7
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

peterw
Posts: 430
Joined: Wed 19 Jul 2006, 12:12
Location: UK

Battery Details

#9 Post by peterw »

I don't know about battery protection in your Puppy. However, in most, if not all Puppies, clicking the battery icon will show the battery details in full such as design capacity, last full capacity, etc. This will show you if you battery is dead or not.
Battery % can sometimes mean percentage of last full charge, etc, and so is not always meaningful.
If clicking on the battery icon does not give the battery details then you can find them /proc/acpi/battery/BAT0 if it is the same as Slacko

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#10 Post by Flash »

Mike, as to the question in your first post, I don't think lithium batteries or Ni-Cd batteries care if they're discharged completely. Some cheap chargers won't even try to charge a totally dead battery, but it's not because there's anything wrong with the battery.

Lead-acid batteries don't like to be discharged too low.

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#11 Post by Mike7 »

Hi, Peterw.

Yes, the panel icon does tell me battery state (charging or discharging) and percentage of charge remaining. But that isn't much help. I can't check it every five minutes. What I need is code that will suspend the computer when there is five percent remaining. My somewhat lengthy earlier post enquired about how to do this, with some seeming possibilities, but no one has been forthcoming with answers to the queries I posed, so I am stuck in the same predicament as when I initiated the thread.

Anyway, thanks for trying to help.

Mike
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#12 Post by Mike7 »

Hi, Flash.

Are you certain that lithium batteries are not harmed by discharging all the way down? What is your authority for this? I am under the impression that it does harm them, and the instructions that came with the replacement battery warned not to do it.

However, the issue here is not so much whether the battery would be harmed but that the computer will shut off and I will lose my work. That is the real reason why I need an auto-suspend at 5% of charge.

M.
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
rg66
Posts: 1158
Joined: Mon 23 Jul 2012, 05:53
Location: Vancouver, BC Canada / Entebbe, Uganda Africa!?!

#13 Post by rg66 »

/root/.config/vattery-acpitool/config

Code: Select all

[commands]
warning=Xdialog --timeout 5 --title 'Battery Alert' --msgbox 'Battery is very low, suspending' 0 0; /etc/acpi/sleep.sh
critical=Xdialog --timeout 5 --title 'Battery Alert' --msgbox 'Battery is critically low, shutting down' 0 0; /usr/bin/wmpoweroff
X-slacko-5b1 - X-tahr-2.0 - X-precise-2.4
[url=http://smokey01.com/rg66/]X-series repo[/url]

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#14 Post by Mike7 »

Thank you, rg66.
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#15 Post by muggins »

Mike7,

If you wanted to try cbatticon, i've posted a pet here.

It's what I currently use, and the pet package default has:

Code: Select all

cbatticon -l 5 -r 3 -c wmreboot
where a warning popup will appear when level gets to 5%, and the computer will reboot at 3%. These can be altered, to suit your own laptop, by editing the file /root/Startup/cbatt.

Further to rg66's comment, from memory I thought you could right click the Vattery icon, (in the tray), and change default levels & actions. I don't have Vattery installed, but can anyone verify this?

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#16 Post by Mike7 »

I think you can't have read the previous posts in the thread, Muggins. But thanks for your desire to help.
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

User avatar
8Geee
Posts: 2181
Joined: Mon 12 May 2008, 11:29
Location: N.E. USA

#17 Post by 8Geee »

Mike7:

The original battery in the ASUS netbooks has a monitor -chip built in. The Replacement batteries usually do not, unlesss you buy directly from ASUS. That said, the chip will popup a full warning box with manual close.

Pressing Fn-F1 in most puppies does nothing. One has to be in screensaver then press power button for a similar function.

These replacement batteries sold are not top-quality- and are affected by deep discharge. It is usually recommended to deep-discharge to zero only upon the first two or three uses, then limit the discharge to no less than 20%. This will preserve overall battery life and number of recharges. I speak here from actual use. My 4-yo 75 Watt big battery replacement in my 900a is showing a maximum charge equal to about 61 Watts. Pup Sys Info has details.

WARNING: These batteries have a fault... if you do not charge them fully to 100%, the maximum capacity will never exceed the last charge. In other words, If your new battery (97%) is discharged, and upon charging you stop at say 80%, all future charging will not exceed 80%.

Good Luck
8Geee
Linux user #498913 "Some people need to reimagine their thinking."
"Zuckerberg: a large city inhabited by mentally challenged people."

User avatar
Mike7
Posts: 400
Joined: Tue 19 Feb 2013, 00:31

#18 Post by Mike7 »

Hi, 8Geee.

I'm on my second, non-Asus replacement battery. I don't know if either has a built-in chip, but the ACPI-tool (Vattery) seems to work properly: it pops up at the discharge percentages that have been set. It may execute the commands that have been set in it, but I haven't yet tested that (using RG66's commands). Perhaps I should mention that I use my netbook primarily as a stationary laptop on AC power, but I also travel with it.

I'm running Carolite 1.2 (Carolina Puppy offshoot) and Fn-F1 suspends the computer exactly as the key combination did originally (in WinXP). Maintaining many of the original eeepc functions was a major reason for my choosing an unpopular and outdated puppy like Carolite (although perhaps the suspend key combination on the 1000HA is independent of the OS).

I figured by default that these batteries are affected adversely by deep discharges and have been discharging to a limit of 10%, except a few times when I was distracted and the battery ran down to 5% and the computer powered-off. But I will subscribe to your good advice to change to 20%, especially as the battery is ageing.

Thanks for your warning. I already knew about the maximum charge problem, but a reminder is always timely.

Mike
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.

iugamarian
Posts: 1
Joined: Mon 24 Dec 2018, 20:52

My batt-low.sh

#19 Post by iugamarian »

Powering off on low battery using /bin/bash

Code: Select all

#!/bin/bash
while true
do
battery_level=`acpi -b|grep -P -o '[0-9]+(?=%)'`
battery_discharging=`acpi -b|grep Discharging|wc -l`
if [ $battery_level -le 1 ] && [ $battery_discharging -eq 1 ]
then
wmpoweroff
fi
sleep 30
done

Post Reply