RS485 communication techniques

RS485

Introduction

RS485 is a physical layer communication standard typically used in automation systems as a way for sensors and other devices to communicate to a central automation computer.  It is also used in computer system peripherals for data communication between devices.  A couple examples of this are the Small Computer Systems Interface, or SCSI-2 and SCSI-3 interfaces for hard disk drives.  Different systems use different protocols as their defined standards outlining the "language" they will use to communicate to each other.   In this short article I will discuss data communication using an RS485 serial bus and the best practices for an error free signal.

What is RS485?

RS485 has sometimes been referred to as a protocol, which it is not.   It is simply a communications interface wiring standard.  Unlike RS232 serial which is used for point to point serial communications, RS485 is a standard used for multi-point serial communications.  RS485 communication is typically done at half duplex using two wires  handling both transmit and receive.  Full duplex operation can be achieved using 4 wires depending on signal and speed needs.  Below is a diagram of an RS485 serial bus showing the master node and slave nodes.
RS485 Bus Diagram
As can be seen in the diagram, there is the two data lines, or differential pair, where the master and slaves connect, and at the end of the differential pair is a series of termination resistors.  Because the wires are a differential pair, the termination resistors are used to prevent reflections of the signal from back-feeding on to the line and causing collisions.  An RS485 network should only have termination resistors at the beginning and end of the transmission line.

The communication

Data transmitted on an RS485 bus can be heard by all nodes connected to that bus.  Because of this, a protocol is used to determine how that communication is managed.   The protocol must define a system for how data is transmitted, how a node knows that the data is meant for that node and how that node responds to the data it receives.  There have been a number of different protocol standards used in RS485 communication, with one of the most notable standards being the Modbus protocol.

RS485 interface types

RS485 USB Interface

There are many different types of RS485 interfaces on the market.  One is a USB type interface as seen on the left. This type will allow you to use a laptop or desktop PC as a master device, or a slave node on the network.  Another type such as the interfaces shown below are typically used to connect to a micro-controller such as an Arduino or a PICAXE, or small credit card size computers like the Raspberry PI or Beaglebone Black.  Interfaces such as the ones below typically come with the termination resistors integrated on to the board and may need to be removed if being used as slave nodes in the network.Microcontroller RS485 interfaces

RS485 bus setup

In an RS485 topology, the network is designed as one single line with multiple drops, or slave nodes.  As mentioned previously, termination resistors are put in place at both ends of the line to prevent signal reflection.  When termination resistors are not used, signal reflection can distort the signal on the line to the point of causing data loss or corruption.  These reflections are more noticeable on longer runs because the length of the pulse is long enough for the full pulse to make it to the far receiving end.  Once it reaches the end, it is then reflected back causing ghost signals that can differ in phase by the time it has ended.  On shorter cable runs, the the delay of the reflected signal is short enough that the distortion may not affect things because the phase difference will be negligible.
RS485 bus termination
Termination resistors should not be used at the slave nodes as this will cause unwanted signal attenuation.  With too much attenuation the signal may get lost completely.  Therefore, on node adapters where termination resistors are in place by default, such as the ones pictured above, you may need to remove them if they are not acting as the end node.

Conclusion

RS485 can be a good way of connecting automation devices where wired connection between devices is critical in preventing drops in signal.  Following these simple rules for connecting the bus, the signal transmission between devices should be quite reliable.

Related Images: