A few months ago I had to replace my laptop's battery, and I thought it would be interesting to track the inevitable degradation of its new battery.
I slapped together a script to log the current capacity of the battery, and set it as a daily cron job.
#!/bin/sh DATE=`date +%Y%m%d` CAPACITY=`grep "last full capacity" /proc/acpi/battery/BAT0/info` echo $DATE $CAPACITY >> /home/james/battery.log
0 17 * * * /home/james/scripts/battery-tracker.sh
Roughly four months later, I have enough data to plot:
This shows the battery's capacity as a ratio of its design capacity over time. The battery started with about 4.9% more than design capacity, and dropped to about 5.4% below design capacity after 112 days. The steep drops correspond with large charge cycles, since battery life drops as a function of how much it is recharged.
The graph was generated using gnuplot with the following commands:
gnuplot> set xlabel "Days Elapsed" gnuplot> set ylabel "Remaining Capacity" gnuplot> plot "battery-log.csv" notitle with lines