Current Cost CC128 - PL2303 USB - Pi2b

Good afternoon,

Trying to piece together across multiple sites what I need to dashboard useful data from a CC128.

I’m using a Pi2B with 17Oct19 prebuilt image. I have a USB PL2303 to male DB9 adaptor and F DB9 to RJ45. The RJ45 is a Cisco rollover cable so I think I need to repin the RJ45 for plain RS232 for which I have the tooling.

Where I am getting confused is the extra steps to listen to xml and have something meaningful in a display. Am I correct in thinking I need to do something to format from xml to something else (MQTT or html api?), then set the something else as an input?

I did set up ttyusb0 in the config but think this is a bum step if the hub can’t work with xml?

I’ve some previous experience with Sony 9 pin, MIDI, MODBUS / 485 etc. software I’m not so hot on :slight_smile:

Hi Richard! I’m not an expert, merely an interested observer but…

I assume you are talking about the Current Cost CC128 Envi energy monitor? In any case, you would have to interpose some code between the CC128 and any of the EmonCMS/Hub software. As you mention, these accept (other than the radio signal data!) MQTT messages, directed at the hub’s MQTT hub, or HTTP GET/POST to the web server on the Hub. Neither of these are XML, so you’d have to reformat the data appropriately, and then send it on (MQTT or GET/POST) to the Hub.

I found this helpful blog entry which discusses the XML format, and the guy also has some Python code which does things with the XML. He also discusses the updating of the CC128 history data, which I suspect you don’t want to feed into your hub, at least yet.

The RPi2B is capable of running a Python script which would do the trick, it’s just (obviously!, sorry)

  1. getting/writing the script
  2. arranging for it to run continuously
1 Like

thanks John.

While looking for crimp tool I came across a Lantronix XPort from some old test bech stuff so will take a look at this too and report back.

What are you connecting to? EmonPi2? I assume that you have access to the USB ports - you’ll need to plug into one of those, using DB9 → [serial-USB UART] → USB, which could be something like this.

Then you need to find the name of the serial port on the RPi, login to the RPi and use “ls /dev/tty*” list all the serial ports - the USB one will be something like /dev/ttyUxxx where “xxx” is whatever it decides. There’s only one like that if you’ve no other serial-USB adapter plugged in.

At that point, you need convert the application protocol - XML → EmonXXX just isn’t going to happen, over any wire/wireless flavour. Here’s the CC128 XML description and the Envi here. This could be a Python script that

  1. reads the serial port (see doc)
  2. analyses the relevant data out of the incoming message (using Python XML API)
  3. posts the data to port 80 using requests lib on the same RPi, which is running a web server

which is configured to run on RPi startup and just loop, doing its thing.

1 Like