Some time ago I acquired a Current Cost CC128 monitor, which, on its own is quite an interesting but limited way to check the current power usage, by glancing at the display, especially to check that devices are turned off before bed.

Crucially, the monitor comes with a RJ45 to USB cable which allows a connected device to collect power and temperature data every 5 seconds. I’ve always wanted to get a better overall idea of power usage but I would need to leave my PC on all of the time – surely that’s against the idea of power-saving?

Some years ago I purchased a linksys nslu2 , an ARM-powered device drawing 5W power. I had already installed debian 5 [3] for my household rsync backups.

I set out to investigate the various methods of extracting data from the device, and plotting the information on a range of graphs, with the unique limitation that I have a Debian NSLU2 with a 266Mhz de-underclocked ARM processor, and a 2GB filesystem running from a USB stick – so no big databases, heavy web servers or high load. Could such a lightweight device provide for all my requirements?

I found some useful sites that saved me a lot of time in getting this setup , and decided that rrdtool and lighttpd were going to meet my needs. Another great thing about rrd is the tiny database size.

So I started by installing the prerequisites with a

apt-get install libdevice-serialport-perl rrdtool lighttpd ntpdate

Then i created the rrd [7] with help from Paul Mutton’s site – I tweaked the script from the same site to to suit my particular monitor model (additionally with info from here), which writes the data into the rrd every 5 seconds (resulting script) , then added a crontab entry to run a script every five minutes to produce graphs of hourly, weekly and monthly usage.

Finally, I setup a basic index page, served from the lighttpd web server running on the NSLU2, so I can see my graphs all at once.

Here’s my power graphs (10 min, 1hr, 1day, 1 week)

Initially I did this to get an idea of my power usage in a power-efficient way. However, I have a young child and am interested in the temperature of my home. The resulting temperature graphs have helped me to ensure the house doesn’t get too cold overnight in winter, and to set the thermostat suitably – possibly of more use than the power graphs!

I anyone is interested in doing something similar. the raspberry pi model B will be released in early 2012. It will be cheap, have higher specifications that the NSLU2 and can optionally be run from batteries rather than a wall socket.