Laptop Battery Lifetime

Be sure to subscribe for updates on this and all my other data analysis projects!

One of the biggest selling points for new laptops is the promise of amazing battery life. I work constantly on my laptop, and have given up using any other computer on a daily basis. A 7-10 hour battery would be an absolute god send.

To measure battery life you have to run the computer from 100% to 0% under controlled conditions. I don't have time to play lab-rat with my laptop, so the only way to explore this is through the battery capacity stats that the computer uses to predict how much charge you have left.

As mentioned in a previous post, I've been keeping stats on my laptop battery for the entire life of my computer. The program coconutBattery makes it easy to save basic information, and I eventually put it in my startup items so it prompts me very time I restart my computer.

Lifetime Trend

Battery capacity of my MacBook Pro over 3+ years and
730 load cycles. 100% = 4600 mAh. Orange line is 3rd-
order polynomial least-squares fit.
Here we have all the data I've gathered on my battery over the entire 3+ years of ownership. (Here's another blog who has done a similar analysis over a shorter amount of time.) I've tried hard to treat my battery properly, and still get 2.5 hours of use.

I got clever with a cron job & shell script that saved battery data every minute my computer was being used (doesn't run when asleep), shown in blue. This gives us an idea of the uncertainty on the capacity measurement from the battery.

Oversampling

Battery capacity readings taken at 1-mintue intervals for ~11 days.
Here is the 1-minute data, covering about 11 days of laptop use. The battery capacity jumps around by ~5%, but no clear trend of when it jumps. The cron job ran without complaint, and I never noticed any decrease in laptop performance.

Usage History

Computer (black) and email (blue) usage versus time.

Lastly, the 1-minute battery data contains a fascinating byproduct: it keeps a detailed record of when I'm using my computer. Shown in black is a histogram of the number of battery samples taken over the 11 days, in 30 minute bins. Overlaid in blue we see the number of emails sent over a year in 30 min bins, taken from a previous post.

The very early morning battery data is a byproduct of me using my laptop to observe with the Apache Point Observatory 3.5meter telescope during one of the 11 nights. Otherwise, my usage pattern is very similar to that of my emails, but with more emphasis on the evenings (again probably due to observing... and Netflix)

Conclusions

Keeping the battery log for 11 days required about 2.4 MB of space. This could be trimmed down with a more careful script that saved fewer characters, but the point is clear: it is trivial (under 300 MB) to save 1-minute battery data for the entire 3-year life of your computer. If you only took samples every 5 minutes, you could still get very accurate sampling of the battery health, and your general computer usage, at a cost of 50-60 MB of hard drive space. In today's world, this is the same as free.

My computer is out of warranty, I feel like I'm living on borrowed time. Rumors are swirling about possible upgrades to the Apple notebook line soon, and I'm eager to purchase a replacement. When I do, I will surely be implementing my little cron script and recording fascinating computer usage data!

10 comments:

  1. I think I'd actually be interested in getting all of what you used for this analysis and applying it when I get my new laptop (whenever that may be). Interesting read.

    ReplyDelete
  2. And I DEFINITELY feel the sentiment of living on borrowed time with a laptop that's out of warranty... Whenever my computer hesitates a little bit in turning on, I freak out.

    ReplyDelete
  3. It just occurred to me I forgot to include the script itself! Here's the rundown:

    #My 1-min battery test cron job:
    * * * * * /Users/james/.battest.sh

    # the contents of the actual script: .battest.sh
    date >> ~/batlog.dat
    /usr/sbin/ioreg -l | grep CycleCount >> ~/batlog.dat
    /usr/sbin/ioreg -l | grep Capacity >> ~/batlog.dat

    So the output is kinda sloppy, but nothing that can't be cleaned up easily. I'll dress it up w/ some instructions and send it to ya.

    ReplyDelete
  4. Other than fitting the data well, looking nice, and sufficing the role of special case multiple linear regression, why fit the plot with a 3rd order polynomial least-squares regression? What useful information could be inferred from that fit?

    ReplyDelete
    Replies
    1. The 3rd order fit is strictly illustrative, or as we say "to guide the eye". I think a power-law fit would probably be more useful, but I don't have a sense for what the physically motivated function for battery capacity over time would be... I'd like to keep tracking this battery to see if the decay appears linear, or if the slope "steepens".

      Delete
    2. I believe you really want an exponential growth function, or really y=100-a(1+r)^t. This is a pretty good way to estimate decay of over time. I tried to make an estimate of your data and ended up using y=98.5-0.4*(1+3.8467E-3)^t to give percent battery per time in days. Anyways, I would use an exponential growth function (maybe higher order) like this to fit your data, and you might be able to predict when your battery will quit. I ended up with somewhere around May this year... but I was only interpolating off a few points on your picture... so (hopefully) that's wrong. Awesome job by the way; I love collecting and attempting to analyse data about everyday life.

      http://imgur.com/nmOYYin

      Delete
  5. Replies
    1. Current version is here, and updates will be placed there as well.

      https://github.com/jradavenport/batlog

      Delete
  6. Nice stats, read your article a few years ago and started collecting data too: http://imgur.com/2UVFmIU

    What tool(s) did you use to make the analysis and plots?

    ReplyDelete
    Replies
    1. Cool figure!

      I'd love if you shared your data with me, as I'm starting to work on a post comparing battery data from different users. Check out this GitHub issue

      On there you'll also see some people's discussion of analysis scripts in Python. I replicated a bunch of this work in Python here

      Delete

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...