Battery Life

Like everyone, I take my work home with me. This comes in many forms; some nights and weekends I am observing remotely on a telescope, others I am writing or programming for a project or paper. The more insidious and subtle way my work comes home with me is my absurd desire to plot things and seek out data in every day situations. I suspect this is due to being a graduate student, but probably bodes well for my long term job prospects... 

I've written about the health of my laptop's battery before, and since I had already figured out how to get the data, this seemed a fitting topic to post about again!

Premise: I would like to track the health of my laptop's battery over it's operational life, and to estimate the maximum lifetime. To do this I have been using a lightweight program called CoconutBattery. The program is in my login items, and whenever I restart my computer (every 1-2 days or so) it will pop up with a reading of my battery. There is an option to save the reading, and I have been doing so since a few months after I purchased my laptop.

To retrieve the data I opened the xml file into Safari, pasted the text into emacs, worked some simple search/replace magic, and voila:

Alas, there are no error bars... Time=0 was on 2009 May 07. My battery reads today 681 loadcycles, and I have 338 data points.

My initial analysis was only on the first ~1.7 years of data, and could only be fit with a line. This laughably suggested my battery would last 68 years, assuming a constant linear decay of battery capacity. I then started taking data more often, and from 1.7 to 2.5 years I quickly found out that the decay was most certainly not linear.

There is a discontinuity at ~1.9 years that I noticed. I'm not sure what happened here, the sampling cadence was high because I was restarting my computer almost every day to play video games with some friends, and has dropped off because I am not playing much this year. The sampling cadence appears to be roughly constant over this discontinuity, with ~8 measurements per week, suggesting my usage is not likely to blame. My theory instead is that software updates are to blame (or to thank).  My mac's history of Installed Software states that OS X 10.6.6 and 10.6.7 came out in early 2011, and I believe the latter caused a recalibration of the battery measurements. 

The fit looks embarrassingly good, and that's simply because I cheated. From 0 to 1.7 it is a linear fit, and from 1.5 to 2.7 it's a 4th order polynomial. These don't remotely match at time < 1.7, and I should have fit two separate functions before/after the time = 1.9 discontinuity. I did this late last night, so as we say in the biz "it's good enough to first order..."

The inset shows the "prediction", extending the 4th order fit out to where the capacity = 0.  I do not believe this behavior will hold exactly as predicted, and instead (through anecdotal evidence) will probably flatten out around 30% capacity, or ~1 hour operational life. Batteries fail for many reasons, and their lifespan and capacity are dependent on parameters such as their operating temperature, charge depth, and charging voltage. Oh, and age!

I'm planning to buy a new laptop this summer, as my warranty is only valid for 3 years (and the battery capacity drops dramatically at that time range!). I will be keeping more data on this laptop until then, but would still like to write a cron script to take this data passively every hour. I might have even started working on this at one point... more investigation definitely required! 


  1. An update on this will be forthcoming: I found 10 min to write a cron script using ioreg and am taking a battery reading every 1min!

  2. Battery life is one of the most common problems of laptops, thank you very much for sharing your study.

  3. I wish I had read this post first with more data! Think you could post your numeric data somewhere? I think it'd be fun to try to fit it and guess end of life for your battery.

  4. Would you consider posting the raw MBP data?


Inappropriate comments, advertisements, or spam will be removed.
Posts older than 2 weeks have moderated comments.
(Anonymous commenting disabled due to increasing spam)

Related Posts Plugin for WordPress, Blogger...