The time now is Tue 21 May 2013, 04:57
All times are UTC - 4 |
| Author |
Message |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Mon 13 Nov 2006, 21:46 Post subject:
a quick fix... |
|
On most batterys there is a number “Last Full Capacity:” I use this in the script to just simply divide the last full by the current.
if you did not have that last full you could charge your bat overnight and replace the last full number in the script with the full capacity of your battery.
so replace
| Code: |
cap="`cat /proc/acpi/battery/BAT1/info | grep "last full cap" | sed -n 's/last full capacity: //p' | sed -n 's/ mWh//p'`"
|
with
or whatever your full number is.....
Messy.......
I am working on getting together a script that will pull out all the info out of peoples /proc/acpi dir. Then I can comb through it and figure it all out.
|
|
Back to top
|
|
 |
Lycanth
Joined: 12 Nov 2006 Posts: 9
|
Posted: Tue 14 Nov 2006, 05:54 Post subject:
|
|
I have this half working [so to speak] it reads my second battery [after modprobing it manually at every boot] but it doesn't pick up my first, also I don't have those battery files in the /proc/acpi [though I'm not really worried about that] is it possible for it to pick up the power in both batteries? also insmod doesn't work either, it just says file/directory doesn't exsist, thinking I might have to copy some files from the CD to my hard drive [I installed Puppy to my hard drive to make it easier]
EDIT: got the files created and stuff, just the insmod comes up as none exsistant, and primary battery is detected, but there's no readout on it's remaining power, but it does report a remaining for my secondary battery if it's installed [either alone in the second slot or with the primary battery] is there a way of making puppy auto load the modprobes to save typing it in on each boot?
EDIT 2: ok, checked about a little and found out the following
BAT1 [secondary] detects battery presence, monitors state, displays remaining power for any battery inserted
BAT0 [primary] as above but doesn't show remaining power for any battery, am I the only one with that problem?
|
|
Back to top
|
|
 |
peppyy

Joined: 27 Jun 2005 Posts: 429 Location: VT USA
|
Posted: Sun 26 Nov 2006, 01:54 Post subject:
|
|
Works well on 2.0.1 ibm thinkpad t22. I don't need the freespace indicator there as much as I do the battery since I am using a hd install and have 4gb left. I will look at the switch and change it for my needs. It is a bit distracting when it resizes.
Nice job!
_________________ Questions? Search Puppy Linux Answers with Google
|
|
Back to top
|
|
 |
Braden
Joined: 22 Sep 2006 Posts: 70 Location: Waterloo, Ontario, Canada
|
Posted: Mon 27 Nov 2006, 16:15 Post subject:
|
|
I couldn't get my system to modprobe ac, but there's a charging flag in the battery's state file.
I don't like the switching mode either, I'd rather have both the battery and the RAM-remaining displayed at once. Or better yet, have it change on clicks: power, RAM, and whatever other information we give it.
Would you consider releasing your source code? If you'd rather not release it, fine, but I think it would allow for better customization, and is more in the spirit of Puppy in particular and Linux in general. Dotpups are great for general users, but I imagine there's plenty of coders here who'd love to sink their teeth into the source and tweak it to their own preferences.
Maybe include some manner of control file, at least, allowing us to set the frequency of the switching, or disable the switching, or add new displays entirely, providing the name of a script to execute.
Also, if you have it reading that file entirely from inside your C code, there will be no easy way to handle slight differences in the battery and ac formats.
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Mon 19 Feb 2007, 15:55 Post subject:
new dotpup |
|
New dotpup see main post.
(batmon0.0.7.pup)
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Mon 26 Feb 2007, 15:00 Post subject:
another addition |
|
Another addition See first post.
|
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13642 Location: Karlsruhe, Germany
|
Posted: Mon 26 Feb 2007, 18:55 Post subject:
|
|
oh, I was curious about our first gins program
Tested it, though I have no battery extensions loaded, just to look how it works.
Found 3 issues:
- batmon.glade is inclluded with an absolute path, maybe should be relative.
- A small startscript "batmon" would be neat.
- You don't catch the window-close event:
If the window is closed, the script still runs.
I ran it in Icewm, where it runs as seperate window.
But also in JWM this might be an issue.
If JWM is restarted, does it still run? Did not try, just guessing.
Nice work, thanks for sharing
Mark
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Mon 26 Feb 2007, 19:22 Post subject:
other fourm |
|
Did you catch my edit of the of the GINS program on the dev forum? This is needed to make the background picture change. I added some code to the program so you can wright boolean properties. I think we can use GINS for a lot of stuff.
I will iron out the wrinkles in the program... You called it, I just wonted to get something out there...
|
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2949 Location: Southampton, UK
|
Posted: Wed 28 Feb 2007, 13:26 Post subject:
monitor battery voltage |
|
Thank you. Batmon works on my thinkpad x30, but the battery lies about its charge level. I can run for an extra 20-30 minutes whilst the charge level is zero.
I've tried logging the voltage instead and this seems much more accurate. Now that I know that my motherboard shuts down at just under 9.2 volts. I presume that monitoring this instead would be dependent on the characteristics of a particular battery / motherboard.
Interestingly the voltage drop from about 90% charge down to 10% (reported to acpi) is fairly linear though it does accelerate after this. I wonder if this last 10% discharge is good or bad for my (li-on) battery.
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Wed 28 Feb 2007, 20:39 Post subject:
|
|
Yeah I had to do it that way because some laptops don't show voltage. In many I think it is one or the other not both. I only show mAh......
Post your changed script so others can see it and use it for themselves.
|
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2949 Location: Southampton, UK
|
Posted: Sat 03 Mar 2007, 07:32 Post subject:
battery monitoring using voltage |
|
For those that are interested in using voltage to measure battery life, read on.
I wanted to investigate the discharge characteristics of my battery so I charged the battery up to full, disconnected the power, ran the following script and let the battery run flat, so that I had a record of the discharge. The script is customised to my ACPI setup on a Thinkpad X30 with a single battery on BAT0. | Code: | #!/bin/sh
echo > /root/my-applications/share/batmon/bat.log
while true
do
echo `cat /proc/acpi/battery/BAT0/state | grep "voltage" | awk '{print $3}'` >> /root/my-applications/share/batmon/bat.log
# line below provides more details and is good for investigating
# echo `cat /proc/acpi/battery/BAT0/state | grep "present rate" | awk '{ print $3 }'` `cat /proc/acpi/battery/BAT0/state | grep "voltage" | awk '{print $3}'` `cat /proc/acpi/battery/BAT0/state | grep "remaining" | awk '{print $3}'` >> /root/bat-investigations.log
sleep 60
done | Once a minute it logs the voltage reported by ACPI. I actually recorded the remaining charge and discharge rate values from BAT0/state as well but as I don't now use these values for my monitor I've disabled that line. Here is a chart of the discharge log
(I've never used gnumeric before and thought it was very good).
From this extended data collected I learnt that the remaining charge reported by ACPI was seriously underestimated, such that the battery was showing as almost flat for the last 40 minutes.
A small bit of theory.
I presume that there is no way of measuring the charge left in a battery. My understanding is that all that can be recorded is the voltage and current delivered by the battery at any time. Using power = voltage * current the system calculates the charge / discharge rate. Summing the rate over time can generate an estimate for the amount of charge put into or taken out of the battery.
By using my bat.log I calculated the total energy discharged by the battery this was approximately 50% more than the value reported in BAT0/info for "last full capacity".
All this talk of battery charge becomes irrelevant. What is important to the laptop is the voltage supplied by the battery and that it can supply sufficient current using that voltage. bat.log revealed a relationship between the voltage delivered by the battery and the remaining life. Studying the log also told me that my laptop powers off when the battery delivers less than 9.3 volts.
The important bit
Because the relationship between voltage and time left is not linear you can't use simple maths to calculate remaining life. (I suppose I could try and fit a function to the curve) I have kept my bat.log, and reversed it using | Code: | | sed '1!G;h;$!d' bat.log > discharge.log | My batmon script scans discharge.log to provide an estimate of the time left, based on the current battery voltage. A nice aside of using this is that if the load goes up, for instance when compiling, the battery voltage drops and this automatically adjusts the remaining battery life.
All this seems a lot of hassle and I wouldn't bother if my firmware battery monitor worked properly, but at least now I can get an accurate reading for remaining life. I haven't considered how it works when charging but I imagine its possible to do something similar. here is my batmon.sh script: | Code: | #!/bin/sh
voltage=`cat /proc/acpi/battery/BAT0/state | grep "voltage" | awk '{print $3}'`
dischargerate=`cat /proc/acpi/battery/BAT0/state | grep "rate" | awk '{print $3}'`
#loop below scans each line in discharge.log until the log voltage is greater than the current voltage
#each line in the log corresponds to one minute of battery life
minutes=0
for volt in `cat /root/my-applications/share/batmon/discharge.log`
do
if [ $volt -gt $voltage ]; then
break
fi
let "minutes=(($minutes+1))"
done
#remove the values you are not interested in from the line below
echo -n "${minutes}min ${voltage}mV ${dischargerate}mW" |
This method works for the battery as it is now but doesn't take into account battery degredation over time.
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
Last edited by HairyWill on Wed 11 Apr 2007, 08:10; edited 1 time in total
|
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 170
|
Posted: Tue 06 Mar 2007, 03:58 Post subject:
|
|
I would like to control the polling frequency for batmon, and in particular reduce it significantly. This because I have collisions between the apm utility (I have changed batmon.sh to use apm instead than acpi) and the mouse driver, which reset my pointer for several seconds. In order to reduce the incidence of such collisions, I would set polling to 60 seconds or similar long periods. Is it possible? Thanks
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Wed 07 Mar 2007, 20:14 Post subject:
|
|
That's on my list. You can use the GINS version of batmon ( 0.1.0)
Just change the line that says
to
you will have to download GINS and rename it to something like ginsbatmon then run the it from the jwm tray with ginsbatmon /path/batmonnew.sh
you will also have to change the line in batmonnew from this
| Code: | | echo "/root/Projects/batmon/batmon.glade" |
to the path to whrere you put the sctipt.
Sorry this is so crazy... I am sorting it out as fast as I can.
If you have problems post and I will give more precise instructions.
|
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2949 Location: Southampton, UK
|
Posted: Sat 10 Mar 2007, 06:36 Post subject:
feedback on batmon-0.1.0 |
|
Brad
I gave this a go last night but have a few problems.
1 Do you use JWM? I can't get the tray to swallow it properly, could you post your swallow entry?
2 It took me a while to realise I needed to use the gins from gins-bradc.tar.gz though I've worked that out now.
<edit> I've removed a comment about not finding ac_adapter, I hadn't loaded the module. Doh!</edit>
Keep up the good work, being able to have full control from a shell script is really good.
For future addins maybe toggling processor speed, temperature and fan speed as well would be good. I know all this stuff exists already but it must be possible to save some space and do it the puppy way.
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
|
|
Back to top
|
|
 |
brad_chuck
Joined: 15 Aug 2005 Posts: 284 Location: Appalachian Mountains
|
Posted: Sat 10 Mar 2007, 10:36 Post subject:
|
|
| Code: |
<Swallow name="ginsbatmon">
ginsbatmon /root/Projects/batmon/batmonnew.sh /root/Projects/batmon/batmon.glade
</Swallow> |
Good power managment is on my list and it will be implemented as soon as possible.
For now you can install the processor modules to control your processor speed manualy.
just search google for "linux acpi processor scaling" or something of the sort.
the govanor you would be best to use is ondemand this will put your processor in the lowest state when not in use and ramp it up if it is needed.
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|