Battery Level Logging for GNU/Linux

line plot of battery level over time.

I wanted some insight why my laptop’s battery was draining so fast. For this, I needed an objective measure when and how much the battery is discharged. For this, I created a bash script that logs the battery’s energy content periodically with a cron job. To analyze the data I wrote a Python script that plots each discharge cycle.