Mysteries of Serial Communications
For those of us that think, breathe and talk Ethernet all day long it is sometimes hard to remember that serial communications is alive and well. And a lot of the new people coming on board are very, very unfamiliar with it.
If you’ve brought any high school or even college students around the plant lately they will be stunned to know that there was life before Ethernet. Serial, what’s that? There was a 9 pin connector on laptops and PCs? What was that for? What is it? Why would anyone use serial?
The “Serial” in serial communications refers to the fact that bits are put on the wire one after another. Now that’s hardly a revelation unless you live in the packet world of Ethernet. But even in that world bits are put on a wire one after another after another.
What we are really referring to when we talk about serial communications is sending bits on a low speed wire where groups of bits are framed into bytes and specific bit patterns are used to identify the beginning and end of those bytes.
Serial communication also refers to the electrical interface used to propagate those bits across the wire. The most common way to do that is with RS232, RS422 or RS485 electrical interfaces. These interfaces govern the voltage levels and wiring for communications between nodes.
RS232 is commonly used for point-to-point wiring; one node directly connected to another node. And more to the point, each transmitter connected to the receiver on the other node. RS232 typically uses + or -12VDC signals biased to a ground reference to send data from one node to another.
RS232 is ideal for small packets of short distance communication between two nodes where the speed of transmission isn’t of great importance. The disadvantages of serial communications are its lack of noise immunity and short distance. Because signals are referenced to a ground, any noise can distort the electrical signals and cause short term communication errors.
Ground loops are another problem with serial communications. If the ground potential between two nodes are different, current will flow from one node to another. We see this problem with our module that sends ASCII data into PLCs on occasion. The ground loops cause current to flow through the receiver and since these receivers aren’t designed for this type of current load and they burn out.
RS485 and RS422 are used to avoid some of the problems of RS232. Both RS485 and RS422 use differential signaling. Differential signaling means that the difference in potential between two lines is used to identify bits on the wire. The sender either creates a potential or eliminates the voltage potential. In one case the receiver detects a one and the other a zero. RS485 uses two lines to move data from a sender to a receiver while RS422 uses four lines.
There are two advantages of RS485 and RS422 are greater noise immunity and support for multiple nodes. Because a receiver only measures the potential between two lines, noise induces identical electrical pulses on both lines but doesn’t change the potential between the two lines. Essentially the noise is canceled out.
The ability to have multiple nodes is one of the reasons why RS485 and RS422 are used in serial communications networks like Modbus RTU. These networks rely on a single Master device sending data to a single slave and that slave responding.
RS485 is ideal for that. (RS422 less so since it requires more lines). A Modbus RTU Master sends data on the two data lines while all Modbus RTU Slave devices listen. The Modbus RTU Slave recognizing itself as the destination of the message now becomes the sender and sends the response. The Modbus RTU Master becomes a listener after finishing transmission to get the response from the Modbus RTU Slave. Transmissions like this are known as Half Duplex communications.
So even if you’re thinking, breathing and talking Ethernet all day long, remember two things. One, there’s an awful lot of serial communications around and it isn’t going away soon and two; all communications including Ethernet is at its heart serial.