RS-485 is a 2-wire interface, right?

WRONG! Ok, maybe it is, but that depends on how you count the wires. Over time, we have gotten many tech support calls from people whose RS-485 wasn’t working. The problem applies equally to Modbus RTU and BACnet MS/TP. The caller usually informs us that they’ve tried different baud rates and tried everything they can think of. The one thing they did not try was hooking up the rest of the wires. You need a signal ground!

The “2-wire interface” does NOT mean 2 conductors!

The popular reference to “2-wire” goes back to the days when RS-422 was more commonly used than RS-485. Data flow is full duplex with RS-422, and half duplex with RS-485. In order to operate at full duplex, 4 data lines are needed rather than 2. Therefore, these became known as “2-wire” and “4-wire” interfaces. But neither one of them will work without signal ground (or zero volt reference).

What is on those 2 wires?

The 2 wires being referred to any time you hear “2-wire” are the data lines. Both of them are data. Neither of them is signal ground. 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 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…

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 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 is common mode voltage?

Common mode voltage refers to the voltage potential between grounds of two different devices or systems. Your “ground” is most often not at exactly zero volts. There are a variety of reasons beyond the scope of this write-up why ground is often not zero volts, but magnetic fields picked up by wiring is one of them, and line loss in wiring is another.

If you want to measure common mode voltage, you can use a standard volt meter. Put one probe on ground of one device, and the other probe on ground of the other device, and see what you get for voltage. The worst case we ever actually observed was about 270V between grounds of two systems. A 22 gauge signal ground wire was not going to fix this problem. 

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 opto-isolators. 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. 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.

You might also need “line bias”.

The need for line bias really has nothing to do with RS-485 standards, but is required by almost all devices. Here is why: 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.

When no RS-485 device is transmitting, the line sits there in an indeterminate state. When a device puts its transmitter online to talk, the line is immediately driven to levels that represent a logic state, namely a state that represents the absence of a data. Then after a short delay to allow the line to stabilize, the first character begins transmission, beginning with the start bit that marks the beginning of every byte or character on an asynchronous serial data line.

Since the line state is indeterminate when no transmitter is driving it, the transmitter going online can often be translated as a start bit but in this case it is a false start bit. In most cases, the real start bit comes along sooner than 1 character time later. If the false start bit was followed by silence for one full character time, then the UART would time out and see this as an error. But most of the time, the device getting ready to send does not wait that long between putting its transmitter online and sending the first byte or character. Therefore, the false start bit results in the UART getting out of sync, and now at least the first valid byte of data is missed. Missing just one character in Modbus RTU or BACnet MS/TP results in a checksum error on the data packet and the entire packet is now discarded just because of one false start bit.

The solution to the problem is line bias. This consists of two resistors on the lines, one biasing the positive data line to positive DC voltage, and the other biasing the negative data line to signal ground. The line is no longer in an indeterminate state when nothing is transmitting. It is as if somebody always has their transmitter online, but because these are resistors providing a bias rather than an actual transmitter, any actual transmitter that comes online has no trouble overriding these. The line bias resistors do represent a load on the line, so do take away from the number of RS-485 devices you can support. Line bias typically represents 6 to 12 unit loads.

Do not turn on line bias at more than one point on the network. While line bias may save the day and get the network running, overpowering the network with too much line bias will still leave you with a non-functioning network.

Line bias is selectable via jumper settings inside most Control Solutions products, and is often available in some form in many other manufacturer’s products as well. Refer to Control Solutions’ knowledgebase for articles on selecting line bias for specific models, or refer to the user guide for that product.

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 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 backwards. 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 standard answer is 32, which refers to 32 unit loads, the required drive capability for any RS-485 transmitter. However, many devices these days using more updated transceivers represent 1/2 or 1/4 or even 1/8 unit load on the network. Therefore, if your devices are all 1/8 unit loads, and you do not have line bias turned on, you could run as many as 256 devices (which of course exceeds the valid address range of both Modbus RTU and BACnet MS/TP). The Control Solutions Babel Buster 2 family of products all use transceivers that represent 1/8 unit load in receive mode, but will drive 32 full unit loads in transmit mode. Even with line bias turned on, you should be able to support as many as 160 devices if they are all 1/8 unit load. 

What does it mean when Control Solutions says its RS-485 ports are “hardened”?

The RS-485 transceiver is easily blown by static, especially when connecting wires for the first time, without any protection. Therefore, static protection is the first ingredient. We also learned that one of the most common wiring errors is to reverse data and power lines. Connecting the 24V power supply across the data lines of any traditional RS-485 port will result in the transceiver chip giving off a puff of smoke and that’s the end of the transceiver. All of Control Solutions’ newer RS-485 devices include voltage clamps and self-resetting fuses that will effectively disconnect the port when data lines are connected to power instead. It will automatically reconnect when the incorrect wiring is removed. This feature is included anywhere you see “hardened RS-485 port” on the Control Solutions product data sheet.

The voltage clamp and fuse combination will protect the RS-485 device against incorrect connection to the 24V (AC or DC) power commonly found in building automation installations, and the hardened data lines will withstand connection to 24V power indefinitely. The protection is rated for a maximum of 60V. The data lines will not survive connection to 120VAC (and neither will the power input on a 24V device).

Don’t wait until you are in the field to learn something new!

Once in a great while, we get a call from a frustrated technician in the field who has been tasked with starting up a network gateway. There is one little problem: That technician has never worked with this network protocol before and knows nothing about it. Out in the field is not an ideal place to start learning. If you have never used the protocol before, we highly recommend  starting back at the shop with a simple network consisting of just a couple of devices on your bench.

Don’t go for broke, start simple!

We sometimes find ourselves helping somebody who has created a huge configuration while making some incorrect assumptions all along, resulting in a huge incorrect configuration. If you have not used a particular gateway before, start simple just to be sure you are on the right track. Map just one Modbus register or just one BACnet object, and see that it works. Then continue on to configuring the rest of the items on your list. If there are problems with either the configuration or the network connection, those problems are much easier to trouble shoot with just one register or object mapped so far.

Do you have questions about the protocol?

This page is just about RS-485. We have additional pages about the protocols. Refer to the protocol tutorials found in the same Support menu that took you to this page about RS-485. The protocol tutorials talk about things like Modbus function codes, Modbus register types, BACnet object types, etc.

Still having problems? Contact tech support.

Here is the checklist of things we will ask you about if it seems the problem is connection related:
__ Signal ground
__ Data line polarity
__ Baud rate, stop bits, parity (always N81 for MS/TP, not selectable)
__ Line termination
__ Master/slave configuration - only one master allowed on Modbus RTU
__ All devices have unique addresses
__ Line bias
__ Device configuration

Of course, there is a lot more to getting a network gateway working than just the RS-485 connection. We have an assortment of user guides and how-to videos available for learning more about network gateway configuration. Start there if you are new to network gateways.