Current Cost to Pachube app: no hacking necessary!

If you have a Current Cost electricity meter, here is a little application you can download that makes it very quick and easy to connect to the web and Pachube, so that you can track it over time, monitor remotely, make consumption indicator orbs for your home, calculate your realtime carbon footprint and create realtime embeddable graphs in your own webpages. The same app should work on either the CC128 or Classic models, and will display temperature in either Celsius or Fahrenheit depending on whether it is a European or US model.

The app does 4 things:

  • shows you your current power consumption as measured by the Current Cost
  • changes background colour from green to red as your consumption increases
  • provides a detailed little spark line graph showing the last 20 minutes of power consumption
  • and every 60 seconds updates Pachube with its current values, to create a page something like this one: http://www.pachube.com/feeds/1233.

CurrentCost to Pachube application CurrentCost to Pachube application

Here's what you need:

  1. RJ45-USB cable for the CurrentCost, currently £7.95, available here: http://stores.ebay.co.uk/Current-Cost-Ltd. This is the direct link to the product you need though it's possible this may change over time. (If you want to hack your own, see http://currentcost.wetpaint.com/ for more info.
  2. Download and install USB drivers for the cable. We've found the best drivers for Windows are those listed off Current Cost's site (available here: http://www.cooldrives.com/wividrforprc.html); while those for Max OS X and Linux are those available at Prolific's site (http://www.prolific.com.tw/eng/downloads.asp?ID=31 ). We haven't had good success with the Windows drivers listed on Prolific's site, but let us know how you get on.
  3. Download CurrentCost_to_Pachube_app for your platform (the same app should work with either Current Cost Classics or the newer CC128):

    Mac | Windows | Linux

  4. Connect your CurrentCost meter to your computer's USB port (the Current Cost Classic has a jack underneath, the CC128 at the rear).
  5. Double-click the application to start it (might take a few seconds the first time -- if it doesn't open up, that's because it couldn't find its preferences file, in which case it automatically generates one, so just double-click it again and it should start up fine).
  6. You need to set some things in the preferences window at the bottom of the window:
    • Make sure that the correct serial port is selected (on a Mac this looks like "/dev/tty.usb-serial"; Windows might be "COM3", depending on how your computer is setup -- try different ones if you have multiple serial devices).
    • Set the number of sensor clamps you have installed -- i.e. how many electricity points the CurrentCost device is monitoring (max is 3 for the Classic and 9 for the CC128).
    • Go to http://www.pachube.com/feeds/new to create a new Pachube feed. Select "manual" feed type; enter a title (e.g. "My Networked CurrentCost meter") and a description if you like. You can also use the little map window to find your location if you would like to show where the feed is coming from (otherwise choose "virtual" domain). Once you have created the Pachube feed, you will be taken to the main feed page (bookmark this page, since this is where you will find the info in future). Copy the link under the title, ending in .xml -- should look something like "http://www.pachube.com/api/1223.xml". Paste this URL into the the URL box in the CurrentCost_to_Pachube app.
    • Paste your Pachube API key into the last box (you'll find that in your Pachube control panel, located here: http://www.pachube.com/users/INSERT_USER_NAME/settings
    • Click "Save Preferences".

    The app will attempt to auto-detect whether its a CC128 or a Classic model - once it does, you will see a readout of current, the message should change from "No info received yet" to displaying your current power consumption. If it hasn't changed after 30 seconds, try changing the serial device to another one in the list and "Save preferences" again. Any troubles, try quitting the app and starting it up again.

  7. Check after 1 minute or so, you should see a brief message on-screen telling you that Pachube has been updated -- it should continue to do so every 60 seconds.
  8. Go back to the URL that you bookmarked earlier, and verify that the feed now says "live" -- if it is, then all is good, and you can now embed those "last 24 hours" graphs in your own webpages: by clicking the "Image" button under every graph you can see the direct URL for that graph. It should look something like http://www.pachube.com/feeds/1233/datastreams/1/history.png.

This application has been built in Processing / Java so if you want to modify it, (you'll have to download some of the libraries, which are easy to find) download the source code here. If you make any enhancements, please do let me know so that I can reference them off this page.

Note, in case you have any trouble getting this to work on Windows, please try the older versions (CC128 & Classic) and let us know if they work better.

Enjoy!

Re: CurrentCost to Pachube app: no hacking necessary!

This comment has been moved here.