bcmon: OSX Battery Charge Monitor

bcmon (Battery Charge MONitor) is a small executable for Mac OSX to monitor/profile the system battery over time. It writes a very simple log file containing the battery status at regular intervals.

For a linux version see batlog.

Usage and file format

Compile (with make) or copy the executable directly to /usr/local/bin. Copy the provided launchd script to /Library/LaunchDaemons/bcmon.plist to start bcmon at startup. The output is simply appended to /var/log/bcmon.log. Run the program without arguments for a short help.

The log file contains all the available battery parameters that can be retrieved with IOKit “pwr_mgt” module:

  • Charge
  • Capacity
  • Voltage
  • Amperage
  • Cycle count
  • Flags (raw value)

The file starts with a simple header, followed by tab-separated values. A line is generated every minute but only when there’s a change in any of the fields, so it doesn’t usually need rotation (mine’s about 21Mb after 5 years).

Download

bcmon is released under the Revised BSD License. The archive contains the source, an example launchd service, prebuilt OSX 10.7 “Mountain Lion” binary, as well as an old OSX 10.4 “Tiger” Makefile and executable.

Apple’s PowerBook G4 (2007) battery profile

I’ve written this small program roughly a month after getting my PowerBook G4 15” in early 2007 to see the evolution of the battery over a long time span, and I’ve been using it ever since.

The battery model is A1078, original by Apple and made in Taiwan. The S/N is W75191MFRV6A and so far was never found to be part of any “faulty” batches.

As of 03/2013, this is the only battery profile that I’m aware of that shows the full lifespan of a typical Li-ion battery with a ”real life” usage pattern, from being brand new to completely unusable.

images/apple-powerbook-g4-battery.png

Download the raw data: bcmon.log.gz (2.4Mb).

I would guess the original capacity of the battery was no more than 3600mAh. After one month of usage, the maximum reported capacity would peak at ~2650mAh already. At that time, I could work around 2.5 hours unplugged.

The vertical slivers of dots show the laptop being used unplugged and being discharged rapidly, while the thick “bands” represent plugged use, with regulated charge-discharge cycles at 90% capacity.

As you can see the laptop was used unplugged regularly. The battery degraded gracefully over a period of 3 years, totaling 257 cycles.

Getting close to the minimal capacity causes the power manager to adjust to the real capacity of the battery. There are several changes over time (with the PM under/overshooting a bit), but you can spot several large, consistent drops in the reported capacity which indicate the degradation of an individual cell.

By August 2010 this laptop wouldn’t last more than 30 minutes unplugged. If you are actually using the laptop while traveling, it means it’s already next to useless. At the end of January 2011 it was only possible to login while being plugged, or the laptop would turn off during boot. In May 2011 it wouldn’t start at all without being plugged. Around the end of 2012 the internal CMOS battery also failed, resulting in periodical time resets and bogus log entries in the file (which were eliminated in the plot, but are still present in the raw data).

In the end the battery was actually usable for a period of two years. If you have an embedded battery, this is more or less the lifespan of your device.