PLCBUS as serious test case for all

Some time ago I wrote about a spare PLCBUS Interface that had been unused for quite a while; I wanted to get rid of the USB cable and see if I could do something useful with it.

Today my first thought was: why send the raw PLCBUS frames to the interface over Ethernet (what I planned to do)? Why not add some more ‘intelligence‘ , closer to the hardware; why not completely remove the PLCBUS driver from my Domotica system and put it somewhere else??

I mean, MQTT has been working great right from the start and it’s here to stay, so lets see if I can ‘remove’ the PLCBUS protocol from my monolithic Domotica system and make a MQTT capable PLCBUS driver, just like I did for the Opentherm Gateway – hide the ‘ugly’ details!

There are quite a lot of PLCBUS modules in our house, so a problem with the PLCBUS driver should surface almost instantly – I can use this spare PLCBUS interface as a perfect test case and roll back to the old situation any time in case of serious problems.

USB/RS232/TTL

The first thing I did was examining the internals of the PLCBUS interface once again. USB is out of the question, RS232 will need more hardware (5V for the MAX232), so TTL looked like the right choice. I saw that the MAX232 on the PLCBUS interface PCB was connected to the rest of the hardware by 2 4N35 Optocouplers – 1 for incoming and 1 for outgoing signals. Why not solder 2 wires to these Optocouplers and directly connect this to a UART? Good question…

So I tried. I soldered a wire to each of the two Optocouplers and used a spare Arduino Duemilanove to see if the output was what I expected.

PLCBUS connected to Arduino

And some lines of code (most of them for getting each frame on a new line) for the Arduino to show what’s being received in the Serial Monitor window:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

void setup()
{
  Serial.begin(57600);
  Serial.println("PLCBUS I/O test");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

long time=0;
int nl=0;
void loop() // run over and over
{
  if (mySerial.available()){
    nl=0;
    int c = mySerial.read();
    Serial.print(c,HEX);
    Serial.print(" ");
    time=millis();
  }
  if (millis() > time+100){
    if(nl==0){
      nl=1;
      Serial.print("rn");
    }
  }
}

Yep… all is well. I used a PLCBUS Mini controller to send some frames with a House code which is not in use and saw the following output being displayed in the Arduino IDE Serial Monitor window:

2 6 A5 21 22 64 0 C 3
2 6 A5 21 23 0 0 C 3
2 6 A5 11 23 0 0 C 3
2 6 A5 11 22 64 0 C 3
2 6 A5 11 23 0 0 C 3
2 6 A5 11 22 64 0 C 3
2 6 A5 A8 22 64 0 C 3
2 6 A5 A8 22 64 0 C 3

For those not that familiar with PLCBUS frames: those are all 100% valid frames 😉 So that is working just fine. Next test will be sending PLCBUS frames to the interface to control some appliance modules.

Driver

Next issue: where does the driver go? For this I have (had) several ideas and options. The most important thing for me is that I want all my drivers to work independent of each other – if one of them breaks down for whatever reason, the rest of ’em should not be influenced by that. Now that I have an unused interface which I can talk to @ TTL level, the options are endless – JeeNode, .NetMF boards, Arduino (Mega), Simplecortex, TTL to Ethernet adapter, anything goes, but I decided to go for the Simplecortex. Lots of processing power, Ethernet and I/O. Maybe even suitable for hosting multiple drivers (the less important ones, that is).

This PLCBUS interface will be a good excercise to translate the relatively small amount of Delphi code (about 200 lines) to C and make an application for the Simplecortex with lwIP TCP/IP Stack, DHCP, DNS and MQTT and see how this works out. DHCP to make life easier, DNS to make the application more adaptive network-wise and MQTT as transport layer on top of TCP/IP.

And if this excercise turns out the way I hope, this could be the real start of what I started thinking about in June last year; cutting my Domotica system into relatively independent parts – especially the essential ones like PLCBUS, Zigbee, AV equipment, IRTrans, OpenTherm and all other drivers which are heavily used and make life more comfortable…

Lets do it!

Tagged . Bookmark the permalink.

2 Responses to PLCBUS as serious test case for all

  1. perlish says:

    hi, is there any standard schematic for PLC-BUS implementation. talked schematic in this topic would be fine

Leave a Reply

Your email address will not be published. Required fields are marked *