Modbus Serial Client
This page documents the client route (
MODBUS_SERIAL) over serial RTU—the broker connects to a remote Modbus device on a COM port. For Modbus TCP client, see Modbus TCP Client.MODBUS_SERIAL route enables communication with industrial devices using Modbus RTU protocol over serial connections (RS-232 or RS-485). It supports the same TAG-based configuration as Modbus TCP but adds serial-specific parameters for baud rate, parity, and data bits.
Basic Syntax
Serial Configuration
MODBUS_CONFIG Parameters
string
required
Must be set to
SERIAL for serial communication.string
required
Serial port name. Windows:
COM1, COM2, etc. Linux: /dev/ttyUSB0, /dev/ttyS0, etc.integer
required
Communication speed in bits per second. Common values: 9600, 19200, 38400, 57600, 115200.
string
Parity checking:
NONE, ODD, EVEN, MARK, or SPACE. Default: NONE.integer
Number of data bits per character: 7 or 8. Default: 8.
string
Number of stop bits:
ONE, TWO, or ONEPOINTFIVE. Default: ONE.integer
required
Modbus slave/unit ID (1-247). Each device on the bus must have a unique ID.
integer
Read operation timeout in milliseconds. Default: 1000.
integer
Write operation timeout in milliseconds. Default: 1000.
integer
Number of retry attempts on failure. Default: 3.
integer
Delay between retries in milliseconds. Default: 100.
Common Serial Settings
Different devices use different serial settings. Here are common configurations:- Standard (Most Common)
- Even Parity
- High Speed
- Linux USB Adapter
RS-485 Multi-Drop Networks
RS-485 allows multiple devices on a single bus. Each device must have a unique slave ID:Multi-Device Configuration
Create separate routes or use different slave IDs:TAG Configuration
The TAG configuration for Modbus Serial matches Modbus TCP, including string sizing. See the Modbus TCP Client documentation for the full TAG parameter reference.String sizing
ForSTRING tags, WITH LENGTH sets the maximum string size in bytes (default 256). STRING_SIZE is accepted as an alias. Each register holds two bytes, so the route reads enough consecutive registers from the tag’s starting ADDRESS to cover the configured size.
TAG parameters
integer
default:"256"
STRING only. Maximum string size in bytes. The route allocates consecutive registers from the starting
ADDRESS (2 bytes per register). Alias: STRING_SIZE.Quick Reference
Event-Based Operations
For on-demand Modbus Serial operations (not polling), use the EVENT syntax. Publish a message to SOURCE_TOPIC to trigger the operation; the route executes it and publishes the result to DESTINATION_TOPIC. Modbus Serial supports the same EVENT operations as Modbus TCP. See the Modbus TCP Client Event-Based Operations for the full supported operations table and query parameter details.Read Example
Read 10 holding registers on demand:Write Example
Write a single register on demand:Complete Examples
- Single Device
- Temperature Controller
- VFD (Variable Frequency Drive)
- Combined (Cyclic + On-Demand)
Basic connection to a single Modbus RTU device:
Troubleshooting
No Communication
No Communication
- Verify COM port is correct and not in use by another application
- Check physical wiring (TX/RX, A/B for RS-485)
- Ensure baud rate matches device settings
- Verify slave ID is correct
- Check device power and status indicators
CRC Errors
CRC Errors
- CRC errors indicate data corruption
- Check cable quality and length
- For RS-485, ensure proper termination resistors (120Ω at each end)
- Reduce baud rate for long cable runs
- Check for electrical interference
Timeout Errors
Timeout Errors
- Increase
READ_TIMEOUTvalue - Verify serial settings match device exactly
- Check for bus conflicts (multiple masters)
- For RS-485, ensure proper biasing
Incorrect Values
Incorrect Values
- Verify register addresses in device documentation
- Check
BYTE_ORDERandWORD_ORDERsettings - Confirm
DATA_TYPEmatches register size - Some devices use 1-based addressing (subtract 1 from documented address)
Port Not Found
Port Not Found
- Windows: Check Device Manager for correct COM port number
- Linux: Check
/dev/tty*withls -l /dev/tty* - Ensure USB-to-serial driver is installed
- Verify user has permissions to access serial port
RS-485 Wiring Tips
Proper wiring is critical for reliable RS-485 communication.
Best Practices:
- Use twisted pair cable for A and B lines
- Add 120Ω termination resistors at both ends of the bus
- Keep cable length under 1200m (4000ft)
- Use bias resistors if experiencing idle-line issues
- Ensure all grounds are connected
Next Steps
Modbus TCP Client
Connect to Modbus devices over Ethernet.
Siemens S7
Connect directly to Siemens PLCs.

