RS-485 explained: wiring, termination and how the bus works
Short answer: RS-485 is an electrical standard for sending serial data over a twisted pair as the difference between two wires, which lets many devices share one cable over distances up to about 1,200 meters. It defines voltages and loads only; a protocol such as Modbus RTU runs on top. Most problems come from wiring: a missing terminator, a star layout, swapped A and B, or no common ground.
RS485 explained: differential signaling on a twisted pair, the A and B lines, termination and biasing, cable length against speed, and RS-485 vs RS-232.
This article covers what RS-485 defines, how differential signaling rejects noise, the A and B naming muddle, two-wire and four-wire buses, termination, biasing and grounding, distance against data rate, how it compares with RS-232 and RS-422, and how an IoT gateway reads an RS-485 network. It does not cover transceiver selection for a specific board, the electrical design of isolation barriers, or any particular vendor's register map.
RS-485 is a standard for the electrical side of serial communication. It sends each bit as the voltage difference between two wires in a twisted pair, so that electrical noise from motors and drives, which shifts both wires together, cancels out at the receiver. Because of that, one RS-485 cable can run for hundreds of meters through a plant and connect dozens of devices: energy meters, temperature controllers, variable speed drives, flow meters and PLCs. This article explains what the standard does and does not define, how the bus is wired, why termination and biasing matter, how far and how fast it goes, how it compares with RS-232 and RS-422, and how an IoT gateway reads the devices on it.
What RS-485 is, and what it is not
RS-485 was published by the Electronic Industries Association in 1983 and is now maintained by the Telecommunications Industry Association as TIA-485-A. The full name of the current document is long, and nearly everybody still calls it RS-485 or EIA-485.
The standard covers the physical layer only. It sets out the voltages a driver must produce, the voltages a receiver must recognize, the range of ground offset the parts must tolerate, and how much load each device may put on the line. It does not say anything about baud rate, byte format, addresses, message structure, error checking or who is allowed to talk when. Those come from whatever protocol runs on top of it.
That is why “Is RS-485 the same as Modbus?” is such a common question. Modbus RTU is a protocol, and RS-485 is the most common wire it travels over; the Modbus RTU article covers the protocol side. Other protocols use RS-485 too: PROFIBUS DP in factory automation, BACnet MS/TP in building controls, and DMX512 in stage lighting, among others. Two devices that both have an RS-485 port can only talk if they also share a protocol, a baud rate and a byte format.
Differential signaling: why RS-485 copes with noise
A single-ended interface such as RS-232 sends each signal as a voltage on one wire, measured against ground. Any noise picked up on that wire, or any difference between the ground at each end, adds straight onto the signal.
RS-485 uses two wires for each signal and drives them in opposite directions. When one goes up, the other goes down. The receiver ignores the absolute voltage on either wire and looks only at the difference between them. Noise from a nearby motor cable lands on both wires of a twisted pair almost equally, because they run so close together, so it moves both by the same amount and the difference stays the same. Twisting the pair also means each wire spends equal time nearer the noise source, which keeps the pickup balanced.
The numbers in the standard reflect that design. A driver must put at least 1.5 volts of difference across the pair when the line is fully loaded and terminated, and a receiver must decide correctly when the difference is as small as 200 millivolts. That leaves a wide margin for losses along the cable. Receivers must also work with each wire anywhere between minus 7 and plus 12 volts relative to their own ground, the common-mode range, which is what lets devices with somewhat different ground potentials share a bus.
The A and B lines, and why they get swapped
The standard names the two wires A and B. In its terms, A is the inverting line and B the non-inverting one, and the idle state, a logic 1, is when B is more positive than A.
Many transceiver makers label their pins the other way round, and some equipment uses D+ and D-, or Data+ and Data-, instead. The result is that A on one device is not always A on the next. Swapping the two wires does no damage; the devices simply cannot understand each other. When a new RS-485 link shows nothing at all, or only garbage, swapping A and B at one device is one of the first things to try, before anything more elaborate.
Two-wire and four-wire RS-485
The usual RS-485 network is two-wire, half-duplex: one twisted pair carries data in both directions, and only one device may transmit at a time. Each transceiver has a driver enable input, and a device switches its driver on only while it is sending, then switches it off so others can use the line. The time a device takes to release the line after its last bit, and the time the other side waits before answering, is called turnaround, and getting it wrong cuts off the end of messages.
A four-wire, full-duplex network uses one pair for each direction: the master transmits on one pair to every other device and listens on the other. It avoids turnaround but doubles the cabling, and it is less common in the field.
“Two-wire” is a slightly misleading name, because a reliable two-wire network needs a third conductor, a signal common that ties the grounds of the devices together. Without it, the ground offset between distant devices can drift outside the common-mode range, and the bus fails intermittently, often only when a large machine starts. Many cables for RS-485 have a twisted pair plus a drain or third wire for exactly this reason.
Wiring the bus: daisy chain, termination and biasing
RS-485 is designed as a single line with devices along it, a bus or daisy chain, and the trunk should run from the first device to the last without branches. Each device connects to the trunk with a stub that is as short as possible. A star layout, with separate cables running out from a central point, creates several cable ends that reflect signals back along the line, and it often works at low speed and then fails when the network grows or the baud rate goes up.
Termination. A twisted pair has a characteristic impedance, around 120 ohms for cable sold for RS-485. When a signal reaches the end of a cable that is not terminated, part of it reflects back and collides with the bits that follow. A resistor matching the cable’s impedance, normally 120 ohms, fitted across A and B at each of the two physical ends of the trunk absorbs the signal instead. Only the two ends get one. Fitting a terminator at every device, which happens when every device has a termination switch and they are all left on, loads the line so heavily that the drivers can no longer produce enough voltage. On short runs at low baud rates, termination matters less, which is why badly terminated networks sometimes work until they are extended.
Biasing. On a half-duplex bus there are moments when no driver is switched on. Left alone, the pair floats, and the receivers may see random noise as data, usually as a burst of garbage before every message. Bias resistors, sometimes called fail-safe or pull-up and pull-down resistors, pull one wire up and the other down just enough to hold the idle line clearly in the logic 1 state. They are normally fitted once on the network, often at the master or built into it. Many current transceivers have fail-safe receivers that treat an idle or shorted line as a 1, which reduces the need for external bias, but mixed old and new equipment still benefits from getting it right.
Isolation and surge protection. Field cables in a plant run past motors and drives and between buildings, and a ground fault or a nearby lightning strike can put large voltages on them. Industrial RS-485 ports are often galvanically isolated, so the bus side floats separately from the device’s own electronics, and long outdoor runs get surge protection at each end. A cheap non-isolated USB adapter on a laptop is fine for a bench test and a poor choice for a permanent connection to a live plant network.
How many devices, how far and how fast
The standard measures load in unit loads. One unit load is a receiver with an input resistance of about 12 kilohms, and a driver must be able to drive 32 of them. Older transceivers count as one unit load each, which is where the familiar limit of 32 devices comes from. Many current transceivers are rated at a quarter or an eighth of a unit load, which allows up to 128 or 256 devices on one segment. Protocols have their own limits on top: Modbus RTU, for example, allows addresses 1 to 247. For more devices, or to go beyond the length limit, a repeater starts a new segment.
Distance and speed trade against each other. The standard does not fix either, but the cable does: long cable rounds off the edges of the bits. Two figures are commonly quoted. At low data rates, up to about 100 kbit/s, a run of about 1,200 meters (4,000 feet) is achievable with good cable. At the other extreme, transceivers can reach 10 Mbit/s or more, but only over a few meters to a few tens of meters. A common rule of thumb is to keep the data rate in bits per second multiplied by the cable length in meters below about 100 million. In practice, most field devices run at 9,600 or 19,200 baud, well inside the limit for any cable run a building is likely to have.
RS-485 vs RS-232 vs RS-422
All three are physical layers for serial data, and the same UART chip can sit behind any of them. The differences are in the wiring.
| RS-232 | RS-422 | RS-485 | |
|---|---|---|---|
| Signaling | Single-ended, each signal against ground | Differential pair | Differential pair |
| Devices | One transmitter, one receiver | One transmitter, up to 10 receivers | Many transmitters and receivers on one bus, 32 unit loads |
| Direction | Full duplex | Full duplex with two pairs; one direction per pair | Half duplex on one pair, or full duplex on two |
| Typical distance | About 15 meters | Up to about 1,200 meters | Up to about 1,200 meters |
| Typical use | Console ports, older instruments, point-to-point links | Long point-to-point or one-to-many links | Multi-drop field networks: meters, drives, controllers |
RS-232 is still common for a service port on a single instrument or for a console on network equipment. RS-422 suits a single long link where one end talks and several listen. RS-485 is the choice whenever several devices need to share one cable and take turns, which is why it dominates field networks.
Connecting a microcontroller to RS-485
A microcontroller’s UART produces logic-level signals, 3.3 or 5 volts against ground, which would not survive long on a plant cable. An RS-485 transceiver chip converts between the two. The microcontroller’s transmit and receive pins go to the chip’s driver input and receiver output, and one more pin drives the chip’s driver enable, so the firmware can switch the driver on only while it is transmitting. Some UARTs, and some ready-made modules, handle that switching automatically.
The common mistakes at this point are a 5 volt transceiver on a 3.3 volt board, a driver enable that releases the line before the last byte has left the UART’s shift register, which clips the end of each message, and a module with a terminating resistor fitted that is placed in the middle of the bus. Development boards such as those in the microcontroller comparison pair easily with a transceiver module for prototypes; a product meant for a plant needs an isolated transceiver and surge protection on the board.
Reading RS-485 devices from an IoT system
Many of the devices worth monitoring in a building or a plant have an RS-485 port and nothing else: energy and power meters, flow meters, temperature and humidity transmitters, inverters, variable speed drives and older PLCs. Most of them speak Modbus RTU over it. They will not talk to a cloud platform directly, and they are not meant to.
The usual pattern is an edge gateway with an RS-485 port wired onto the bus as its master. It polls each device in turn for the registers it needs, converts the raw values into readings with names and units, and publishes them upward, typically over MQTT to a broker, or through an OPC UA server for the plant’s own systems. The overview of an industrial IoT system shows where that gateway sits, and the OPC UA and MQTT article covers what happens above it. Where a PLC already polls the same devices, it is usually simpler to read the values from the PLC, as described in what a PLC is, than to add a second master to its bus.
Two cautions apply. A two-wire RS-485 bus running Modbus RTU expects one master, so a gateway must not be wired onto a bus that a PLC or a building management system already polls without agreement from whoever owns that system. And the bus has no security of its own: any device on it can send anything to any other. Treat physical access to the cable, and to whatever gateway bridges it to a network, as access to every device on it.
Troubleshooting checklist
When an RS-485 link does not work, the cause is far more often the wiring or the settings than the hardware. Work through these in order.
- Settings match. Baud rate, data bits, parity and stop bits must be identical on every device, and each device needs a unique address in the protocol.
- A and B. Swap the pair at one device and try again.
- Termination. A resistor at each end of the trunk and nowhere else. With the bus powered down, the resistance measured across A and B should be close to 60 ohms, two 120 ohm terminators in parallel.
- Biasing. If every message is preceded by a burst of garbage, or the receiver sees data when nothing is sending, the idle line is floating.
- Common ground. Connect the signal common between devices, especially across buildings or separate power supplies.
- Layout. Look for a star, a long stub or a branch added later, and rewire it as one daisy chain.
- Turnaround. If the end of each message is cut off, the transmitter is releasing the line too early; if answers collide with requests, a device is replying before the master has released it.
A cheap USB to RS-485 adapter and a serial terminal on a laptop, connected as a listener, will show whether bytes are moving at all, which splits the problem in two quickly.
Written by the IoT Crest editorial team. Facts in this article follow the editorial policy: only well-established behavior is stated and no figures are invented.