Revision as of 03:37, 5 February 2008 by Rsmith (talk | contribs) (Other uses)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This page is part of the XO Support FAQ.     Support Index | Print This Page

Image:Support-banner-square.png|173px|community support pages rect 0 0 135 204 [1] rect 135 0 345 204 Support FAQ rect 0 205 135 408 [2]

  1. Comment : there's some whitespace here:

rect 135 205 345 408 Other support

  1. maybe desc none is better. testing.

desc none



olpc-logbat is a bash script that logs various parameters of the battery subsystem. It must be run from the "Terminal Activity".

At a Terminal Activity command prompt, enter


Every 10 seconds you will see a line printed to the screen that looks similar to the following:


If you are charging a battery then the output will look similar to:


In addition to writing these values to the screen olpc-logbat writes the data to a file. Every time you run olpc-logbat it creates a file in the current directory (normally /home/olpc) that looks like 'bat-<nickname>-<date>-

The legend for the values is:

<Timestamp>,<SOC>,<Voltage>,<Current>,<Bat Temp>,<ACR>,<Status>,<Overall Level>

POSIX time stamp of number of seconds since Jan 1, 1970
State of Charge. A % number between 0 and 100% indicating how charged your battery is. This number is normally between 7% and 97%. Due to variations from battery to battery its difficult to get an exact measurement down to 1%. Therefor low is anything less than 15% and full is anything greater than 93%.
Battery voltage in microVolts ( x 10E-6 ) The resolution does not really go down to microVolts but its easier not to do floating point math in the kernel driver. The above example shows a voltage of 6.90 and 6.91 volts.
Signed number indicating the current into or out of the battery. Value in microAmps. The above charging example shows a charge current into the battery of 1.58 amps. The discharging example shows a draw current out of the battery of .895 to .899 amps or 895 to 899 milliAmps.
Battery Temp 
Temperature of the battery in 100's of degree Centigrade. The above example is 27.3 to 27.7 degrees C. The battery can have quite a bit of rise above ambient temperature during charge and discharge. In a normal 25 degree room its not uncommon to see values up in to the 30 C range.
Accumulated Current Register (ACR) 
ACR is a 16-bit 2's complement value that counts up or down depending on the amount of charge into or out of the battery. The value is in units of the counter inside the battery but it can be converted to milliAmpHours (mAh) by multiplying by .4167. A single value does not tell you much but the difference between any 2 readings gives you the net charge during that period. The above charging example delivered 26.6 mAh into the battery. (1715-1651)*.4167
"Charging", "Not Charging", or "Discharging". "Not Charging" occurs when the battery is full but you are on external power.
Overall Level 
"Low", "Normal" , or "Full". A basic indicator of where your charge level is.

Common Diagnostic Usage

When requested to run olpc-logbat in response to a battery problem its normally so the developer can see whats going on with the battery during the charge/discharge cycle. The most common instructions will be to run a the Terminal Activity start olpc-logbat and then let the XO run until it abruptly shuts off due to the critical low battery voltage cutoff. Then remove the battery, power up the XO on an external power adapter, start olpc-logbat again and re-insert the battery. When the battery status light turns green or the olpc-logbat level says "Full" unplug the XO from external power and let it run down again until it shuts off. This will create 2 log files in the active directory when olpc-logbat was run (normally /home/olpc). Copy these files to a USB disk and email them to the requesting party.

Other uses

Dynamic Power Measurement

olpc-logbat is proving useful to measure the dynamic power usage and battery life of the XO while on battery power. This information is helping olpc-developers improve the power management system of the XO in the ongoing effort to extend the battery life as far as possible. Starting with the Update.1 release the XO will try to suspend when it senses that the system is not in interactive use by the user. To help collect useful power profile information while using the laptop on battery do the following:

  • Upgrade your OS build to Update.1 or the latest Joyride build. Depending on release status you may need a Developer_Key to do this.
  • Before using the XO run the Terminal Activity and start olpc-logbat
  • Use the XO as you would normally. olpc-logbat will periodically take readings while in the background. When the XO is running it will be every 10 seconds when the XO is suspended so is olpc-logbat but once it resumes olpc-logbat will take a reading and the ACR difference indicates how much power was used since the last reading.
  • When the battery gets low you can stop olpc-logbat by pressing Ctrl-C in the terminal activity and then recharge the laptop. For the power profiling all OLPC needs is the discharge info.
  • email that information to richard at laptop dot org

Solar Measurement

olpc-logbat is also being used to measure the effectiveness of the individual solar panels. email richard at laptop dot org for details.