RS232 Serial Spy

About: I am an automation engineer but I will give anything a go. I don't know if you call if pessimism or just being an engineer, but I look for problems everywhere, then I look for some weird, left field way to s...

Intro: RS232 Serial Spy

BACKGROUND:

I will start by explaining my motivation for making this device, I am an automation engineer and recently was asked to develop a SCADA system as a replacement for an end of life system that is still in use. The PLC in the network only has a single RS232 output which is connected to the existing SCADA. As the PLC system is old and the structure of the program is not 100% clear due to lack of documentation, it was desirable to hook up the new SCADA in parallel with the existing system as a monitor for verification prior to taking full control of the process.

THE PROBLEM:

The problem arises that RS232 is a point to point protocol, this means that there can only be one device on each end of the cable, for further nodes in the network, you must have multiple serial ports and a device capable of mapping the data onwards.

THE SOLUTION:

The RS232 spy shown here allows a second device to be introduced as an RS232 monitor (no ability to write to the device), perfect for my application.

Step 1: Getting Started

WHAT YOU WILL NEED:

  • 1 junction box
  • 1 male D-SUB 9 connector
  • 2 female D-SUB 9 connectors
  • 1 2.2k OHM resistor (colour code red, red, red)
  • 1 diode 1N4148
  • Assorted wire
  • Solder
  • Soldering Iron
  • Wire Snips

Step 2: Mounting the Connectors

I like for the D-SUB connectors to be fitted nicely into my creations, for this I keep the housing from an old connector to hand, I use this as a template for marking the cutout.

I start by laying the connector down and drilling out the 2 mounting screw holes.

I then bolt the housing in place and colour in the inside with a sharpie.

I remove the housing and repeat for each of the required connectors, I then remove the template and carefully expand the marking depending on the type of connector going in.

If the connector is to be female, I make the opening a little larger, this is because the male connector has a screen that comes around the outside of the female connector, the larger opening stops the backing material from holding the connector out.

Using a drill I remove as much material as possible and finish the edge by hand with a small file.

Step 3: Wiring

Using the wiring diagram above we can create a straight through connection to interrupt the cable but maintain comms with the main computer.

However, tapping off the TX line from the slave (PLC in this case) we can create a monitor output as well. We use a diode and a resistor to protect the comms network from crosstalk (no more than one master) and the resistor protects against an excessive load.

Step 4: Test

I have tested this device and the monitor machine can see data coming from the PLC to the master SCADA system, the new system cannot send data to the PLC as the setup described is Half-Duplex (one-way comms). Also, the new (monitor) SCADA system does not take part in a handshake with the PLC so without the master, no comms will initiate.

Be sure to mark the com and the monitor as connection to the wrong ports will prevent proper operation of your devices.

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest

    5 Discussions

    0
    None
    bill1959parker

    Question 8 weeks ago on Step 4

    Hi as you obviously know about serial communication I wonder if you could please answer a question for me. I have a radio scanner that I control with a windows program with a D9 serial cable. The radio antenna is on the other side of my bedroom and I am disabled and have to spend a lot of time in bed so I want to know if it is possible to use HC-05 or HC-06 bluetooth modules to transmit and receive the serial from my laptop to my scanner? If not do you know of a simple way of doing this?. I can then use my wireless headphones with the scanner with my laptop on my over bed table.
    Thanking you
    Bill

    1 more answer

    Hi Bill, transmission of serial over Bluetooth is fairly simple and there are lots of kits out there to do it. The only thing is you have to be careful to select the correct comms type: RS232 or RS485. It's really easy with 232, not so much with 485. The devices on each end are not really important, once the RX & TX are a paired system, as far as the devices will be concerned there's a cable in the middle. The easy easy easy option is a long cable...

    0
    None
    frarugi87

    1 year ago

    This works only when the connection is half duplex, right? Otherwise you will not be able to detect both channels..

    2 replies
    0
    None
    Left-field Designsfrarugi87

    Reply 1 year ago

    It depends on where you are looking, the main line is full duplex, the spy is half, this means that the spy cannot effect change on the target device but can see all the responses to the master pc's requests.

    0
    None
    Left-field Designs

    Reply 1 year ago

    Nice work, I've used these in the past, there is also a way to set them up to look at the half duplex in each direction. I don't need it here and I only have one serial port to do it on this machine. Maybe with a brainbox or something similar I will run at monitoring both directions.