Energy metering at home with CurrentCost 128, Arduino and Pachube
I've looked for information on the web to link a CurrentCost CC128 energy meter, an Arduino microcontroller and Pachube for energy logging, but most of the tutorials and scattered pages were not related to the CC128 model, so I thought of sharing what I have managed to put together.
This code makes it possible to update instantaneous electricity power and temperature readings from the CC128 CurrentCost unit to Pachube using an Arduino microcontroller.
It is only required to change the variables and defines at the beginning of the CC_Pachube_Ethernet.pde file to suit one's needs:
A chopped ethernet cable can be used to connect the CC128 unit to the Arduino board:
The result is something like this:

Hi, I was looking at your code... where is the rest of it? I dont see the newsoftserial connections or any parsing did I miss a post?
I got my cc128 a few weeks ago, and my arduino today... I didnt get the ethernet shield as I am planning to make an abiant orb for my cc128
I have it connected and sending data at 57600, but I am getting some characters cut off:
<msg><src>CC128-v0.15</src><dsb>00004</dsb><time>20:38:22</time><tmprF>77.1</tmprF><sensor>0</sensor><id>00077</id><type>1</t<watts>00568<watts>00726
the </type> tag is gone as are the </watts> and both the <ch1></ch1> ch2></ch2> tags are not coming across either
I have tried several baudrate settings but I am at a loss
here is my sketch:
#define _NewSS_MAX_RX_BUFF 256
#include <NewSoftSerial.h>
NewSoftSerial mycc128(2, 200);
void setup()
{
Serial.begin(57600);
mycc128.begin(57600);
}
void loop()
{
if (mycc128.available()) {
Serial.print((char)mycc128.read());
}
}
I would love to figure out why I am losing data in my serial stream... any ideas?
Regards,
-Jason
Great info, I'm about to do this my self, so am very pleased to see you got it working.
Matthew, Jason, thanks for your comments and apologies for the delay in answering!
Jason, there is a link to the code in the article text. I have not included the NewSoftSerial library, but it must be downloaded from here and installed.
If I remember well, I was also visually missing some data from the data stream, but as soon as I started parsing it, everything went fine. Please feel free to use my code as a starting point. Let me know how it goes!
Hi, i am using your code but having some problems.
Cant find the Arduino in my routers DHCP overview.
And the monitor (Arduino 0018) only writes: Disconnecting.=====
Any idea?
Hi Martijn,
Are you using a static IP for the arduino?
Also, please note that the Pachube IP address has now changed to 173.203.98.29, so the code must be updated accordingly.