When termination matters
The usual rule: termination matters when the round-trip delay is a significant part of one bit time. An unterminated line rings for several round trips.
An energy meter answers every request on the bench, through two metres of cable. On site, at the end of 180 m of cable beside a variable speed drive, the same meter answers nine requests in ten, and the missing readings appear as gaps in the energy record that nobody can explain. The meter is not faulty and the software is not faulty. The cable, its two ends and the state of the lines when nobody is sending decide whether the bytes arrive. This lesson shows how an RS-485 bus is wired, terminated and biased, and how to check each of these with a short calculation. #RS485 #IndustrialCommunication #SerialBus
By the end of this lesson, you will be able to:
A cold store has a compressor on a variable speed drive, an energy meter on the compressor feeder, and three more energy meters on other feeders. A small gateway in the control room reads all of them over one RS-485 segment: 180 m of shielded twisted pair with a characteristic impedance of 120 Ω (the resistance that a long cable presents to a fast edge, set by the size and spacing of its wires; an ohmmeter cannot measure it). The gateway is at one end. The compressor meter (address 5), the drive (address 10) and the three other meters are connected along the cable: six nodes in total.
RS-485 runs all six devices on one pair of wires, over hundreds of metres in the electrical noise of a plant room. Its standard defines only the electrical signals. The cable layout, the termination and the idle state are left to the installer, and left to chance they let a bus work at first and fail when a drive starts or the baud rate is raised.
A simple serial link sends each bit as a voltage on one wire against a common wire, so any noise on that wire is added to the bit. Over a few metres this is acceptable. Over 180 m beside power cables it is not.
RS-485 sends each bit as the difference between two wires: the driver pushes one up and the other down, and the receiver looks only at the difference. The wires are twisted together, so a nearby power cable or drive induces almost the same noise voltage in both, and their difference does not change.
The standard states the levels. A driver must produce at least 1.5 V between the lines into its rated load. A receiver must decide correctly when the difference is at least 200 mV in either direction. The space between the two values is the allowance for cable loss and noise.
Write the difference as
where
The standard names the lines A and B and says that A is negative with respect to B when the bus carries a 1, which is also the idle state. Many makers of transceiver chips print the letters the other way round. Device makers add more names: D+ and D-, or D0 and D1 (in the Modbus serial line guide D0 is A and D1 is B).
This lesson uses the definition of the standard: B is the line that is more positive when the bus is idle, and A is the line that is more negative. The bias resistor to the supply goes on B, and the bias resistor to common goes on A.
An electrical edge travels along the cable at a finite speed, so the cable behaves as a transmission line: one continuous path with two ends. The cable goes into each device and out again to the next one (a daisy chain).
A short branch from the line to a device is a stub: a small extra line with an open end, so it must be short (Application 2 gives the rule). A star is a set of long stubs. Where the plant layout looks like a star, run the cable out to each device and back, so that the electrical path is still one line.
An edge that reaches an open end travels back, as a wave on a rope tied to a wall returns to your hand. This reflection adds to the signal: the level at a receiver rings up and down for a short time after each edge.
The termination, a resistor equal to the characteristic impedance of the cable (here 120 Ω) between A and B at the end, absorbs the edge. Every device may send, so the line needs one termination at each end and none anywhere else.
Whether the reflection matters depends on time. Let
One bit lasts
When termination matters
The usual rule: termination matters when the round-trip delay is a significant part of one bit time. An unterminated line rings for several round trips.
Every edge makes a reflection, so an unterminated long line rings even at 9600 baud. At low rates the ringing ends long before the sampling point.
Termination has a cost. Two 120 Ω resistors in parallel put 60 Ω between the lines, so the driver supplies more current and the idle bus is pulled towards a difference of 0 V. On 180 m in a plant room, fit both terminations and solve the idle state correctly.
Only one device sends at a time, so between frames every driver is off and the terminations pull the difference to 0 V, inside the undefined region. Noise can then switch a receiver to 0, which looks like a start bit: receivers see characters that nobody sent, and the next real frame loses its first byte.
Bias resistors (also called fail-safe resistors) hold the idle line, as a light spring holds a door shut while nobody pushes it.
Let
Idle voltage of a biased, terminated bus
The idle voltage must be above the receiver threshold of 200 mV with a margin for noise, a low supply and resistor tolerance. A common design target is 300 mV or more.
The bias network is fitted at one place on the bus only, here at the gateway. Bias resistors at several devices act in parallel, and nobody then knows the real value. Do not take a value from a manual without the calculation: the Modbus serial line guide gives 450 to 650 Ω, with 150 Ω terminations, and 650 Ω on that bus idles at only 273 mV.
A smaller
Each receiver draws a small current from the line. The standard defines one unit load as the load of a standard receiver, about 12 kΩ from each line to common, and a standard driver must drive 32 unit loads together with the two terminations. So a bus of standard devices holds 32 nodes.
Many modern transceivers are a fraction of a unit load: 1/2, 1/4 or 1/8. A bus of 1/8 unit-load devices holds
The receiver looks at the difference, but each line must also stay within a range against the receiver’s own common: from
The shield has a different task: it surrounds the pair and carries noise current away. Connect it to protective earth at one end only, normally at the gateway. Earthed at both ends, it joins two earth points that may be at different potentials, and the current that then flows in it puts noise into the pair it should protect.
Where devices are in different buildings or close to large drives, the ground difference can exceed what a common wire can control. An isolated transceiver has no electrical connection between its bus side and the device’s own electronics, so the bus side follows the bus common freely. Isolation at the gateway and at the drive removes most ground problems on a bus of this kind.
Terminations in parallel. Both resistors are between the same two lines.
The lines see 60 Ω between them. ✅
Idle voltage. The supply drives the series chain of 680 Ω, 60 Ω and 680 Ω.
The idle voltage is 211 mV. ✅
Margin.
Worst case. Use the low supply and bias resistors that are 5 percent high,
At 192 mV the bus idles inside the undefined region. The bias is not enough. ✅
Largest resistor for the target. Set
A value of 470 Ω gives exactly 300 mV with no margin, so the choice must be lower. ✅
Compare the standard values. Calculate the nominal idle voltage, and the worst case with
| Idle, nominal | Idle, worst case | |
|---|---|---|
| 470 Ω | 300 mV | 272 mV |
| 430 Ω | 326 mV | 296 mV |
| 390 Ω | 357 mV | 324 mV |
| 330 Ω | 417 mV | 379 mV |
The largest value that stays above 300 mV in the worst case is 390 Ω. ✅
Selected value.
What a sending driver sees. Between the lines there are three paths in parallel: the terminations (60 Ω), the two bias resistors in series through the supply (
Total load.
The load is 54.9 Ω, above the 54 Ω at which the driver output is specified. ✅
How far the bias can go. With the load set to 54 Ω, the same calculation gives
Bias current. With no driver active, one current flows through the whole chain.
The network takes 5.95 mA from the supply continuously. ✅
Voltage across the terminations.
Script. The Python script below prints 211.3 mV for 680 Ω, 357.1 mV for 390 Ω, a worst case of 324.2 mV and a driver load of 54.95 Ω. ✅
Check it on the bus. The calculation is only a prediction until the electrician measures it at commissioning.
One-way delay.
An edge takes 0.9 µs to travel the length of the bus. ✅
Round trip.
Bit times and ratios. The bit time is the inverse of the baud rate.
| Baud rate | Bit time | Round trip as part of a bit |
|---|---|---|
| 9600 | 104 µs | 1.7 percent |
| 19200 | 52.1 µs | 3.5 percent |
| 115200 | 8.68 µs | 20.7 percent |
At 9600 and 19200 baud the middle of the bit comes 29 and 14 round trips after the edge. At 115200 baud it comes only about 2.4 round trips after the edge. ✅
Decision. At 115200 baud this bus must be terminated. At the two lower rates an unterminated bus would probably pass data, but the bus may be run faster later, so both terminations stay. ✅
Rule as a formula. The stub delay is its length times
The limit depends on the driver edge, not on the baud rate. ✅
Fast transceiver.
Slew-rate limited transceiver.
Which part of the guideline applies. 180 m is far below 1,200 m, so the bus is in the region where rate times length stays near
Guideline rate.
All three baud rates of the problem are below it, and 115200 is below it by a factor of 4.8. ✅
Check a second way. The bit time at 556 kbit/s is
The script repeats both applications: the idle voltage as built, the four candidate bias resistors and the timing on 180 m. It then builds the 11 bits of one real character on the wire (the byte 0x05, the address of the compressor meter, with 8 data bits, even parity and 1 stop bit) and saves a plot of idle voltage against bias resistance. The script calls the cold store bus “bus C”.
"""RS-485 bus C: idle voltage, bias choice, driver load, reflection timing, one character."""import numpy as npimport matplotlib.pyplot as plt
VCC = 5.0 # V, transceiver supplyVCC_LOW = 4.75 # V, supply at its lower limitR_TERM = 120.0 # ohm, one termination resistorN_TERM = 2 # one at each end of the lineV_THRESHOLD = 0.200 # V, receiver threshold of the standardV_TARGET = 0.300 # V, design target for the idle voltageR_LOAD_MIN = 54.0 # ohm, load at which the driver output is specifiedN_NODES = 6 # nodes on bus C, each taken as one unit loadR_NODE_DIFF = 24e3 # ohm between the lines for one unit load (2 x 12 kilohm)LENGTH = 180.0 # m of cableDELAY = 5e-9 # s per metre of cable
def parallel(*resistors): """Resistance of several resistors in parallel.""" return 1.0 / sum(1.0 / r for r in resistors)
def idle_voltage(r_bias, vcc=VCC, r_between=R_TERM / N_TERM): """Idle voltage V_B - V_A with one bias resistor to each rail.""" return vcc * r_between / (2.0 * r_bias + r_between)
def driver_load(r_bias): """Load between the lines that an active driver must drive.""" return parallel(R_TERM / N_TERM, 2.0 * r_bias, R_NODE_DIFF / N_NODES)
# ---------- Part 1: the bus as built ----------r_tt = R_TERM / N_TERMv_680 = idle_voltage(680.0)print("Bus C as built")print(f" terminations in parallel: {r_tt:.1f} ohm")print(f" idle voltage with 680 ohm bias: {1e3 * v_680:.1f} mV")print(f" margin above the {1e3 * V_THRESHOLD:.0f} mV threshold: " f"{1e3 * (v_680 - V_THRESHOLD):.1f} mV")print(f" at {VCC_LOW:.2f} V and bias 5 % high: " f"{1e3 * idle_voltage(680.0 * 1.05, VCC_LOW):.1f} mV")print(f" bias current: {1e3 * VCC / (2 * 680.0 + r_tt):.2f} mA")
# ---------- Part 2: choose the bias resistors ----------r_max = (VCC * r_tt / V_TARGET - r_tt) / 2.0print("Choosing the bias resistors")print(f" largest value for {1e3 * V_TARGET:.0f} mV: {r_max:.0f} ohm")for r in (470.0, 430.0, 390.0, 330.0): print(f" {r:.0f} ohm: idle {1e3 * idle_voltage(r):.1f} mV, " f"worst case {1e3 * idle_voltage(r * 1.05, VCC_LOW):.1f} mV, " f"driver load {driver_load(r):.2f} ohm")r_min = parallel(R_TERM / N_TERM, R_NODE_DIFF / N_NODES)r_bias_min = 1.0 / (1.0 / R_LOAD_MIN - 1.0 / r_min) / 2.0print(f" smallest value that keeps the load at {R_LOAD_MIN:.0f} ohm: {r_bias_min:.0f} ohm")print(f" bias current with 390 ohm: {1e3 * VCC / (2 * 390.0 + r_tt):.2f} mA")
# ---------- Part 3: reflections against the bit time ----------t_one_way = LENGTH * DELAYt_round = 2.0 * t_one_wayprint("Reflection timing on 180 m")print(f" one way {1e6 * t_one_way:.2f} us, round trip {1e6 * t_round:.2f} us")for baud in (9600, 19200, 115200): t_bit = 1.0 / baud print(f" {baud:>6} baud: bit time {1e6 * t_bit:.2f} us, " f"round trip is {100.0 * t_round / t_bit:.1f} % of a bit")
# ---------- Part 4: stubs and the length against rate guideline ----------print("Stub length (one tenth of the rise time)")for t_rise in (10e-9, 250e-9): print(f" rise time {1e9 * t_rise:.0f} ns: stub up to {t_rise / 10.0 / DELAY:.1f} m")rate_max = 1e8 / LENGTHprint(f"Guideline rate for {LENGTH:.0f} m: {rate_max / 1e3:.0f} kbit/s " f"(bit time {1e6 / rate_max:.2f} us)")
# ---------- Part 5: one character on the wire (0x05, 8E1) ----------byte = 0x05data_bits = [(byte >> i) & 1 for i in range(8)] # least significant bit firstparity = sum(data_bits) % 2 # even paritybits = [0] + data_bits + [parity] + [1]print(f"Character 0x{byte:02X} at 8E1: {''.join(str(b) for b in bits)} " f"({len(bits)} bits, {1e3 * len(bits) / 9600:.3f} ms at 9600 baud)")
# ---------- Plot ----------r_axis = np.linspace(200.0, 1000.0, 400)fig, ax = plt.subplots(figsize=(8, 4.5))ax.plot(r_axis, 1e3 * idle_voltage(r_axis), label="5.00 V supply")ax.plot(r_axis, 1e3 * idle_voltage(r_axis * 1.05, VCC_LOW), "--", label="4.75 V supply, resistors 5 % high")ax.axhline(1e3 * V_THRESHOLD, color="gray", linewidth=0.8)ax.axhline(1e3 * V_TARGET, color="gray", linewidth=0.8, linestyle=":")ax.plot([680.0, 390.0], [1e3 * v_680, 1e3 * idle_voltage(390.0)], "o")ax.set_xlabel("each bias resistor (ohm)")ax.set_ylabel("idle voltage between the lines (mV)")ax.set_title("Bus C: idle voltage with two 120 ohm terminations")ax.legend()fig.tight_layout()fig.savefig("rs485_bias_and_timing.png", dpi=120)print("Saved rs485_bias_and_timing.png")Expected output
Bus C as built terminations in parallel: 60.0 ohm idle voltage with 680 ohm bias: 211.3 mV margin above the 200 mV threshold: 11.3 mV at 4.75 V and bias 5 % high: 191.5 mV bias current: 3.52 mAChoosing the bias resistors largest value for 300 mV: 470 ohm 470 ohm: idle 300.0 mV, worst case 272.2 mV, driver load 55.62 ohm 430 ohm: idle 326.1 mV, worst case 296.0 mV, driver load 55.31 ohm 390 ohm: idle 357.1 mV, worst case 324.2 mV, driver load 54.95 ohm 330 ohm: idle 416.7 mV, worst case 378.5 mV, driver load 54.25 ohm smallest value that keeps the load at 54 ohm: 312 ohm bias current with 390 ohm: 5.95 mAReflection timing on 180 m one way 0.90 us, round trip 1.80 us 9600 baud: bit time 104.17 us, round trip is 1.7 % of a bit 19200 baud: bit time 52.08 us, round trip is 3.5 % of a bit 115200 baud: bit time 8.68 us, round trip is 20.7 % of a bitStub length (one tenth of the rise time) rise time 10 ns: stub up to 0.2 m rise time 250 ns: stub up to 5.0 mGuideline rate for 180 m: 556 kbit/s (bit time 1.80 us)Character 0x05 at 8E1: 01010000001 (11 bits, 1.146 ms at 9600 baud)Saved rs485_bias_and_timing.pngRead the character from left to right: a start bit (0), the eight data bits of 0x05 with the least significant bit first, the parity bit (0, because the byte already has an even number of ones), and the stop bit (1). For every 1 the line B is more positive than A, and for every 0 the line A is more positive. After the stop bit the driver switches off, and only the bias resistors keep the bus at 1.
1. A technician finds that the cold store bus has only one of its two 120 Ω terminations fitted. The bias is 680 Ω to each rail on 5.0 V. Find the idle voltage. Explain why this healthy idle voltage is not good news.
Now 120 Ω is between the lines:
2. A bus has 20 devices of one unit load each. How many more devices of 1/8 unit load can be added before the bus reaches 32 unit loads?
3. A gateway uses a 3.3 V transceiver on a bus with two 120 Ω terminations. Find the largest bias resistor that gives an idle voltage of 300 mV. Then find the load between the lines made by the terminations and that bias network alone, and compare it with 54 Ω.
4. A transceiver has a driver rise time of 50 ns, and the cable delay is 5 ns/m. Find the longest stub by the one-tenth rule. A meter must be connected by a 3 m drop cable: what is the shortest rise time that permits it?
Six devices on one RS-485 cable each have a switch for a 120 Ω termination resistor. Which switches should be on?
One edge leaves the device that sends and travels along the cable at 5 ns/m. At an open end it comes back. At the sending driver it is sent back again, smaller and inverted, so the level at the receiver rings up and down and slowly settles. A 120 Ω termination at an end absorbs the edge there. The receiver samples the middle of the bit, marked by the dashed line. The model has no cable loss and takes the driver as a source of about 40 Ω, so read the shape, not the exact percentages.
With no driver active, one small current flows from the supply through a bias resistor, the terminations and the second bias resistor to common. The voltage across the terminations is the idle voltage between B and A. The worst case takes the supply 5 percent low and both bias resistors 5 percent high. As in the lesson, each unit load is taken as 24 kΩ between the lines, and the receivers are left out of the idle voltage. The driver output is specified into 54 Ω or more.
Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.
1. A new gateway has a 3.3 V transceiver. It keeps the 390 Ω bias resistors that gave the cold store bus 357 mV, and the bus keeps its two 120 Ω terminations. What is the idle voltage now?
2. A bus is 600 m long, with a delay of 5 ns/m, and runs at 38400 baud. The gateway at one end polls meters along the cable. Where should it be terminated?
3. The cold store bus has six nodes of one unit load each and the 390 Ω bias. Can you add 20 new meters of 1/2 unit load each to the same segment?
No comments yet. Questions, results from your own build, a better way to explain it: all welcome.
Kept on this device only. Nothing is sent anywhere.
Tip: select words in the lesson, or tap a figure or an equation, to put a note right there.
The lesson has changed and these words are no longer in it. Your notes are kept, with the words you chose.