It’s old and of no use. Nobody wants it around anymore. No, that’s not what they’re saying about me around the office. [At least I hope not].
I’m talking about serial communication. Remember that? RS232? RS485? If you’re more than 30 years old you remember PCs with RS232 serial ports. You had to get the lines connected right. Remember the days of null modem cables? Connect the Tx to the Rx and the Rx to the Tx. Sometimes you had to connect the CTS to the DTR. You were never quite sure. You played with the baud rate, parity and wiring for about 2 days until you found the right combination.
The best tool for that nonsense was a breakout box. That’s a box where you can easily rewire serial interfaces. I remember all my serial breakout boxes fondly. I spent many a night with my breakout boxes.
Recently I did a couple of YouTube video on serial communications. In the first video I talked about mechanics of serial communications; what a UART is, how bytes become bits on the wire, how bits are framed into bytes and how they moved along the wire. In the second video I took it a little further and discussed the differences between RS232 and RS485.
These ideas for these videos came from an automation engineer in Egypt, Mustafa Salah. Mustafa always asks a lot of good questions. As with many people around the world Mustafa still deals with lots of serial communications and the problems implementing and troubleshooting those kinds of communications in automation systems.
Mustafa reviewed the two videos and sent a few good questions; questions that need to be discussed so I am going to take some time here to address his questions.
Question: RS-485 Noise suppression. I understand that the RS-485 is differential but how can this affects the noise suppression?
Answer: The key is that RS-485 is differential. A bit is detected by the voltage difference between the two RS-485 lines. If that potential is 5 volts, as it is in typical RS-485 systems, and there is a 10 volt spike due to some machinery, both lines are affected by the noise. The key idea is that the difference in potential is still 5 volts. Relative to a ground line, they may have been at 5 volts and zero volts prior to the spike. During the spike they are at 15 volts and 10 volts; but still with a 5 volt differential that can be properly recognized by the receiver. That is why RS485 is much more noise immune than the ground referenced RS232.
Question: How do you do RS-485 echo suppression?
Answer: One of the electrical characteristics of RS-485 is that bit signals are reflected when they reach the last node of a multi-node network. The reflected signals screws up the next bit signal transmitted by the transmitter and it becomes impossible to communicate. To eliminate echo suppression it is important to have a 120 ohm terminating resistor at both ends of the RS-485 network between the two signal lines. That 120 ohm resistor dissipates the signal and prevents the echoing. Sometimes software enables that resistor.
Question: How do I connect multiple RS-485 networks together (I mean in case I have more than 1 network)?
Answer: The short answer is that you probably don’t. An RS-485 network is a half duplex network. That means that there is one and only one transmitting device at a time. There are two ways these networks can operate. In one mode, they have a Master device that transmits and the other devices listen and respond when spoken to by the Master. That’s the way that Modbus works. If you have a network like this you aren’t going to connect it to another network because you’d then have two masters and there isn’t a way for the two masters to take turns talking.
The other way these networks can work is by some sort of time sharing arrangement where there is a token passing arrangement where each the node with the token is the temporary master. This is pretty uncommon because there have to be ways to detect nodes that have gone offline, inserting of new nodes and lots more. DH485, the Rockwell network that SLC processors used for a long time uses this kind of token passing.
Question: What serial topologies are used?
Answer: There are really just two; point-to-point and multi-drop. RS232 uses point-to-point. The Tx of the first device goes to the Rx of the second device. The Tx of the second device goes to the Rx of the first device. In Rs485 it is a little more complicated but not much. The two wires of RS485 sometimes labeled A and B or A and A’ or whatever are just multi-dropped from one node to the next. The terminology is not standard here but the high side line is wired from one node to the next to the next. The same is done for the low side line. The key idea here is that internally, the node that transmits turns off its transmitter when the last bit goes out and immediately turns it receiver on so that get the response message.
I’ve run across other ways of wiring RS485, like wheel and spoke, and they can work but you should avoid them. They’ll work in limited circumstances depending on the number of nodes connected, the kind of wiring you use and lots of other things. You’re asking for trouble if you don’t use multidrop with RS485.