Coder Social home page Coder Social logo

battery-logger's Introduction

Battery-Logger

Inspired by a blog post and the code that goes with it at jradavenport/batlog

To use the script, add a cron job to your crontab:

$ crontab -e

and enter this:

* * * * * /path/to/your/repo/logger.pl /path/to/log/file

What's Logged?

The data file contains the following values, tab separated:

  1. Timestamp, epoch format
  2. Current Capacity (Charge)
  3. Max Capacity (System Calculated Max Capacity)
  4. Pcnt of Max Capacity Remaining (% Charge)
  5. Cycle Count
  6. Max Capacity / Design Capacity (Battery Health)
  7. External Power Connected? (1/0)
  8. Charging? (1/0)
  9. Fully Charged? (1/0)
  10. Internal Battery Temp (C)
  11. Individual Cell Voltages (in mV)

What's the data look like?

1376806201	8292	8437	98.28	36	99.73	1	0	1	30.31	(4151,4151,4151,0)
1376806260	8292	8437	98.28	36	99.73	1	0	1	30.31	(4151,4151,4151,0)

How much space does the log take?

The entries in the sample above are 67 bytes. There are ~525,600 minutes in a year. That's about 35 MB per year. All entries might not be exactly 67 bytes and some years have an extra 1,440 minutes so the end of year total will vary a bit but it should be in that ball park.

Using the Data

A sample gnuplot script is included for creating graphs.

To create the graph, run the plot.sh script:

/path/to/repo/plot.sh /path/to/log/file /path/to/graph.png

If your gnuplot isn't in cron's path, you can provide a custom path as the third argument:

/path/to/repo/plot.sh /path/to/log/file /path/to/graph.png /path/to/gnuplot

Here is a sample produced with it:

Sample Battery Graph

battery-logger's People

Contributors

akerl avatar

Watchers

 avatar James Cloos avatar

Forkers

midlifexis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.