Posts Tagged ‘slug’

CurrentCost hacking – starting to identify appliance power usage

Tuesday, June 3rd, 2008

I needed a break from work tonight, so went back to playing with the CurrentCost meter – a chance to try a few new things.

The objective
I want to make a start on identifying how much electricity different things in my house use. To begin, I’m going to start with a very manual user-driven approach:

Subscribe to updates from the CurrentCost meter, and when a significant change in usage occurs, ask me what I’ve just switched on or off, and collect that information to build up a record of how much electricity different devices use.

How?
It’s already quite late, so I just wanted to hack a quick first version together. I decided to write it as a small Java app.

As I’ve mentioned before, I’m publishing the CurrentCost readings to a small broker running on my home server. The plan was to write a Java application that uses MQTT to subscribe to updates from the broker.

Why? Because I’ve not used Java on the Slug before, or with MQTT. (Is that not a good enough reason? 🙂 )

I’ve written it as a command-line app, because it’s a quick way to run it from different devices around the house. (That is, by cheating 🙂 I’m actually running the app on the home server, using PuTTY / PocketPuTTY / SSH etc. to run it from my ThinkPad, PDAs, mobile, EEE PC, etc.).

(more…)

Accessing MySQL from Perl on SlugOS

Tuesday, May 27th, 2008

I’ve written about my CurrentCost meter that I’m using to monitor my home electricity usage, and the small home server that I’ve set up to collect the data.

Yesterday, I decided to make a start on collecting the data. My plan was to copy what Nick had done and create a MySQL database to store the info, with a table to store a timestamp and the watt reading from the CurrentCost meter.

CREATE TABLE currentcostdl (  
    time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,  
    power FLOAT NOT NULL,  
    primary key(time));

I started with Nick’s Python scripts, but didn’t get very far.

The server, a NSLU-2 (or “slug”) is running SlugOS.

The problem was that there is no python-mysqldb package in the SlugOS repositories. I did try downloading the source for it from sourceforge to build it myself, but struggled to get the dependencies I needed to make it – urllib in particular was a big pain.

I also tried the debian package but again dependencies on SlugOS got in the way.

So I gave up on that and decided to do it myself using Perl – Perl and MySQL had to be easier, right?

Erm… not so much 🙂

(more…)

My new home server – a NSLU-2

Wednesday, May 21st, 2008

I finished putting together my latest gadget this afternoon – a mini home server made from a Linksys NSLU-2 NAS device and a portable USB harddrive.

Why did I want it?

Do I really need an excuse? 🙂

Now I have a full, albeit small, Linux server at home, I’m sure I can think of some fun things to do with it. But as I wrote last week, the catalyst that pushed me to doing this now was wanting something to collect data from my new CurrentCost electricity meter.

It needed to be cheap, small, and low-powered – no point having a server running all the time to monitor my home’s electricity usage if it makes a significant dent in my electricity usage all by itself!

What did I buy?

A NSLU-2 – a network storage link for USB 2.0 disk drives, by Linksys. This is a small NAS device that lets you make a USB harddrive available on a network. The firmware in it comes with enough software to create a network share for any portable USB harddrives or USB flash memory key that you plug in.

It’s a neat little gadget, but what makes it special is that it is very easy to flash the firmware and replace it with a full Linux distro. Plug in your USB harddrive, and you have a Linux server with as much space as you might want.

Oh – and for some reason, people call them “slugs”.

(more…)