Quite a few folks are activley monitoring using this hardware solution, but I think this solution gets the 'quick and dirty' award, as very little else is needed, the data is collected and posted using a little shell script, with no need for perl, ruby or other such stuff.
- We got the older CurrentCost Classic as the serial data comes out a little slower (9600baud) than the newer, shiny CC128 model, which suited hooking it up to stuff that cant swallow the data rate of the newer model.
- Get the CurrentCost USB cable as well, it has a USB/Serial converter built in , which you'll need unless you already have a separate one (CurrentCost serial port is 5v RS232, so hooking it up to a serial port directly will get you nothing or magic smoke 8-( )
- Unsling your NSLU2 so you can telnet/SSH into it and run stuff. (see links above)
- Hook your CurrentCost to the spare USB port on the NSLU2 (it should also work on a hub btw, but the device below may be different to mine.)
- run dmesg and look for the device ID of the serial port that is detected - ours was /dev/ttyUSB0
- Try this filthy script out - you'll need to edit it, to replace: YOUR_PACHUBE_API_KEY with your actual Key from your pachube account, and also your YOUR_FEED_ID in this file to get it to work. - I just have two integer values, one for watts, one for temp on this feed.
- Two little scripts are provided get-watts , and get-temp which should just echo the data from the CurrentCost to the console, as well as update-pachube which does the biz to the pachube service.
Footnotes: You may need to do some ipkg install magic on the NSLU2, you need grep, sed, cut and curl I forget which ones are in the slugos already.
The NSLU2 is a great platform for this type of stuff, the power consumption is less than 3w according to our killawatt, with processing power to spare, for ..... more stuff in the near future 8-)
Enjoy.
UPDATE: An abusive co-worker who is attempting to follow my vague and inaccurate posting has reminded me that there are two missing steps in this post:
- You need to install some extra packages on your slug, I *think* these are:
- picocom - 1.4-1 - A minimal dumb-terminal emulation program. (you will want this to see what is happening on the com port from the current cost)
- libcurl - 7.19.5-1 (you need curl for the pachube posting)
- coreutils - 7.4-1 -(I think coreuils has cut in it, among other utilities)
(e.g # ipkg install picocom; ipkg install libcurl; ipkg install coreutils)
- You need to install the PL2303 kernel module so the USB-To-Serial cable is recognised. (following http://www.nslu2-linux.org/wiki/Peripherals/USB2Serial worked for my official currentcost cable) - after doing this check with dmesg for the name of the serial port to point to for your data.
Further abusive comments welcome from anyone, if this is still not correct 8-/ - my apologies.
9 comments:
Ok smart arse :-) I thought I was begining to win with this, but you mention packages to install (cut and curl) that don't exist when I try to add them. If I run any of the scripts, they complain about opt/bin/head and cut not being found.
ta-da. Check updated post.
Hi
Thanks for the posting. I'm struggling to get this to work.
My issue is that this does nothing. Just hangs:
/opt/bin/head /dev/ttyUSB0 -n1
This could be (but I have no idea) because this doesn't work
/dev/ttyUSB0
I get the following (running as root)
/bin/sh: /dev/ttyUSB0: Permission denied
using picocom /dev/ttyUSB0
I get the following:
picocom v1.4
port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
escape is : C-a
noinit is : no
noreset is : no
nolock is : no
send_cmd is : ascii_xfr -s -v -l10
receive_cmd is : rz -vv
Terminal ready
øøxøxxxøxøxøxxøøøøxxøxøxøxøxxxxøøxøxxxxøxxøxxxøxxxøxxøøxxxøxøxøxxøøxxxxøxøøøxxøxøxxxxøxøxxxxxxøxxøxxxxxøxxxxøxxxxxxøøøøøxxxxøxxøøxøxxxøxøxøxxøøxxøxøxøxøxxxxøøxøxxxxøxxøxxxøxxxøxxøøxxxøxøxøxxøøxxxxøxøøøxxøxøxxxxøxøxxxxøxøxxxøøxøøxøøxxøøxøøxøøxxøxøøxøøxøøxøøxxøxøøxøøxxøxøøxøøxøøxøøxxøxøøxøøxxøxøøxøxøøxxxxøøxøxøøxxøxxøxxx
then every 6 second or so it adds more øxø.
Could it be that my PL2303 driver is wrong? (Im not getting any errors in dmesg however.
Also just noticed you wrote the home easy --> Arduino stuff - that really helped me on this project to! (Using an arduino to control my heating. Need a source to tell me current temp and the current cost looks like a good way to get that data).
Ta
Ross
Ross, if you have a CC128 then you probably need the stty commands I just posted this morning. Coincidently another reader dropped me a line to say they had figured it out.
Your corrupted data below is just an incorrect baud rate - by default the serial port is opened at 9600 baud, if you have a CC128 or newer model you need 57600 - check the new post.
Thanks for the post. I have the classic though so don't think that's my problem. Bought an envi to see if I can get that working!
Thanks again for the great blog.
It definatley sounds like a baud rate issue - have you tried it under windows with putty etc on different baud rates - i did read that some CC units have slightly higher baud rates instead of the defaults - the timing you're talking about every 6 seconds is definatley the CC putting out the XML, so either baud rate issues or you may have a faulty CC unit?
HTH
@ross - I was having similar issues with my first generation model - until I set the baud to 2400
@ben That's what solved it for me!
Thanks for posting!
Any suggestions on connecting to Google Powermeter as well? Thanks
Post a Comment