Modbus, a widely used protocol for many sensors and devices, often operates over RS485 to lower the cost of implementation. By spec, everything looks relatively straightforward, and the ability to connect tens, if not hundreds, of units on the same bus seems just within reach.
Sadly, things are not as straightforward as they first seem, and we are often asked why a certain implementation is not working. Even customers who have set up test systems in their labs, which worked well, have returned with questions when their actual implementation behaved differently.
So, we have created this primer on Modbus over RS485 to point out some of the possible pitfalls and points of consideration during system design. This article will use our BP sensors and Tibbo Project Systems (TPS) as the system's sensors and controllers.
Consideration #1 - RS485 Signals
Many designers and engineers usually get confused about how the RS485+/RS485- is named. Even some manufacturers name them backward. Here is what the standard signals are named:
RS485+ | D0 | A | D+ |
RS485- | D1 | B | D- |
Consideration #2 - Power
The BP sensors can operate with 5V and 12V power, which is quite standard. This means that we could power the sensors through the 5VDC output on the Tibbit#05. However, the available power is limited by the power in the whole TPS system. Using Cody, when you configure the TPS, you will be able to see how much power is used and how much power is still in reserve. This is the power available to the powering of the sensors.
By spec, if we take BP#04, for example, the average power consumption is 2.5mA, and the spike is 6mA. However, due to distance and cabling, we would recommend counting each unit as 10mA. So, in theory, in a 32-sensor system, the 32 BP#4 will use upwards to 320mA.
In long runs of cable, we suggest using an external noise-free 12VDC power supply, as it will provide a more stable system that allows for stronger signal swings.
Consideration #3 - Topology & Termination
On an RS485 bus, each device is piggy-backed from the previous device. So, there will always be a beginning and end device. This does not mean that the Modbus Master will always be at one end as physically the Modbus Master could be anywhere on the physical bus chain.
Signal reflection might occur over a long length of cable and cause noise that affects the reading of data on the line. It is suggested that the two devices at the physical ends should be terminated with a 120-ohm resistor. However, the more precise way is to calculate the actual value based on the characteristic impedance of the cable used. This is outside the scope of this article, but we will leave a reference link at the end if you are interested in digging deeper.
Consideration #4 - Cabling
Always use a shielded twisted-pair cable for better signal clarity. The safest option is to purchase cables specifically designed for RS485. The stub for each node should be kept as short as possible to reduce the chance of signal reflection.
Consideration # 5 - Grounding
When it comes to grounding, there are very complicated scenarios based on each system. In the RS485 standard, you do not have to connect the ground of the master or system to the ground of each node. Only connecting D+/D- is theoretically enough. However, in some cases connecting the ground would unify the common voltage levels between signals and might increase the reliability of the system. Having that said, there should be special care to ensure that the grounding, shielding of the cable and earthing of the devices work to avoid safety issues and improper ground loops.
Generally, if the entire system allows connecting ground between master and slaves, it can reduce the noise. Connecting the shield of the cable to the ground line in case the system does not have any earthing can help as well.
Consideration # 6 - Baudrate, delays, timeout, and response time
As a general rule of thumb the longer the total cable length the lower the baudrate should be. The conservative calculation that should always work is:
Line-length (m) x Data Rate (bps) < 107
If you have a system with more modern devices that have faster response time, you could experiment with increasing the baud rate. The above calculation should work with most older devices still on the market today.
Reference: The RS-485 Design Guide (Rev. D)
Comments
0 comments
Please sign in to leave a comment.