Wiring a real bus
Off the desk, three things decide whether a bus works: A and B on one twisted pair, a ground wire run with them, and one line from end to end with the 120 Ω at its two ends. Each is cheap to get right and expensive to find later.
Three choices
A and B on one twisted pair
The whole trick of RS485 is that noise lands on A and B alike and cancels in the difference. That only holds while the two wires are the same distance from every source of noise, which is what twisting them does. Two loose wires a centimetre apart pick up different amounts, and the difference carries some of it through.
Network cable is a good, cheap choice: its pairs are about 100 Ω, close enough to the 120 Ω terminators. Use both wires of one pair for A and B.
Ground goes with the pair
The receiver reads A − B, but it still needs A and B to sit within −7 V to +12 V of its own ground. Two boards on separate supplies have no common ground unless a wire gives them one, and their grounds can drift volts apart — enough to push A and B outside that range, where the receiver reads nothing or reads garbage.
That is what the middle screw of the terminal is for: GND to GND, along the cable, with A and B. A third wire of the same cable, or a wire from the next pair, does it.
On a desk this is easy to miss. Two boards powered from the same computer already share its ground through the USB cables, so the bus works without the GND wire, and then fails the day one board moves to its own power supply.
One line, end to end
Run the cable past every board, from the first to the last, and keep the short stub from the cable to each board's terminal as short as you can. That is a daisy chain, and it has exactly two ends, which is where the two 120 Ω resistors go. Take them off every other board, as in Only the two ends keep it.
A star — branches from a centre point to each board — has as many ends as it has branches, and there is no right place for two terminators. It works on a short, slow bus and misbehaves on a long, fast one.
Before you power it
With everything wired and the power off, measure across A and B at any terminal. About 60 Ω means two terminators, one at each end. About 120 means one is missing; under about 50 means some middle board still has its resistor.
When it does not work
Yes, and it is a good choice: four twisted pairs of about 100 Ω. Put A and B on the two wires of one pair, orange and orange-white for example, and use a wire from another pair for GND. A from one pair and B from another is two loose wires as far as noise is concerned.
Run it. Two earths in different places can sit volts apart, and the receivers need A and B within −7 to +12 V of their own ground. The ground wire keeps every board close to the same zero. Between buildings, or near heavy machinery, use isolated transceivers, which these boards are not.
As short as you can make them. A stub is a branch off the bus, and every branch is an unterminated end. A few centimetres of wire from the pair to the terminal is fine at 9600 baud; a metre-long tail is asking for echoes on a long, fast bus.
The standard covers about 1200 m, at slow speeds. At 9600 baud on decent twisted pair with both ends terminated, hundreds of metres is ordinary. Go slower before you go further: every halving of the baud rate doubles the time each bit has to settle.
Edit this page — content/books/rs485/wiring-a-real-bus.mdx
Questions about this product
See what other owners have asked, and read their solutions.
This page covers several products. Choose yours to see the right discussions.
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.