Neil Cowburn is a Freelance iPhone and iPad Developer based in North Wales, UK
Linkie - a Bit.ly app for iPhone, is now available in the iTunes App Store.
02-Dec-08

I finally got the data cable for my CurrentCost monitor today. I immediately hooked it up to my Mac and set about pulling the data in via Terminal.

CurrentCost Monitor

How cool is that?! Next up: designing and implementing a couple of project ideas I’ve been mulling for the past 6 months. Should be interesting.

For the intrigued geek, this is how I got to see the data:

Using a USB-Serial converter dongle, I connected the cable to the Mac and opened terminal. Next, I needed to grab the name of the USB device so I could open it. I did that by using the following command:

ls -l /dev | grep cu.usbserial | grep -v grep

When I had the name, I could then use the screen command to open the serial port at 2400 baud:

screen /dev/cu.usbserial-0000201A 2400

The baud rate will depend on the actual version of monitor you have. Newer versions operate at 9600 baud. To terminate the screen command, hit Ctrl-a, Ctrl-\, y.

I ended up putting all this together as a Bash script (below) so that I can quickly call it up at will.

#!/bin/bash

export cmd=`ls -l /dev | grep cu.usbserial | grep -v grep | awk {'print "/dev/"$10'}`
screen $cmd 2400
clear
no comments yet

There are no comments yet. You could be the first!

Leave a

Comment