During my enforced Facebook absence, I’ve found time to do another project – figuring out how much electricity I use, and finding ways to cut down (without affecting my life significantly) – I’ll warn you now, this post gets really geeky, really fast. Also, I’ll mention now, that I’m a bit of a newbie when it comes to Linux, and although I remembered a few bits from my younger days tinkering with things (like how to use the vi editor) – this has been very much a learning experience.
I’ve recently replaced my old Efergy power meter – which was a simple display of how much power my house is using, with some limited historical data, with a new CurrentCost unit (thanks to an offer set up by my employer as part of a recent “Environment Week”) which has the added advantage of having a serial/USB cable available to download the information the unit can display. One quick purchase on Amazon later, and I now have everything I need to download my energy use to my PC…
Of course, I’m not leaving my quad-core media-serving machine (running Windows Home Server – and measured at over 100w when it’s powered up) running 24/7 just to monitor how much power I’m using (it normally follows my main PC/Laptop using a combination of Wake-On-Lan and a WHS add-in called “Lights Out” to shut it down whilst not affecting it’s availability when I need it), so I needed another solution.
While reading up on how to get the data off the CurrentCost unit, I stumbled upon an article describing an approach a few people have used, with doing the same with a scripts running on a Linux VM, and another mentioning doing something similar with a device called a Linksys NLSU2… a very small, flash-based NAS server, originally designed to share USB disks over the network… it uses less than 5 watts of power and can run off a USB flash drive instead of a traditional hard drive. Perfect. I’ll live with the 5w power “cost” of being able to see over time how my home uses power.
Even better, I’ve already got an old NSLU2 boxed up in the attic which was superceded by the Windows Home Server machine some time ago, so this isn’t going to cost me anything except my time…
So after about 20 minutes of rummaging through boxes of old computer stuff (yes, I really should have a clear out sometime – some stuff that’s up there I really don’t need anymore – Anyone want a Full Tower AT case – yes AT… not even ATX… but I digress) – I’ve now got the NLSU2, it’s PSU, and an ethernet cable ready (no wireless on the NSLU2 unfortunately) and a 4Gb USB Flash drive (I wanted this to be a flash drive as this would be powered from the NSLU2, rather than requiring an additional PSU just to run a USB hard drive)
The first step was installing Linux on the NSLU2, which involved re-flashing the firmware and then running the installer – following this excellent HowTo initially.
Anyway, this is how I did this – I wanted to feed the data to both pachube and to a local datastore, (a Round Robin Database) – created with the help of these instructions for creating the datastore, and started with the shell script from this site to retrieve and store the data in both a RRDtool database, and using curl to push the data to pachube.com
As my CurrentCost is the newer model (CC128 ENVI) it uses 57600 baud rather than the 9600 baud of the original units – I had to figure out how to permentantly set the baud rate on the port – eventually tracked the answers down and found that the following command, added at the end of /etc/initd/bootmisc.sh would do the trick.
stty -F /dev/ttyUSB0 57600
I was somewhat surprised to find that my house idles at about 200w – I need to find out what all that power is being used for (some of it will be things like the fridge-freezer and alarm system – which cannot be turned off)