15
Dec
08

CurrentCost and Ubuntu

I received my CurrentCost unit today from the Eco Gadget Shop. I’m impressed with their service, it only took a few days to arrive. Anyway, as soon as I unpacked the unit and installed the cable grip, it was time to have a play.

As any self-respecting Linux geek would do, the first thing I did was try to hook the unit up to my Ubuntu Intrepid Ibex box. Theres quite a bit of information out there on logging the data that the CurrentCost unit spits out but most of it tends to lean towards the Windows/Mac OS X side or concentrates on the serial port interface of the older cables. What I wanted was a Linux and USB serial cable solution.

The first thing you need to do is setup the USB serial cable. This is pretty trivial if you know what you are doing but can be quite daunting if you don’t. First plug in the USB cable and verify that it has indeed been recognised.

A lsusb should show something along the lines of this (your output will vary but the important bit is the part that reads:


Bus 004 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Take note of the ID, its in two parts, the 067b bit and the 2303 (your numbers will most likely be different). Then its time to modprobe the USB serial driver in.

Notice that the two numbers from the previous command have been used with a ‘0x’ added to the front of them. Issuing the dmesg command should show you that the USB serial driver has been loaded (look near the end of the output) and that /dev/ttyUSB0 is now available for you to read.

From this point on I really recommend you read the excellent how-to by Paul Mutton over on his website. The perl script he supplies only needs two lines changing. Change:

my $PORT = "/dev/ttyS0";

to

my $PORT = "/dev/ttyUSB0";

and

$ob->baudrate(2400);

to

$ob->baudrate(9600);


The first change is to point to the USB serial port and the second to set the baud rate to the newer units speed of 9600.

The rest of Pauls how-to will get you up and running, logging the data and producing nice looking graphs.

Advertisements

0 Responses to “CurrentCost and Ubuntu”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: