2751 Antelope Road, Sabetha, Kansas 66534

Modbus observations and tips

Hello readers, this is Justin back for another installment of Automation from our Angle. This month’s topic is Modbus, a serial communication protocol developed for use with programmable logic controllers (PLCs). While the Modbus communications protocol is not a new technology (developed in 1979), it has been a significant development area at NorthWind during the month of February. This post will focus on the observations and tips about Modbus that have helped me over the past month of working with it.

First and foremost, as with almost any communications network, check your wiring. Modbus is designed to communicate over a two wire RS232 or RS485 serial network. For RS485, getting a network working is often a difficult exercise requiring lots of troubleshooting, and perhaps a bit of luck. It is important to note that RS485 networks should be designed with three wires in mind, not two. The third conductor nerves as a common reference signal against which the other two (positive and negative) wires’ voltage is measured. Without this third wire you risk an unstable RS485 network or potentially blowing ports.

In addition to the three wires, you need to check terminations at each device. In my experience, manufacturers will identify the positive and negative Modbus connections with varying designations. The most common designation I have seen is the A/B designation for positive and negative connections, with some manufacturers using A for the negative line and others using it for the positive line, and vice versa for B. It is important to read each device’s specifications carefully and always keep track of your positive and negative lines.

The terminating resistor can be an invaluable tool in troubleshooting your Modbus wiring, as long as you know your network layout. While several Modbus network layouts do work, the most common and most stable is a “daisy chain” from device to device, with the last device using a terminating resistor to signify it as end of line, and some devices even include this in their Modbus configuration menu. Troubleshooting a daisy chained network can be difficult at best. A break somewhere in the line is going to affect every subsequent device on the network. Thankfully, you can move your terminating resistor between devices in the RS485 network and effectively isolate these bad connections. If you know your network, you can use this as a tool to help you track down bad wiring, terminations, or device configurations.

Lastly, check and recheck your device, network, and message configurations. Modbus is a Master-Slave communication network that requires each Slave on the network to be identified with a different ID. Two slaves with the same ID on the same channel will make your network unstable. Additionally, a difference in parameters such as baud rate and parity between the Master and Slave will make communications unstable or impossible. You should also avoid overloading a single RS485 channel. RS485 is based on using 32 devices per channel. If you add more without a repeater, your devices may start dropping off the network. Finally, check your message structure. This documentation should typically be provided with your device. A program like Wireshark, CAS Modbus Scanner, or gateway specific software can be invaluable in troubleshooting your Modbus messaging.

Modbus over RS485 can be difficult to troubleshoot on both the hardware and software sides. It is important to know your wiring, your network layout, and your network configuration. With these and the tips above, the troubleshooting process can become much easier.

Check out this link for more information:
Chipkin, Peter. (2010) Modbus for Field Technicians.