RS-485 Explained: Differential Signalling, Termination, Fail-Safe Biasing, Multidrop Wiring and Troubleshooting

RS-485 Explained: Differential Signalling, Termination, Fail-Safe Biasing, Multidrop Wiring and Troubleshooting

RS-485 Explained: Differential Signalling, Termination, Fail-Safe Biasing, Multidrop Wiring and Troubleshooting

Most field failures blamed on “Modbus” are not protocol bugs at all. They are electrical budgets quietly overspent on a twisted pair that nobody has looked at with an oscilloscope since commissioning. RS-485 is the physical layer under a huge installed base of meters, drives, PLCs and sensors, and it is unforgiving in very specific, very predictable ways. A bus that works on the bench at 9600 baud with three nodes can start throwing CRC errors when a fourth device, a longer cable run or a new bias network arrives.

That matters in 2026 because brownfield RS-485 segments are being wired into edge gateways and unified namespaces faster than ever, and the gateway team often inherits wiring they did not design. This guide treats RS-485 as four budgets you must balance: differential voltage, common-mode voltage, load and timing. You will leave with worked numbers for termination and fail-safe biasing, wiring rules that survive the field, Modbus RTU timing, Python direction-control code and a scope-first troubleshooting flow.

What this covers: the TIA-485-A electrical contract, termination and biasing maths, unit loads, topology, grounding, isolation, surge, baud-versus-distance, Modbus RTU framing and a diagnostic workflow.

Context and Background

RS-485 is a physical-layer standard, published today as TIA-485-A (the 1998 revision, reaffirmed in 2012). It defines only the electrical characteristics of drivers and receivers on a balanced, multipoint line. It says nothing about bytes, framing, addressing or error checking. Those come from whatever protocol rides on top: Modbus RTU, Profibus DP, BACnet MS/TP, DMX512 and a long list of proprietary vendor protocols all reuse the same electrical layer.

The standard grew out of the limits of RS-232. RS-232 is single-ended and point-to-point: each signal is a voltage measured against a shared ground, and a receiver must recognise anything beyond plus or minus 3 V as a valid level. That works for a terminal on a desk. It fails across a factory, where ground potentials drift by volts and motor drives inject noise into every conductor. RS-422 introduced differential signalling with one driver and up to ten receivers. RS-485 extended that to true multipoint operation: many drivers and receivers sharing one pair, taking turns.

Texas Instruments’ long-running RS-485 Design Guide (SLLA272) and Analog Devices’ application notes remain the practical references most engineers use, because the TIA standard itself is paywalled and terse. Most of the numbers in this article are cross-checked against those vendor documents and the Modbus Organization’s serial-line specification.

If you are working at the protocol layer, our complete guide to the Modbus protocol covers function codes, register maps and exception handling. This article stays underneath that, at the copper. The distinction matters, because a Modbus stack cannot fix a reflection, a floating idle line or a 9 V ground shift. Those must be solved in the wiring, the transceiver choice and the termination network.

One more piece of context explains why RS-485 refuses to die. It is cheap, the transceivers cost well under a dollar, it is tolerant of rough cabling, and it is supported by every PLC and drive vendor. Industrial Ethernet has displaced it in new machine designs, but the installed base of RS-485 field devices will outlive several generations of gateways. Understanding the electrical contract is therefore a long-lived skill, not a legacy curiosity.

How RS-485 Works: The Electrical Contract

RS-485 sends each bit as the voltage difference between two wires, A and B, rather than as a voltage against ground. A compliant driver must produce at least 1.5 V of differential output into a 54 ohm load, and a compliant receiver must resolve differences as small as 200 mV, while tolerating common-mode voltages from -7 V to +12 V.

Those three numbers are the core of the standard, and they define a generous margin. A driver that delivers 1.5 V into the worst-case load, against a receiver that only needs 200 mV, leaves roughly 1.3 V for cable attenuation, reflections and noise. Every design rule in the rest of this article is a way of protecting that margin, or of protecting the common-mode window that sits underneath it.

RS-485 multidrop bus topology showing a daisy-chained twisted pair trunk with 120 ohm termination at both ends, fail-safe biasing at the master and a common reference wire

Figure 1: A correctly wired RS-485 multidrop segment. The trunk is a single daisy chain with termination only at the two physical ends, biasing in one place and a common reference conductor.

The figure shows the reference topology the rest of this article argues for. The master sits at one physical end of the cable with a 120 ohm terminator and the fail-safe bias network. Every other node taps the trunk with a short stub. The last node on the cable carries the second terminator. A third conductor ties the transceiver grounds together and is connected to protective earth at a single point.

Differential signalling and the 200 mV window

A differential receiver subtracts B from A. Noise that couples equally onto both wires of a twisted pair appears as a common-mode shift and cancels in the subtraction. That is why a twisted pair matters: twisting keeps both conductors at nearly the same distance from any interference source, so induced voltages match closely.

The receiver’s decision rule, per the TIA-485-A thresholds, is that a difference above +200 mV is one logic state and a difference below -200 mV is the other. Between those two values the output is undefined. This is the single most important detail for understanding fail-safe biasing later. When nobody is driving the bus, a terminated pair sits at close to 0 V differential, inside the undefined zone, and receivers may toggle on noise.

Polarity naming is a trap here. In TI and most transceiver datasheets, A is the non-inverting line, so A more positive than B means logic 1, which is also the idle (mark) state of a UART. The Modbus serial-line specification names the lines D0 and D1, where D1 is the positive line for a binary 1, and many device vendors print “A” and “B” with the opposite meaning. The only safe rule is to read each device’s datasheet and confirm on a scope which wire goes positive during idle.

Common-mode range and why ground still matters

Differential signalling does not make ground irrelevant. Every receiver input must stay between -7 V and +12 V relative to that receiver’s own ground. A driver powered from 5 V produces outputs that sit somewhere between 0 V and its supply, so the -7 V to +12 V window is usually explained as leaving room for about 7 V of ground shift in either direction between two nodes.

That is a real but finite budget. In a building with variable-frequency drives, long earth paths and separate supply transformers, ground potential differences of several volts are routine. Exceed the window and the receiver may misread data, or the protection structures inside the transceiver may conduct and draw current through the signal lines. This is why “RS-485 only needs two wires” is folklore. Without a common reference conductor or galvanic isolation, the common-mode voltage is undefined, and two wires work only until it drifts.

Unit loads, 1/8-UL transceivers and the 375 ohm budget

The standard expresses receiver loading in unit loads (UL). One unit load corresponds to a receiver input resistance of about 12 kilohms, which works out to roughly 1 mA at the +12 V end of the common-mode range. A standard driver must be able to drive 32 unit loads. Thirty-two 12 kilohm inputs in parallel equal 375 ohms of common-mode load, and that 375 ohm figure becomes the hard budget for everything hanging on the bus.

Modern transceivers present a fraction of a unit load. Analog Devices tabulates the arithmetic: half-UL parts allow 64 nodes, quarter-UL parts 128, and 1/8-UL parts with at least 96 kilohm input impedance allow 256 nodes. The node count is not a free lunch, because protocol addressing limits apply too. Modbus RTU supports addresses 1 to 247, and the spec recommends no more than 32 devices per segment without a repeater for interoperability with older devices.

A subtle point is that the budget is shared by anything that loads the bus in common mode, not just receivers. External bias resistors are the main culprit, as the worked example in the next section shows. Planning node counts against the nominal 256 for 1/8-UL parts, without subtracting the bias network, is a common way to overspend the load budget.

Half duplex versus full duplex

Half-duplex RS-485 uses one twisted pair. Every node’s driver and receiver connect to the same two wires, so only one node may drive at a time, and every node must switch its driver off when finished. That switching is controlled by a driver-enable (DE) pin, and getting its timing right is the main software problem in RS-485 systems.

Full-duplex RS-485 uses two pairs, one for each direction, much like RS-422 but with multipoint capability. A master transmits on one pair and listens on the other, while slaves do the reverse. Slaves still need direction control because they share the return pair. Full duplex removes the need for the master to turn its driver off, and allows echo-free monitoring of its own transmission. The cost is a second pair, a second pair of terminators and, in practice, confusion during commissioning because some devices label the four wires inconsistently. The Modbus specification makes two-wire operation the common case and four-wire optional, which is why most field devices you meet will be half duplex.

RS485 vs RS232 in one table

The table below summarises the comparison readers search for most often. RS-232 values come from TI’s RS-232 application note; RS-485 values from the TI and ADI references above.

Property RS-232 RS-485
Signalling Single-ended, referenced to ground Differential across A and B
Topology Point-to-point, two nodes Multipoint bus, 32 unit loads
Receiver threshold plus or minus 3 V plus or minus 200 mV
Driver output plus or minus 5 V to 15 V at least 1.5 V into 54 ohm
Common-mode tolerance Not applicable -7 V to +12 V
Typical reach Limited by cable capacitance, tens of metres Up to about 1,200 m at low rates
Duplex Full duplex on separate wires Half duplex on one pair, or full on two

The practical summary is simple. Use RS-232 for a short cable between two boxes in the same cabinet. Use RS-485 for anything that leaves the cabinet, involves more than two devices or crosses a noisy plant floor.

RS485 Termination Resistor and RS-485 Biasing: Worked Numbers

Termination and biasing are two separate fixes for two separate problems, and they interact. Termination stops reflections on lines that are electrically long. Biasing holds the idle bus in a defined state. Getting one right while ignoring the other is the most common cause of intermittent errors on otherwise healthy segments.

When is an RS-485 bus electrically long?

A cable behaves as a transmission line when signal edges change faster than the cable can settle. Analog Devices states the threshold plainly: a cable need not be treated as a transmission line if the driver’s rise time is more than four times the cable’s one-way propagation delay. Below that, every unmatched end reflects part of each edge back down the line.

Put numbers on it. Typical twisted-pair cable has a velocity factor around 0.78, so signals travel at about 0.234 m per nanosecond, or roughly 4.3 ns per metre. A fast transceiver with an edge of, say, 15 ns (an illustrative figure; check your part’s datasheet) becomes a transmission-line problem once the one-way delay exceeds 15 / 4, about 3.75 ns. That is under one metre of cable. In practice, every RS-485 bus driven by a fast part is electrically long.

Now take a slew-rate-limited transceiver with an illustrative 1 microsecond edge. The same rule gives a critical delay of 250 ns, which corresponds to about 58 m of cable. A 30 m segment using slow-edge parts can therefore run without terminators. This is why slew-limited transceivers exist, and why a “replacement” transceiver with faster edges can break a bus that ran unterminated for years.

Why low baud rates hide termination mistakes

Termination is about edge speed, not baud rate, yet low baud rates mask its absence. Consider a 100 m bus at 9600 baud. The round-trip delay is about 850 ns, and reflections from an unterminated end typically die out after a few round trips, so within a handful of microseconds. A UART samples each bit near its centre, about 52 microseconds after the edge at 9600 baud. By then the ringing has long settled.

Raise the rate to 115.2 kbps on a 500 m run and the bit time is 8.7 microseconds while the round trip grows to about 4.3 microseconds. Reflections now overlap the sampling point, and errors appear. The lesson is that “it works at 9600” is not evidence of a healthy bus. It is evidence that the timing budget is large enough to hide the defect.

Sizing and placing the termination resistor

Terminate with a resistor equal to the cable’s characteristic impedance, connected across A and B at each physical end of the trunk. Industrial RS-485 cable is typically 120 ohm twisted pair, so the answer is usually 120 ohm at each end and nowhere else. ADI’s guidance is explicit: use no more than two terminating resistors in a half-duplex bus. A third terminator in the middle drops the load seen by every driver and shrinks the differential swing.

The driver’s 54 ohm specification load is not arbitrary. Two 120 ohm terminators in parallel make 60 ohm, and the remaining margin covers the parallel loading of 32 unit-load receivers. The arithmetic shows why a third terminator matters: three 120 ohm resistors in parallel make 40 ohm, outside the condition the driver is guaranteed to meet.

Termination has a power cost. A driver swinging about 2 V into 60 ohm sources roughly 33 mA while transmitting. That matters for battery and loop-powered devices, which is why some designs use AC termination, a resistor in series with a capacitor, so the terminator draws no DC current. TI’s design guide shows a split variant: two 60 ohm resistors with a shared capacitor to ground, which also filters common-mode noise. AC termination limits the usable length and bit rate, and it interacts with biasing, so use it deliberately rather than as a default.

Fail-safe biasing: the worked example

When no driver is active, the two terminators tie A and B together through 60 ohm and the differential voltage collapses toward zero. That is inside the receiver’s undefined zone. Receivers then output random bits, and a UART can interpret noise as a start bit and begin assembling garbage. External fail-safe biasing fixes this by pulling A up and B down so the idle bus sits above +200 mV.

RS-485 biasing network with a 560 ohm pull-up on line A, a 560 ohm pull-down on line B and two 120 ohm termination resistors producing about 254 mV of idle differential voltage

Figure 2: The fail-safe biasing divider. Two bias resistors and the parallel terminators form a voltage divider that holds the idle bus above the 200 mV receiver threshold.

The divider in Figure 2 is straightforward to calculate. With a 5 V supply, a pull-up resistor RB from 5 V to A, a pull-down RB from B to ground, and the two 120 ohm terminators in parallel (60 ohm) between them, the idle differential voltage is:

VAB = 5 V x 60 / (60 + 2 x RB)

Target at least 250 mV, which gives 50 mV of noise margin above the 200 mV threshold. Solving 5 x 60 / (60 + 2RB) = 0.25 gives 60 + 2RB = 1,200, so RB = 570 ohm. The nearest standard value below that is 560 ohm, which yields 5 x 60 / 1,180 = 254 mV. If the supply sags to its 4.75 V lower tolerance, the idle voltage falls to about 242 mV, still above threshold but with thinner margin.

The simple divider ignores the common-mode load of the receivers. Renesas application note AN1986 gives a more complete formula that includes it: RB = (VS / VAB + 1) / (1 / RCM + 4 / Z0), where RCM is the 375 ohm full-load common-mode resistance and Z0 is the 120 ohm cable impedance. With VS = 4.75 V and VAB = 250 mV, that returns about 556 ohm, which agrees with the simple estimate. TI’s design guide works the same minimum-supply case and arrives at about 528 ohm, rounding to 523 ohm parts. All three approaches land in the low-500s, so 520 to 560 ohm is a defensible choice for a 5 V bus with two 120 ohm terminators.

The hidden budget: bias resistors consume unit loads

This is the part most tutorials skip. Each bias resistor is a low-impedance path from a signal line to a supply rail, which is exactly what a unit load is, only much heavier. AN1986 quantifies the remaining capacity as nUL = 12k x (1 / RCM – 1 / RB). With RB = 560 ohm, that gives about 10.6 unit loads of headroom, not 32.

In other words, a single bias network at 560 ohm consumes roughly two-thirds of the bus’s load budget. With 1/8-UL transceivers, 10.6 UL supports about 84 nodes rather than the advertised 256. TI’s design guide reaches a similar conclusion, noting that biasing can add up to 20 UL and capping a biased bus of 1/8-UL parts at 96 devices. The headline node count on a transceiver datasheet assumes no external biasing.

The bias network also draws continuous current. Our 560 / 60 / 560 ohm chain draws about 4.2 mA from 5 V at all times, before any driver switches on. That is negligible for a mains-powered gateway, but it matters for a battery-powered node. Placing the bias network only at the master is usually the right call, since the master is generally powered from a stable supply.

Do you still need external bias in 2026?

Many current transceivers advertise “true fail-safe” receivers. ADI describes these as having thresholds shifted to between -200 mV and about -30 mV, so a 0 V idle bus reads as logic 1 without external resistors. If every node on the segment uses such a part, external biasing is optional. TI cautions, however, that the worst-case noise margin of built-in fail-safe can be as small as 10 mV, so noisy installations may still benefit from external bias.

In brownfield work, you rarely control every node. One legacy device with a standard receiver will misbehave on an unbiased idle bus. The pragmatic rule is to bias once, at the master, sized as above, unless you have confirmed that every receiver on the segment is true fail-safe and the environment is quiet. Avoid having several vendors’ devices each enabling their own internal bias jumpers, which stacks bias networks in parallel and consumes the load budget even faster.

Multidrop Wiring That Survives the Field

Good RS-485 wiring is a single daisy-chained trunk, twisted-pair cable matched to the terminators, a common reference conductor, short stubs and, on long or outdoor runs, isolation and surge protection. Most field failures trace back to one of those rules being broken during an expansion rather than during the original install.

Why star topologies and long stubs fail

A star or a “home run” topology puts several cable ends at a single junction. Each branch is an unterminated transmission line, so every edge reflects back from every branch end and arrives at the junction at different times. You cannot fix this with termination, because the standard allows only two terminators and a star has more than two ends.

Stubs are a milder version of the same problem. TI’s design guide gives the rule: a stub’s electrical length should be less than one tenth of the driver’s rise time. With 78 percent velocity cable, a 100 ns rise time allows a stub of about 2 m, and a 500 ns rise time allows about 11 m. The Schneider Modbus RTU network characteristics for its TeSys devices are more conservative, at 20 m for a single tap-off or 40 m divided by the number of taps at a junction box, which assumes slow drivers at Modbus rates.

The practical answer is to run the trunk through each device, in and out, and keep stubs under a metre where possible. Many field devices provide doubled A, B and common terminals for exactly this purpose. When a site needs a genuine star, the correct tool is an RS-485 hub or repeater that gives each branch its own terminated segment.

Cable choice

Use shielded twisted-pair cable rated for RS-485, with 120 ohm characteristic impedance. TI recommends 22 to 24 AWG conductors. The Schneider specification asks for a single shielded twisted pair plus at least a third conductor for the common. A two-pair cable that uses the second pair for common is a good compromise, because it keeps the reference conductor close to the signal pair.

Avoid using spare pairs of a random Cat5 run without checking impedance, although Cat5 is about 100 ohm and generally works at Modbus rates. Never split A and B across different pairs. A and B must share a twisted pair, or common-mode noise no longer cancels. Keep RS-485 cable away from motor power cables, and cross them at right angles where they must meet.

Grounding, the common reference and the shield

The common conductor gives every transceiver the same reference, keeping the common-mode voltage within -7 V to +12 V. The Schneider network specification calls for the common to be connected to protective ground at least at one point on the bus. Tying it to earth at many points creates ground loops, because each earth point sits at a slightly different potential and the common wire then carries loop current.

The shield is a separate decision. Grounding it at one end controls low-frequency loop currents. Grounding at both ends improves high-frequency shielding but invites loop current through the shield. Many installations ground at one end and use a capacitor at the other to provide an RF path without a DC loop. Follow the site’s earthing practice and the device vendor’s instructions; there is no single correct answer for every plant.

Galvanic isolation

When ground potential differences may exceed the common-mode window, isolate. ADI’s guidance is to isolate both the signal lines and the transceiver’s power supply, using an isolated transceiver plus an isolated DC-DC converter or a part that integrates both. TI notes that galvanic isolation can tolerate ground potential differences of up to several kilovolts.

An isolated node needs its bus-side common connected to the bus common wire. Otherwise the isolated side floats, and its common-mode voltage is set by leakage and capacitance. Isolation therefore moves the reference problem, it does not delete it. The common conductor is still required, only now it does not carry loop current from the building’s earth system.

Surge and ESD protection

Long outdoor runs, cables between buildings and cables near large inductive loads see surges. The relevant immunity tests are IEC 61000-4-2 for electrostatic discharge, IEC 61000-4-4 for electrical fast transients and IEC 61000-4-5 for surge. Many transceivers carry enhanced ESD ratings, but a datasheet ESD rating is not a surge rating.

ADI recommends transient voltage suppressor (TVS) diodes that clamp the bus to within the transceiver’s common-mode range, plus series resistors of 10 to 20 ohm between the protection and the transceiver pins for higher-energy events. Choose a TVS with a stand-off voltage above the normal signal levels and a clamping voltage below the transceiver’s absolute maximum ratings. A bidirectional asymmetric TVS, rated for roughly -7 V to +12 V, matches the RS-485 window. Each added protection device also adds capacitance, which can matter at higher data rates.

RS-485 baud rate versus distance

The standard’s best-known claims come in a pair: a recommended maximum of 10 Mbps at about 12 m, and an absolute maximum of 1,200 m at which the data rate is limited to around 100 kbps. Those figures appear in Analog Devices’ “How Far and How Fast Can You Go With RS-485?” article. TI’s design guide offers a more conservative rule: cable length in metres multiplied by data rate in bits per second should stay below 10^7.

Cable length TI rule of thumb, length x rate below 10^7 Commonly cited practical figure Notes
12 m about 830 kbps 10 Mbps Standard’s recommended high-rate limit
100 m 100 kbps Higher with good cable Plenty for Modbus RTU at 115.2 kbps in practice
1,000 m 10 kbps 19.2 kbps Schneider rates its Modbus RTU bus at 1,000 m at 19,200 bps
1,200 m about 8.3 kbps 100 kbps Line resistance dominates at this length

The gap between the two columns is real, and it is not an error. TI calls its rule conservative, and the 100 kbps at 1,200 m figure assumes good 24 AWG cable and accepts some jitter. Maxim’s measurements in the same ADI article show about 400 kbps over 4,000 ft at 10 percent jitter without pre-emphasis. Treat the table as a planning envelope, then verify the eye opening on a scope during commissioning.

At long lengths, DC resistance becomes the limit. A 1,200 m run of 24 AWG pair has a few hundred ohms of loop resistance, which forms a divider with the 60 ohm termination and attenuates the signal before any frequency effects. That is why heavier gauges help on long runs, and why biasing calculations should be checked at the far end of a long bus, not only at the master.

Modbus RTU Over RS-485: Framing, Timing and Direction Control

Modbus RTU wiring sits on top of everything above. The Modbus over Serial Line specification makes two-wire RS-485 the common physical layer, requires 9600 and 19200 bps, defaults to 19200, and specifies even parity by default. If no parity is used, two stop bits are required, so every RTU character is 11 bits: one start bit, eight data bits, one parity or extra stop bit, and one stop bit.

Modbus RTU wiring and timing sequence over RS-485 showing driver enable assertion, frame transmission, driver release and the 3.5 character silent interval before the slave reply

Figure 3: A Modbus RTU request and response on a half-duplex RS-485 pair. The master must release the driver after its last stop bit and before the slave starts replying.

The sequence in Figure 3 hides most of the operational difficulty. The master enables its driver, sends the frame, and must turn the driver off after the final stop bit has left the shift register. The slave waits for the silent interval, enables its own driver and replies. Release too early and you truncate the CRC; release too late and you collide with the reply.

Silent intervals: t3.5 and t1.5

RTU frames have no start or end delimiter. Frame boundaries are detected by silence. A frame must be preceded and followed by at least 3.5 character times of idle line (t3.5), and characters within a frame must not be separated by more than 1.5 character times (t1.5). Because a character is 11 bits, the arithmetic is straightforward:

Baud rate Character time t1.5 t3.5
9,600 1.146 ms 1.719 ms 4.010 ms
19,200 0.573 ms 0.859 ms 2.005 ms
Above 19,200 Shorter 750 microseconds fixed 1.75 ms fixed

Above 19,200 bps the specification recommends fixed timer values instead of scaling, because character times become so short that tight inter-character limits impose heavy interrupt load on simple devices. The practical consequence is that a Modbus RTU device at 115.2 kbps still expects 1.75 ms of silence between frames, not the 0.33 ms the formula would give.

The t1.5 rule is where operating systems cause trouble. A Linux or Windows host that writes a frame in two chunks, or whose USB adapter batches bytes into separate USB packets, can insert a gap longer than 1.5 characters mid-frame. A strict slave discards the frame. Always write each Modbus frame with a single write call, and prefer adapters whose drivers handle RS-485 direction in hardware.

Driver-enable timing is the real constraint

At 115.2 kbps one bit lasts 8.7 microseconds. The MinimalModbus documentation reports that toggling RTS from user-space Python costs roughly 1 to 3 ms, and measured about 1 ms at 115.2 kbps, around 100 bit times. That latency is longer than the fixed 1.75 ms silent interval in its worse cases, so a fast slave may start replying while the master is still driving the line.

There are four robust ways to control direction, in order of preference. First, adapters with a hardware transmit-enable output, such as FTDI parts with a TXDEN function, switch the driver from the UART itself. Second, transceivers with automatic direction control sense the transmit data line. Third, the Linux kernel’s RS-485 mode toggles RTS inside the serial driver. Fourth, and least reliable, user-space RTS toggling works only at low baud rates with lenient slaves.

The Linux kernel documents RS-485 support through the serial_rs485 structure and the TIOCSRS485 ioctl. Flags include SER_RS485_ENABLED, SER_RS485_RTS_ON_SEND, SER_RS485_RTS_AFTER_SEND, SER_RS485_RX_DURING_TX and, where hardware supports it, SER_RS485_TERMINATE_BUS. The delay_rts_before_send and delay_rts_after_send fields are in milliseconds. Only some UART drivers implement RS-485 mode, so check yours before relying on it.

Python: pyserial direction control and a raw RTU transaction

The first listing uses pyserial’s rs485_mode attribute, which on supported Linux drivers asks the kernel to handle RTS, and builds a Modbus RTU frame by hand. It is useful for bring-up because it shows every byte on the wire.

# rtu_probe.py - read 2 holding registers from device 1 over RS-485
# Requires: pip install pyserial  (3.x)
import time
import serial
import serial.rs485

def crc16_modbus(frame: bytes) -> bytes:
    crc = 0xFFFF
    for b in frame:
        crc ^= b
        for _ in range(8):
            crc = (crc >> 1) ^ 0xA001 if crc & 1 else crc >> 1
    return bytes([crc & 0xFF, crc >> 8])   # low byte first on the wire

def char_time(baud: int, bits: int = 11) -> float:
    return bits / baud

BAUD = 19200
port = serial.Serial("/dev/ttyUSB0", BAUD, bytesize=8,
                     parity=serial.PARITY_EVEN, stopbits=1, timeout=0.5)

# Ask the driver to raise RTS (DE) while sending. Supported on Windows and a
# limited set of Linux drivers; otherwise use an auto-direction adapter.
try:
    port.rs485_mode = serial.rs485.RS485Settings(
        rts_level_for_tx=True, rts_level_for_rx=False)
except (ValueError, OSError) as exc:
    print("Kernel RS-485 mode unavailable:", exc)

t35 = 0.00175 if BAUD > 19200 else 3.5 * char_time(BAUD)

pdu = bytes([0x01, 0x03, 0x00, 0x00, 0x00, 0x02])  # dev 1, FC3, addr 0, qty 2
frame = pdu + crc16_modbus(pdu)                     # 01 03 00 00 00 02 C4 0B

time.sleep(t35)               # guarantee inter-frame silence
port.reset_input_buffer()
port.write(frame)             # one write call: avoid mid-frame gaps
port.flush()                  # wait until bytes have left the UART

expected = 5 + 2 * 2          # addr, fc, bytecount, data, crc
reply = port.read(expected)
if len(reply) < expected:
    raise SystemExit(f"Timeout: got {reply.hex(' ')}")
if crc16_modbus(reply[:-2]) != reply[-2:]:
    raise SystemExit(f"CRC error: {reply.hex(' ')}")
regs = [int.from_bytes(reply[3 + 2*i: 5 + 2*i], "big") for i in range(2)]
print("Registers:", regs)

The request bytes 01 03 00 00 00 02 C4 0B are a convenient fixture: if your CRC routine does not produce C4 0B for that PDU, fix it before touching the wiring. If you receive your own request echoed back, the adapter’s receiver is enabled during transmission, so either disable echo in hardware or discard the first eight bytes.

Python: pymodbus on a kernel-managed RS-485 port

For production polling, use a maintained stack. The second listing sets the kernel RS-485 flags with a raw ioctl, then lets pymodbus handle framing, retries and timing. Note that pymodbus 3.10 renamed the slave keyword to device_id; the listing targets current 3.x releases.

# poll_meter.py - pymodbus 3.10+ over a Linux UART in kernel RS-485 mode
import fcntl, struct
from pymodbus.client import ModbusSerialClient

PORT = "/dev/ttyS1"
TIOCSRS485 = 0x542F           # x86 and ARM; check asm-generic ioctls.h for others
SER_RS485_ENABLED = 1 << 0
SER_RS485_RTS_ON_SEND = 1 << 1

def enable_kernel_rs485(path: str, before_ms: int = 0, after_ms: int = 0):
    flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND
    cfg = struct.pack("8I", flags, before_ms, after_ms, 0, 0, 0, 0, 0)
    with open(path, "rb", buffering=0) as fd:
        fcntl.ioctl(fd, TIOCSRS485, cfg)   # raises OSError if unsupported

enable_kernel_rs485(PORT)

client = ModbusSerialClient(port=PORT, baudrate=19200, bytesize=8,
                            parity="E", stopbits=1, timeout=1, retries=2)
if not client.connect():
    raise SystemExit("Cannot open serial port")
try:
    rr = client.read_holding_registers(0, count=2, device_id=1)
    if rr.isError():
        print("Modbus exception or timeout:", rr)
    else:
        print("Registers:", rr.registers)
finally:
    client.close()

Whether the RS-485 setting persists after the configuring file descriptor closes depends on the UART driver, so verify it with the TIOCGRS485 read-back or a scope. On embedded boards, the cleaner approach is the device-tree RS-485 binding, which enables the mode at boot and keeps application code portable.

Troubleshooting RS-485 With an Oscilloscope

A protocol analyser tells you what bytes arrived. A scope tells you why. Most RS-485 faults are visible in three measurements: the differential voltage at idle, the edge shape at the far end, and the common-mode voltage of A and B against local ground.

RS-485 troubleshooting decision flow from CRC errors and timeouts through polarity, idle bias voltage, ringing, common-mode shift and driver enable timing checks

Figure 4: A scope-first troubleshooting flow for RS-485 and Modbus RTU faults, ordered from the cheapest check to the most invasive.

Work through Figure 4 in order, because it is ordered by cost. Polarity and configuration mistakes are free to fix, while isolation retrofits are not.

Measurement setup

Use two probes referenced to the local ground of the node you are diagnosing, one on A and one on B, and display the math channel A minus B. A differential probe is better but not essential at Modbus rates. Do not clip a probe ground lead to A or B on a mains-referenced scope; you will short the line to earth through the scope. Trigger on the falling edge of the math channel to catch start bits.

What to look for

The idle level comes first. With the bus quiet, A minus B should sit steadily above +200 mV, ideally 250 mV or more. A reading near zero means missing or inadequate bias. A negative reading usually means swapped A and B on the bias network, or a device whose internal bias fights yours.

Next, examine edges at the far end of the cable. A clean bus shows a crisp transition with minor overshoot. Ringing that persists for several round trips, or a staircase on each edge, indicates a missing terminator, a terminator in the wrong place or a long stub. A differential amplitude well below 1.5 V while transmitting suggests too many terminators, a heavy bias network, or a damaged driver.

Then look at A and B individually against local ground. Both should stay well inside -7 V to +12 V. A common-mode offset that shifts when a nearby motor starts is a ground-potential problem, and the fix is a common conductor or isolation, not termination. Finally, decode the DE line alongside the data. If DE falls before the last stop bit, the final CRC byte is truncated. If it stays high into the reply window, the master is colliding with the slave.

Common signatures and causes

Scope observation Probable cause Fix
Idle A minus B near 0 V No fail-safe bias Add one bias network at the master
Idle A minus B negative A and B swapped, or conflicting bias Check polarity convention per device
Ringing on every edge Missing or misplaced terminator 120 ohm at the two physical ends only
Low amplitude while driving Extra terminators or heavy bias Remove device-level terminators mid-bus
Offset moves with plant load Ground potential difference Common wire, or isolated transceivers
Last byte distorted DE released early Kernel or hardware direction control
Garbage after each request Echo or late DE release Disable echo, shorten turnaround

Trade-offs, Gotchas, and What Goes Wrong

The biggest trade-off is between fail-safe margin and node count. Stronger bias, meaning smaller resistors, buys noise margin at the idle state but consumes unit loads and idle current. Our 560 ohm example kept 254 mV of idle margin and left about 10.6 UL of headroom. Dropping to 470 ohm for more margin leaves only about 6.4 UL, according to the AN1986 formula. On a large bus, it is often better to buy true fail-safe transceivers than to keep shrinking bias resistors.

Device-level termination jumpers are the most common expansion failure. Many meters and drives ship with a switchable 120 ohm terminator, and some ship with it enabled. Add three such devices in the middle of a trunk and the driver sees well under 54 ohm, swing collapses and errors appear only on the farthest nodes. Audit every device’s jumpers whenever a node is added.

Repeaters and isolators solve distance and ground problems, but each one adds propagation delay and splits the bus into segments that need their own termination and bias. A segment behind a repeater that nobody biased will float. Treat each segment as its own design.

USB-to-RS-485 adapters vary widely. Some switch direction in hardware with tight timing. Others derive DE from a timer tuned to one baud rate, or from the transmit line itself, which MinimalModbus explicitly discourages because only one logic level is actively driven. Many cheap adapters also lack isolation, which couples the laptop’s ground into the bus during diagnostics. Keep an isolated, hardware-direction adapter in the commissioning kit.

Finally, “slow down the baud rate” is a diagnostic, not a fix. If a bus only works at 9600, something in the voltage, load or timing budget is overspent. Find it, because the margin you are hiding will be consumed by the next cable extension or the next noisy drive.

Practical Recommendations

Design and audit every RS-485 segment against the four budgets in turn. Start with topology, because no amount of termination fixes a star. Then size the termination and bias together, since they form one network. Check common-mode conditions before blaming the protocol, and make direction control a hardware problem wherever you can.

For brownfield work, especially when connecting legacy segments to an edge gateway, survey before you touch anything. Record every device’s transceiver part number where possible, terminator jumper state, bias settings, address and serial parameters. Capture a scope screenshot of idle level and far-end edges as a baseline. That record becomes the reference when someone adds a device next year. Our brownfield Modbus retrofit and edge gateway comparison covers the gateway side of the same project.

Checklist for a healthy RS-485 segment:

  • One daisy-chained trunk, stubs under 1 m where possible, no stars.
  • 120 ohm termination at the two physical ends, all other terminators off.
  • One bias network, sized for at least 250 mV idle, with unit loads recalculated.
  • Shielded 120 ohm twisted pair plus a common conductor earthed at one point.
  • Isolation for runs between buildings or across separate supplies.
  • TVS protection and series resistors on lines that leave the enclosure.
  • Hardware or kernel direction control, single write call per Modbus frame.
  • Baseline scope captures of idle level, edges and common-mode voltage.

Frequently Asked Questions

What is RS-485 used for?

RS-485 is a differential, multipoint physical layer used to connect many devices on one twisted pair over long distances in noisy environments. It carries industrial protocols such as Modbus RTU, Profibus DP and BACnet MS/TP, along with DMX512 stage lighting and many proprietary sensor and drive protocols. Its strengths are noise immunity, a common-mode range of -7 V to +12 V, up to 32 unit loads per segment and reach of roughly 1,200 m at low data rates, all with inexpensive transceivers.

Do I need a 120 ohm termination resistor on RS-485?

You need termination when the bus is electrically long, meaning the driver’s rise time is shorter than about four times the cable’s one-way delay. With fast modern transceivers that is under one metre, so most buses should be terminated with 120 ohm at both physical ends. Short runs using slew-limited drivers at low baud rates can work without termination, because reflections settle before the UART samples each bit. Never fit more than two terminators on a half-duplex trunk.

How do I calculate RS-485 bias resistors?

Treat the pull-up, the parallel terminators and the pull-down as a voltage divider. With 5 V and two 120 ohm terminators, which make 60 ohm, solve 5 x 60 / (60 + 2RB) for at least 250 mV, giving RB of about 570 ohm. A standard 560 ohm part yields about 254 mV. Then check how many unit loads the bias consumes: with 560 ohm, only about 10.6 UL of the 32 UL budget remain. Bias in one place, usually at the master.

What is the difference between RS485 and RS232?

RS-232 is single-ended and point-to-point. It measures each signal against ground with plus or minus 3 V thresholds, so reach is limited and it connects only two devices. RS-485 is differential and multipoint. Its receivers resolve 200 mV between two wires, reject common-mode noise and share one pair among many nodes. RS-232 offers full duplex on separate wires, while most RS-485 installations are half duplex and need driver direction control. Use RS-485 for anything leaving the cabinet.

Can RS-485 work with only two wires?

Electrically, data uses only A and B, but every transceiver also needs its common-mode voltage held within -7 V to +12 V relative to its own ground. Two-wire installations work when nodes share a well-bonded earth, often by accident. In larger plants, ground potential differences can exceed the window and cause errors or damage. A third common conductor, earthed at one point, or galvanic isolation with the bus-side commons tied together, makes the reference explicit and reliable.

How long can an RS-485 cable be?

The commonly cited limit is about 1,200 m, at which the data rate is limited to roughly 100 kbps on good 24 AWG twisted pair. The recommended high-speed limit is 10 Mbps at about 12 m. TI suggests a conservative rule: length in metres times data rate in bits per second below 10^7. For Modbus RTU, many vendors rate 1,000 m at 19,200 bps. Longer distances need repeaters, each creating a new segment with its own termination and bias.

Further Reading

By Riju — about

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *