About "RS-485 / Modbus RTU"

About

Modbus is a serial communications protocol. Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices. The main reasons for the use of Modbus in the industrial environment are:

  • developed with industrial applications in mind,

  • openly published and royalty-free,

  • easy to deploy and maintain,

  • moves raw bits or words without placing many restrictions on vendors.

Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a controller/monitoring unit.

Protocol versions

At the moment Vutlan supports the following Modbus versions:

Modbus RTU — This is used in serial communication and makes use of a compact, binary representation of the data for protocol communication. The RTU format follows the commands/data with a cyclic redundancy check checksum as an error check mechanism to ensure the reliability of data. Modbus RTU is the most common implementation available for Modbus. A Modbus RTU message must be transmitted continuously without inter-character hesitations. Modbus messages are framed (separated) by idle (silent) periods

Communications and devices

Each device intended to communicate using Modbus is given a unique address. In serial and MB+ networks, only the node assigned as the Master may initiate a command. On Ethernet, any device can send out a Modbus command, although usually only one master device does so (Modbus TCP/IP will be supported by Vutlan in the coming future). A Modbus command contains the Modbus address of the device it is intended for (1 to 247). Only the intended device will act on the command, even though other devices might receive it (an exception is specific broadcastable commands sent to node 0, which are acted on but not acknowledged). All Modbus commands contain checksum information to allow the recipient to detect transmission errors. The basic Modbus commands can instruct an RTU to change the value in one of its registers, control or read an I/O port, and command the device to send back one or more values contained in its registers.

RS-485

RS-485 is used as the physical layer underlying many standard and proprietary automation protocols used to implement Industrial Control Systems, including the most common versions of Modbus.

RS-485, also known as TIA-485(-A), EIA-485, is a standard defining the electrical characteristics of drivers and receivers for use in serial communications systems. Electrical signaling is balanced, and multipoint systems are supported. The standard is jointly published by the Telecommunications Industry Association and Electronic Industries Alliance (TIA/EIA). Digital communications networks implementing the standard can be used effectively over long distances and in electrically noisy environments. Multiple receivers may be connected to such a network in a linear, multidrop bus. These characteristics make RS-485 useful in industrial control systems and similar applications.

RS-485 transmits digital information between many objects. RS-485 is designed to transmit this information over considerable distances, and 1000 meters fits well with its capabilities. The distance and data transfer rate with which RS-485 can be used successfully depends on many points in developing the system interconnect layout.

The RS-485 differential line consists of three pins:

  • Data A , which is low for logic 1 and high for logic 0.

  • Data B, which is high for logic 1 and low for logic 0.

  • Signal ground aka GND aka COM aka reference pin.

Connecting Modbus devices

The total cable length should not exceed 1200 meters. The last devices in this chain must be terminated with a 120 Ohm resistor (The resistance of the twisted pair cable). Make sure both resistors are connected to the terminals correctly. The MODBUS specifications call for termination resistors (120 to 150 ohms, 0.25W) on both ends.

RS485 or Modbus do NOT allow star or stub connections. See picture below:

All the devices must be connected in one line in a daisy chain one after another (MOST RECOMMENDED). Main Vutlan monitoring unit may be placed in the beginning or in the middle of the chain.

or with branches from the main line. Each branch has to be as short as possible (LEAST RECOMMENDED).

"VT85 / Modbus extension board" is used to connect Modbus RTU devices for VT325, VT335 S, VT335S DC, VT805, VT825, VT825 DC. The extension board is ordered separately.

VT900 and VT960 units use "RS485 to USB adapter" to connect Modbus RTU devices. "RS485 to USB adapter" is ordered separately.

Read more at:

Questions and Answers

What are the data wires?

RS-485 is a differential signaling method. What this means is that the same data is transmitted on both wires, but in exact opposite polarity. When there is logic 1 on one wire, there is logic 0 on the other, and this happens at a fast rate (the baud rate). By running these two opposite signals on a twisted pair of wire, high data rates at long distances can be achieved because any noise induced into the lines is induced equally in both of the opposite polarity signals and therefore cancels out.

Why do I need a signal ground?

You need a signal ground or reference because data is being transmitted by electricity (switching very fast), and electricity always needs a return path in order to function. Data transmission needs a return path just like anything else running on electricity. This is why the battery in your car or truck has 2 posts. You already know how quickly your car or truck is going to start with only one battery post connected. Your data transmission isn’t going to start any faster without a complete circuit.  

But my cable is shielded, and it is grounded at one end…

A cable shield does not constitute signal ground! If you connected the shield at only one point, congratulations on doing a nice wiring job. But you do not have a signal ground if a third conductor is not connected at both ends. If you are counting the shield as a conductor, then you need a total of four conductors.

Why does it sometimes work with 2 wires?

It worked on my bench but doesn’t work at all in the field. Why?  Well, just because you can’t see signal ground doesn’t mean it isn’t there. If the equipment has a common ground through nearby power supplies, then 2 wires will often work for RS-485. With no ground at all, RS-485 will sometimes work for short distances, although usually unreliably (or just reliable enough to fool you). What is happening in this instance is that the RS-485 transceiver chip is inventing its own “virtual” ground path through currents within the semiconductors that make up the transceiver chip.

The RS-485 transceiver will function with its “virtual ground” provided no more than just a few volts of common-mode voltage are present. Beyond just a few volts, the limits of the transceiver’s ability to create its own virtual ground are exceeded. The actual specification for common-mode voltage that the RS-485 transceiver chip will tolerate is specified in the chip manufacturer’s data sheets. But for all practical purposes, in the interest of reliability, call it zero because it’s pretty close to zero anyway.

What about ground loops created when you connect signal ground?

Ground loops are definitely a problem. If the common-mode potential is large, the ground loop current will also be large. And if the ground loop current is large, something is going to turn into a fuse. If it isn’t the wire, it will be a trace on a circuit board somewhere. (Circuit boards usually blow faster than wire.)

To limit the ground loop current, the TIA/EIA-485 specification recommends a 100-ohm resistor in series between each signal ground connection. This will provide a signal ground sufficient to overcome common mode potential differences well enough for RS-485 to work in most cases while limiting the ground loop current. However, if common-mode potential is large enough, this 100-ohm resistor is now your fuse.

How do you solve the signal ground problem with large common-mode potentials present?

There is only one answer: Optically isolated RS-485 repeaters. The repeater has 2 data lines on each side. Each side has its own signal ground connection as needed for reliable data communication with that side of the repeater. Internally, the repeater requires two isolated power supplies, although one is usually generated internally with the use of a transformer having a high isolation rating. The data is transmitted through optoisolators. Isolation ratings on these repeaters are usually in the 500 to 2000 volt range. That means the common-mode potential between the grounds on either side can be as high as 500 to 2000 volts and your data will still get through.

What does proper wiring for RS-485 look like?

We won’t get into wire specifications here - the wire manufacturers publish plenty of data on wire versus data transmission rates versus distance. The point we are emphasizing on this page is the simple fact that most failures to communicate are due to lack of signal ground. Here is a functional diagram of what RS-485 should look like.

What kind of cable do I need?

Most importantly, it must have a twisted pair for the two data lines. You will not achieve the noise cancellation that RS-485 was intended to provide if you do not use twisted pair. Since a single twisted pair with a third single conductor is not a configuration readily available, the most practical approach to providing the necessary wiring is two twisted pairs.

Most recommendations specify shielded cable. The shield helps protect your signals from picking up stray noise from nearby wiring and other electrical equipment. The shield will provide little benefit just on your bench or for short runs with no other equipment around, but its value goes up as exposure to sources of noise goes up.

The gauge of wire is typically 22 gauge or something close to that. The gauge number itself is not important. What is important is keeping both resistance and capacitance as low as possible. The longer the network will be, the more important it is that you use good quality wire. The wire manufacturers have wire designed specifically for data networks.

How do I connect multiple RS-485 devices to the same network?

The most important restriction to pay attention to is that you absolutely cannot connect things randomly, nor can you connect devices in anything other than a strict daisy chain. While multiple devices connected haphazardly on the bench will work, when you put some distance between the devices, they will fail to communicate if not connected via a strict daisy chain.

You will often see reference to “keep stubs short”. The “stub” refers basically to cheating on the daisy chain. The proper daisy chain is nearby, but you run a short single line between the daisy chain and the device - this is a “stub” or tap. This line must be kept short, preferably avoided altogether. The exact math for calculating the maximum stub length is one of those things best left to a PhD. Recommended math is simple: Length = 0.

What is “termination” and do I really need it?

Yes, you need it, although most things will work without any termination for short distances, like on your workbench. In the field, it is needed and must be located at both ends of the line and only at the two far ends of the line. Typically this termination consists of a 120-ohm resistor between the two data lines at each end of the line.

The termination is required to avoid reflections on the line. Think of tossing a pebble into calm water near a stone wall. When the ripples hit the wall, they bounce back toward where the pebble was tossed in. Data on a long unterminated transmission line will do essentially the same thing. When the reflection comes back to a point where something is trying to listen to the line, the receiver will see both original data and reflected data, and the receiver will quickly get confused and end up with garbled data. The garbled data will get tossed out since it does not pass framing and/or checksum tests. The result is the appearance of “no response” since Modbus RTU and BACnet MS/TP devices are required (by protocol) to keep silent when they do not recognize something on the line.

Line bias.

Without line bias, most standard UART devices are fooled into thinking there was a start bit when all that really happened was that a device put its transmitter online in anticipation of sending a start bit soon. "VT85 / Modbus extension board" has a built-in Line Bias which is always switched ON.

What else can go wrong? Check your signal polarity.

Both the RS-485 chip makers and the RS-485 specification (TIA/EIA-485) refer to the two data lines as A and B. The interesting thing is, the chips and the protocol specification have A and B designations applied to a polarity opposite each other. Therefore, if your data connections are labeled A and B, there is a good chance they are incorrect. It depends on whether the design engineer was looking at the chip specification or protocol specification when he/she put A and B on the drawing. To avoid this confusion, many devices have data marked with “+” and “-“ included in the signal notation, and A and B are avoided altogether.

If you are uncertain about data line polarity, and assuming everything else is correct, simply try swapping the data lines to see if your devices start communicating. You will do no damage to the devices with reversed data lines. They simply will not communicate if backward. While things will typically work on your bench without line termination or proper wiring, reversed data lines are one thing that will result in not working even on your bench.

You can have only one Modbus RTU Master.

The “MS” in BACnet MS/TP stands for Master/Slave. For MS/TP, all devices take turns being master and slave, and there is no contention for who is master. The only requirement is that all devices on the network must have unique MAC addresses (or station IDs), and all devices must have unique device IDs.

Modbus RTU is also a master/slave polling scheme, but there can be only one master on the Modbus RTU network and all other devices must be slaves. Furthermore, each slave must have a unique slave address to avoid multiple slaves responding at the same time (thereby corrupting responses from both).

A limited number of devices are on the market which support “multiple Modbus RTU master” schemes. These devices are playing tricks, typically with intelligence that is receiving the multiple master requests, then multiplexing the retransmission of the requests to the slaves. Another trick that works only when all of the Modbus masters are sourced by the same manufacturer is that the masters know about each other and take turns on their own. But this is completely non-standard and does not apply to the other 99.99% of Modbus devices on the market. If you think somebody has found the loophole for beating the single-master protocol restriction, forget it. You will not succeed in placing multiple Modbus masters on the same network without spending money. (You can have multiple masters in Modbus TCP, but that is a completely different topic.)

How many devices can I have on an RS-485 network?

The maximum number of controlled devices is 32. But we advise connecting no more than 16 to spare due to processor limits.