Best Practices for RS-232 Serial Control
While it seems preferable to control equipment over a network interface, many devices are better controlled, or can only be controlled, over an RS-232 serial connection.
When is RS-232 better than a network connection?
- Sometimes when a device is powered off, the network interface is also powered off, making it impossible to power on the equipment over Ethernet.
Sometimes due to the maturity of the product and the maturity of the RS-232 interface, RS-232 may offer more reliable communication than a network interface that hasn’t been used as much for long-term control.
Sometimes RS-232 is the only bi-directional control interface that is available and is much better than one-way infrared control, particularly in displays or other products.
For devices that we want to control over RS-232, we recommend using an IP-to-serial adapter, such as the IP2SL-P from Global Caché (the -P means it supports power over Ethernet). See our integration guide for how to set up and use the IP2SL. The IP2SL allows a device on a network, such as our Mira Connect AV control system, to send commands and receive status from a device that has an RS-232 interface.
A typical system with an IP2SL is shown in the following figure. Mira Connect and the IP2SL are connected to the network, and the IP2SL device is connected to the equipment using an RS-232 cable.
If you are using serial control, follow these best practices so you can save time and minimize troubleshooting while on site.
Best Practice #1 – Set the same baud rate on the IP2SL and the equipment
Know what baud rate (sometimes also called bit rate) the device can use, or is set to by default, and make sure you’ve set the same baud rate on the serial to IP device.
If the baud rates do not match, there will be no communication between the controller and the device to be controlled. For example, the RS-232 port on most video displays default to 9600 baud (approximately 9600 bits/second), while the default baud rate on the GlobalCaché IP2SL is 19,200. Without changing the baud rate on the IP2SL, there will be no communication. See our integration guide for how to set the baud rate on the IP2SL using its web interface.
Having different baud rates set for controlling a device is the number one problem you will have with serial control and is easy to avoid by reading the equipment manuals, our integration guides, or configuring the devices.
Best Practice #2 – Use the correct cable pin-out
Many devices with serial ports use a DB9 (9-pin) connector and often only use three pins: receive, transmit, and ground.
Typical DB9 connectors with male (left) and female (right) on a straight-through serial cable.
A male DB9 connector on a equipment will typically transmit data on pin 3 and receive data on pin 2. This device is commonly referred to as a DTE device. DTE stands for Data Terminal Equipment and historically was a computer terminal that was sending information to a communications device such as a modem.
A device with a female connector will typically transmit data on pin 2 and receive data on pin 3 and is often called a DCE device. DCE stands for Data Communications Equipment – common language when modems were everywhere.
The Global Caché IP2SL has a male DB9 connector on it and is considered a DTE.
If you are connecting devices that have different connector genders, then you typically will need a straight-through cable as shown in the following figure.
If you are connecting devices that have the same gender of DB9 connectors, such as connecting two DTE devices together, the cable will typically need to connect pin 3 on one end to pin 2 on the other end, and pin 2 on one end to pin 3 on the other end to ensure the transmitted data is received on the remote device and vice-versa. This is a cross-over cable as shown in the following figure.
Having the wrong pin-out on the cable is the next most likely problem you will face with serial control. Knowing the right pin-out requires reading the documentation of the product to be controlled or our integration guides.
Some alternate pin-outs we’ve seen used with equipment over the years are shown in the following figures. Before using these pin-outs, check the documentation (or rear-panel) for the product you are controlling to confirm!
Best Practice #3 – Confirm operation
Once you set the baud rate of the IP2SL to match the device and have the proper pin-out for the cable, you will be able to communicate with the device. When using Mira Connect, you will see the connection status change from red triangle and “Connection Failed” to showing the green circle with a check mark as shown in the following figure.
Mira Connect constantly checks that a valid connection is possible, so once the cable and baud rate are set properly, the connection status will update automatically.
If you are not using Mira Connect, you can open a terminal program and enter the IP address of the IP2SL using port 4999 and send a device-specific command. On Windows-based computers, PuTTY is a very useful terminal program.
For a Sharp Aquos display, you can send a power query: POWR???? followed by a carriage return. If the baud rate and cable are correct, the system will respond with 1 or 0 depending on whether the display is powered on or off. If there is no response, re-check the baud rate and cable.
Best Practice #4 – Document the cable pin-out
When using existing cables, or especially when building your own, you should have a multimeter tool to test continuity between pins on both ends of the cable. Set the meter to the continuity mode and use one probe on each end of the cable to probe each pin.
If your multimeter probe won’t fit into the female connector, you can use a paperclip or strip a piece of wire from an ethernet cable conductor and stick that into the socket and hold the multimeter probe against that cable.
Knowing that pin 2 is connected to pin 2 and pin 3 to pin 3 tells you that the cable is a straight-through cable.
Write down the pin continuity info (pin 2 to pin 2, pin 3 to pin 3, etc.) in case you need to review or document later.
Best Practice #5 – Carry null modem adapters
Because the documentation for most equipment may not specify the exact pin-out used, it’s a good idea to keep some null modem adapters in your tool bag so you can easily swap the transmit and receive pins.
A null modem is an adapter that has a male DB9 connector on one end and a female DB9 connector on the other end and connects pin 2 to pin 3 and pin 3 to pin 2. These are used to cross-over a straight-through cable or to turn a cross-over cable into a straight-through cable (by double crossing).
If you have a serial connection between devices that is not passing data and the baud rate is set correctly, you can add a null-modem to the cable and see if that solves the problem. Usually it does.
Null modems are especially useful when using a serial cable that has an unusual connector on one end, such as a 3.5mm (1/8 in) audio connector, RJ45 connector, RJ9 handset connector, or terminal block. Often the equipment’s documentation isn’t completely clear, so you may have to try it with and without a null modem.
Serial connections are still often used to control devices, and with an IP to serial interface, you can control these devices over the network. Ensure that you are using the proper baud rate and that your cable is pinned out correctly, and you’ll save yourself a lot of time on site.
While building a cable on site seems to offer the most flexibility, having pre-made cables can save you time and money during troubleshooting and provide a sanity check when you are trying to troubleshoot connectivity issues. Purchase a few pre-built cables (they are inexpensive), and keep them handy for when you need one. Testing the system with a pre-built cable can tell you if the problem lies with your custom-built cable or is somewhere else.
It’s also wise to keep some DB9 gender changers (male-to-male and female-to-female connectors), so you can always adapt your cable to the equipment you need to control. We hope that you find these best practices for RS-232 serial control helpful.