Modbus Explained: Industrial Communication Protocol over RS485 and TCP

Modbus is one of the most widely used communication protocols in industrial automation. It is commonly found in PLC systems, energy meters, temperature controllers, motor drives, sensors, remote I/O modules and many other industrial devices.

Modbus is often used together with RS485, but Modbus and RS485 are not the same thing. RS485 is the electrical layer. Modbus is the communication protocol that defines messages, addresses and data access.

What Is Modbus?

Modbus is a protocol for communication between a controller and one or more devices.

A Modbus system usually has:

  • One controller, often called the master or client
  • One or more devices, often called slaves or servers
  • Device addresses
  • Registers and coils that store data
  • Function codes that define the requested operation

The controller asks a device for data or writes data to it. The device then responds.

Modbus RTU and Modbus TCP

The two most common Modbus versions are Modbus RTU and Modbus TCP.

Modbus RTU:

  • Usually used over RS485
  • Compact binary message format
  • Very common in industrial field devices
  • Requires baud rate, parity and device address settings

Modbus TCP:

  • Used over Ethernet or WiFi networks
  • Uses TCP/IP communication
  • Common in PLCs, gateways and monitoring systems
  • Uses IP addresses instead of only serial bus addressing

Modbus vs RS485

This is one of the most common points of confusion.

Term What It Is What It Defines
RS485 Electrical standard Voltage signaling, differential pair, bus wiring
Modbus RTU Communication protocol Device addresses, function codes, registers, messages
Modbus TCP Network protocol version Modbus communication over TCP/IP networks

RS485 provides the physical connection. Modbus defines what the data means.

Modbus Device Addresses

In Modbus RTU, each device on the bus needs a unique address.

Typical address range:

  • 1 to 247 for normal devices
  • 0 is commonly used for broadcast in some systems

If two devices use the same address on the same RS485 bus, communication will fail or become unpredictable.

Registers and Coils

Modbus data is organized into different data areas.

Common Modbus data types:

  • Coils: single-bit read/write outputs
  • Discrete inputs: single-bit read-only inputs
  • Input registers: 16-bit read-only values
  • Holding registers: 16-bit read/write values

Many industrial devices store measured values, settings and status information in holding registers or input registers.

Function Codes

Modbus function codes define what the controller wants to do.

Common function codes include:

  • 01: Read coils
  • 02: Read discrete inputs
  • 03: Read holding registers
  • 04: Read input registers
  • 05: Write single coil
  • 06: Write single holding register
  • 15: Write multiple coils
  • 16: Write multiple holding registers

Most simple Modbus applications only use a few of these functions.

Example Modbus Use

A controller may ask an energy meter:

  • Device address: 5
  • Function: read holding registers
  • Starting register: 40001
  • Number of registers: 2

The energy meter responds with the requested data. The software then interprets those register values as voltage, current, power or energy depending on the device manual.

Register Number Confusion

Modbus register numbering can be confusing because manuals often use human-readable register numbers that are not always the same as the zero-based address used in software.

For example:

  • A manual may list holding register 40001
  • Software may need address 0

This offset is a very common Modbus problem. If the values are wrong or shifted, checking the register base address is one of the first debugging steps.

16-Bit Registers and Larger Values

Modbus registers are 16-bit values. Larger values require multiple registers.

Examples:

  • 32-bit integer: two registers
  • 32-bit floating-point value: two registers
  • 64-bit value: four registers

The byte order and word order must match the device documentation. Different devices may use different ordering.

Endian and Word Order Problems

When reading 32-bit values from Modbus, the data may appear wrong if the word order is not interpreted correctly.

Common formats include:

  • High word first
  • Low word first
  • Different byte order inside each word

This is especially common with floating-point values. If the result looks completely unrealistic, the register order may be wrong.

Modbus RTU Serial Settings

For Modbus RTU, all devices on the same bus must use compatible serial settings.

Common settings include:

  • Baud rate, such as 9600 or 19200
  • Data bits, usually 8
  • Parity, such as none, even or odd
  • Stop bits, usually 1 or 2

A common setting is 9600 baud, 8 data bits, even parity and 1 stop bit, but this is not universal.

CRC Error Checking

Modbus RTU messages include a CRC checksum. This helps detect corrupted messages.

CRC errors can be caused by:

  • Wrong baud rate
  • Wrong parity setting
  • Electrical noise
  • Poor RS485 wiring
  • Missing or incorrect termination

If CRC errors occur frequently, the issue is often electrical rather than purely software-related.

Modbus TCP

Modbus TCP carries Modbus messages over a TCP/IP network.

It is commonly used with:

  • Ethernet PLCs
  • Industrial gateways
  • SCADA systems
  • Monitoring software
  • Ethernet-to-RS485 converters

Modbus TCP is easier to route through normal networks, but it still uses the same basic Modbus idea of registers, function codes and device data.

Modbus Gateways

A Modbus gateway can connect different Modbus networks together.

Common gateway types:

  • Modbus TCP to Modbus RTU
  • Ethernet to RS485
  • WiFi to RS485
  • USB to RS485 for PC tools

These gateways are often used when older RS485 devices need to be connected to modern Ethernet or WiFi systems.

Typical Modbus Devices

Modbus is commonly used in:

  • Energy meters
  • Temperature and humidity controllers
  • Variable frequency drives
  • PLC systems
  • Remote I/O modules
  • Industrial sensors
  • Solar inverters and battery systems
  • Building automation controllers

This makes Modbus one of the most useful protocols to understand for industrial electronics and automation.

Common Modbus Problems

Typical Modbus problems include:

  • Wrong device address
  • Wrong baud rate or parity
  • A/B wires reversed on RS485
  • Missing RS485 termination
  • Register offset confusion
  • Wrong function code
  • Wrong word order for 32-bit values
  • Trying to write to read-only registers
  • Polling too many devices too quickly

Modbus debugging often requires checking both the physical RS485 wiring and the protocol settings.

Modbus Compared with Other Communication Methods

Communication Method Typical Use Main Advantage Main Limitation
Modbus RTU over RS485 Industrial field devices Simple and widely supported Requires correct register documentation
Modbus TCP Ethernet PLCs and gateways Works over IP networks Needs network infrastructure
I2C Local sensors and modules Very simple wiring Short-distance only
CAN Bus Vehicles and machines Strong arbitration and error handling More complex protocol stack

When to Use Modbus

Modbus is a good choice when:

  • You need to communicate with industrial equipment
  • The device already supports Modbus RTU or Modbus TCP
  • You need a simple register-based protocol
  • You are building a PLC or monitoring system
  • You need long-distance communication over RS485

When Not to Use Modbus

Modbus may not be the best choice when:

  • You only need simple communication between chips on one PCB
  • You need very high-speed data transfer
  • You need modern publish/subscribe messaging
  • You need strong built-in event-based communication

For IoT cloud messaging, MQTT may be more suitable. For local high-speed peripherals, SPI is usually better.

Practical Design Tips

  • Always check whether the device uses Modbus RTU or Modbus TCP
  • For Modbus RTU, confirm address, baud rate, parity and stop bits
  • For RS485, check A/B polarity, termination and bus topology
  • Read the device register map carefully
  • Watch for 0-based vs 1-based register addressing
  • Check word order when reading 32-bit values
  • Poll devices at a reasonable rate
  • Use a USB-to-RS485 adapter and Modbus test software for debugging

Conclusion

Modbus remains one of the most important communication protocols in industrial electronics. It is simple, widely supported and practical for connecting controllers, meters, sensors and PLC systems.

The most important thing to remember is that Modbus is the protocol, while RS485 is often the electrical connection used underneath it. A reliable Modbus RTU system depends on both correct protocol settings and good RS485 wiring.

Shopping Cart
Scroll to Top