Modbus RTU over RS-485 is the most common serial communication setup in industrial automation. It connects PLCs, sensors, drives, meters, and other field devices on a simple two-wire bus.
The protocol itself is straightforward. But getting it to work reliably depends on getting the details right — wiring, termination, addressing, baud rate, parity, and register mapping all need to match across every device on the bus.
This guide walks you through the full process. From physical wiring to software configuration, you will learn what to set, why it matters, and what goes wrong when it is done incorrectly.
In This Guide
1. What Is Modbus RTU and Why RS-485
Modbus was developed in 1979 by Modicon (now Schneider Electric) for communication between PLCs. It is an open, royalty-free protocol — any manufacturer can implement it without licensing fees.
Modbus RTU (Remote Terminal Unit) is the serial variant that uses binary encoding. It is more compact and faster than Modbus ASCII, which is why RTU is the default choice for most industrial applications.
RS-485 is the physical layer standard used to carry Modbus RTU signals. It was chosen for several reasons:
- Multi-drop: One master can communicate with up to 32 slaves on a single bus (up to 256 with repeaters).
- Long distance: RS-485 supports cable lengths up to 1200 meters (4000 feet) depending on baud rate.
- Noise resistance: It uses differential signaling (two wires, A and B), which rejects common-mode noise — critical in electrically noisy industrial environments.
- Half-duplex: Communication alternates between send and receive on the same wire pair, keeping wiring simple.
2. RS-485 Wiring and Bus Topology
Bus Topology
Modbus RTU over RS-485 uses a daisy-chain bus topology. The cable runs from the master to the first slave, then to the second slave, and so on. The last device on the bus is the end of the line.
Do not use star or stub wiring. Star connections create signal reflections that corrupt data. If you must connect a device off the main bus, keep the stub cable as short as possible — under 1 meter is best.
Cable Requirements
| Parameter | Recommendation |
|---|---|
| Cable type | Shielded twisted pair (STP), 24 AWG or thicker |
| Characteristic impedance | 120 ohms (matches termination resistor) |
| Number of pairs | 1 pair for half-duplex (A and B), plus ground |
| Shield | Connect shield to ground at one end only (to avoid ground loops) |
| Max cable length | 1200 m at 9600 baud, shorter at higher baud rates |
Pin Connections
RS-485 uses two signal wires plus a reference ground:
| Signal | Label | Function |
|---|---|---|
| A (−) | D− or TxD−/RxD− | Inverting (negative) signal line |
| B (+) | D+ or TxD+/RxD+ | Non-inverting (positive) signal line |
| GND | Common | Signal reference ground — always connect this |
⚠️ Warning: There is no universal standard for A/B labeling. Some manufacturers swap A and B. Always check the device manual. If communication fails with no obvious cause, try swapping A and B — this is one of the most common wiring mistakes.
3. Termination and Biasing
Line Termination
Place a 120-ohm termination resistor at each end of the RS-485 bus — one at the master and one at the last slave. This matches the cable impedance and prevents signal reflections.
Do not add termination resistors in the middle of the bus or on every device. Only the two physical ends of the cable need them.
Biasing Resistors
When the bus is idle (no device transmitting), the A and B lines float to an undefined state. This can cause slaves to interpret noise as valid data.
Biasing resistors force the bus to a known idle state:
- Pull-up resistor (390–560 ohms) from B+ to +5V
- Pull-down resistor (390–560 ohms) from A− to GND
Many Modbus masters and RS-485 converters have built-in biasing that can be enabled via a DIP switch or jumper. Check your hardware before adding external resistors.
💡 Pro Tip: If you see random garbage data or framing errors when no device is transmitting, the bus likely needs biasing resistors. This is especially common on long cable runs or buses with fewer than 5 devices.
4. Step-by-Step: Configure the Master
The master (client) initiates all communication. It sends requests and waits for responses. Only one master is allowed on a Modbus RTU bus.
Serial Port Settings
All devices on the bus must use identical serial port settings:
| Parameter | Common Values | Notes |
|---|---|---|
| Baud rate | 9600, 19200, 38400, 115200 | 9600 is the most common default |
| Data bits | 8 | Always 8 for Modbus RTU |
| Parity | Even (recommended), None, Odd | Even parity is the Modbus standard default |
| Stop bits | 1 (with parity) or 2 (without parity) | If parity = None, use 2 stop bits to maintain 11-bit character frame |
Master Configuration
| Parameter | Setting | Notes |
|---|---|---|
| Mode | RTU | Not ASCII |
| Response timeout | 300–1000 ms | Time to wait for slave response before declaring error |
| Retry count | 2–3 | Number of retries on timeout or CRC error |
| Poll interval | 100–1000 ms | Time between successive polls to the same slave |
| Scan order | Sequential | Poll slave 1, then slave 2, etc. in round-robin |
5. Step-by-Step: Configure the Slave
Each slave (server) device on the bus must be configured with a unique address and matching serial settings.
Slave Settings
| Parameter | Setting | Notes |
|---|---|---|
| Slave address | 1 to 247 | Must be unique on the bus. Address 0 is reserved for broadcast. |
| Baud rate | Must match master | All devices share the same baud rate |
| Parity | Must match master | Mismatch causes every message to fail |
| Data bits / Stop bits | Must match master | Must be identical across the entire bus |
What the Slave Does
- Listens to every message on the bus.
- Checks the slave address field in each message.
- Ignores messages addressed to other slaves.
- Processes messages addressed to itself and sends a response.
- Accepts broadcast messages (address 0) but does not respond to them.
⚠️ Warning: Never assign the same address to two slaves on the same bus. Both devices will try to respond at the same time, causing bus collisions and corrupted data.
6. Modbus Data Model: Register Types Explained
Modbus organizes all data into four register types. Each type has its own address range and access rules.
| Register Type | Legacy Prefix | Access | Size | Function Code (Read) | Function Code (Write) |
|---|---|---|---|---|---|
| Coils | 0xxxx | Read/Write | 1 bit | FC 01 | FC 05 (single), FC 15 (multiple) |
| Discrete Inputs | 1xxxx | Read-Only | 1 bit | FC 02 | — |
| Input Registers | 3xxxx | Read-Only | 16-bit word | FC 04 | — |
| Holding Registers | 4xxxx | Read/Write | 16-bit word | FC 03 | FC 06 (single), FC 16 (multiple) |
In practice, most devices map everything to holding registers (4xxxx). You will use FC 03 (Read Holding Registers) and FC 16 (Write Multiple Registers) for the majority of your work.
Each register is 16 bits. For 32-bit values (like floating-point numbers), two consecutive registers are used. The device manual will tell you the byte order — some devices use big-endian, others use little-endian or word-swapped formats.
7. Function Codes You Need to Know
You do not need to memorize all Modbus function codes. In day-to-day work, these six cover 95% of tasks:
| Code | Hex | Name | What It Does |
|---|---|---|---|
| 01 | 0x01 | Read Coils | Reads 1-bit ON/OFF values (digital outputs) |
| 02 | 0x02 | Read Discrete Inputs | Reads 1-bit input status (digital inputs) |
| 03 | 0x03 | Read Holding Registers | Reads 16-bit read/write registers — the most used function |
| 04 | 0x04 | Read Input Registers | Reads 16-bit read-only registers (measurements) |
| 06 | 0x06 | Write Single Register | Writes one 16-bit value to a holding register |
| 16 | 0x10 | Write Multiple Registers | Writes multiple consecutive 16-bit holding registers |
Exception Responses
If a slave cannot process a request, it responds with an exception. The function code in the response has the high bit set (original code + 0x80). For example, if FC 03 fails, the response contains FC 0x83.
Common exception codes:
| Code | Meaning | Likely Cause |
|---|---|---|
| 01 | Illegal Function | The slave does not support this function code |
| 02 | Illegal Data Address | The requested register address does not exist |
| 03 | Illegal Data Value | The value you tried to write is out of range |
| 04 | Slave Device Failure | The slave encountered an internal error |
8. Addressing: The Zero-Based Offset Trap
This is the single biggest source of confusion in Modbus.
The Modbus data model numbers registers starting from 1 (e.g., Holding Register 40001). But the actual address sent in the Modbus PDU starts from 0.
So when a device manual says “read register 40001,” the Modbus frame sends address 0x0000. Register 40010 becomes address 0x0009.
The conversion rule:
PDU address = Register number − 1
Some SCADA software and tools handle this offset automatically. Others expect you to enter the raw PDU address. Always check which convention your software uses — if your readings are shifted by one register, this is almost certainly the cause.
💡 Pro Tip: When commissioning a new device, start by reading a known register (like a device ID register) to verify your addressing is correct before mapping hundreds of points.
9. Timing: Baud Rate, T1.5, and T3.5
Modbus RTU uses timing gaps (silent intervals) to separate messages on the bus. This is different from Modbus ASCII, which uses start/end characters.
T3.5 — Frame Delimiter
A gap of at least 3.5 character times of silence marks the boundary between messages. The master and slave both use this gap to detect the start and end of a frame.
At 9600 baud with 11-bit characters, one character takes about 1.146 ms. So T3.5 = approximately 4 ms.
T1.5 — Character Spacing
Within a single message frame, the gap between consecutive characters must not exceed 1.5 character times. If a longer gap appears mid-frame, the receiver will discard the incomplete message as a CRC error.
Practical Impact
| Baud Rate | T1.5 (approx.) | T3.5 (approx.) |
|---|---|---|
| 9600 | 1.7 ms | 4.0 ms |
| 19200 | 0.86 ms | 2.0 ms |
| 38400 | 0.43 ms | 1.0 ms |
| 115200 | 0.14 ms | 0.33 ms |
⚠️ Warning: At baud rates above 19200, the Modbus specification fixes T1.5 at 750 µs and T3.5 at 1.75 ms (rather than calculating from character time). Some devices do not follow this rule, which can cause intermittent CRC errors at higher baud rates. If you see random failures at 38400 or 115200, try dropping to 19200.
10. Troubleshooting Common Modbus RTU Issues
| Problem | Likely Cause | Solution |
|---|---|---|
| No response from any slave | Wiring wrong (A/B swapped), baud rate mismatch, or wrong COM port | Check wiring. Verify serial settings match on all devices. Try swapping A and B. |
| Timeout errors on specific slaves | Slave address mismatch or device offline | Verify slave address. Check that the device is powered and on the bus. |
| CRC errors | Electrical noise, missing termination, or cable too long | Add 120-ohm termination at both bus ends. Check cable shielding and grounding. |
| Intermittent communication | Loose connections, stub wiring, or timing issues | Inspect all screw terminals. Eliminate star wiring. Try a lower baud rate. |
| Wrong data values | Register address offset (zero-based vs. one-based) | Subtract 1 from the register number if your tool uses PDU addressing. |
| Slave returns exception 02 | Illegal data address — register does not exist | Check device manual for the correct register map. |
| All readings are zero | Reading the wrong register type (input vs. holding) | Verify you are using the correct function code (FC 03 vs. FC 04). |
| Garbage data on bus idle | Bus floating — no biasing resistors | Enable biasing on the master or add external pull-up/pull-down resistors. |
| Communication works then stops | Response timeout too short or bus overloaded | Increase timeout. Reduce poll frequency. Check for duplicate slave addresses. |
Summary
Setting up Modbus RTU over RS-485 is not complicated, but it requires attention to detail. Every device on the bus must share the same serial settings. The wiring must follow daisy-chain topology with proper termination. And register addressing must account for the zero-based offset in the Modbus PDU.
Here is a quick checklist before going live:
- Wiring: daisy-chain, shielded twisted pair, 120-ohm termination at both ends
- Serial settings: same baud rate, parity, data bits, and stop bits on every device
- Addresses: unique slave address (1–247) for each device
- Registers: correct function code for the register type, correct zero-based offset
- Timeouts: response timeout set long enough for the slowest slave to respond
Modbus RTU has been in the field for over 45 years. It works. When it does not, the problem is almost always in the wiring or configuration — not in the protocol itself.
