Overview
The modbus node provides GPIO-level Modbus RTU and TCP communication
for direct sensor and device integration on edge hardware. It supports reading and writing coils, discrete
inputs, holding registers, and input registers across RS-485 serial buses or Ethernet TCP connections.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| mode | select | Yes | "rtu" | Communication mode: "rtu" or "tcp" |
| port | string | No | "/dev/ttyUSB0" | Serial port path (RTU mode) |
| baudRate | select | No | "9600" | Serial baud rate: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 |
| parity | select | No | "none" | Serial parity: "none", "even", "odd" |
| host | string | No | "127.0.0.1" | TCP host address (TCP mode) |
| tcpPort | number | No | 502 | TCP port number (TCP mode) |
| slaveId | number | No | 1 | Slave device address (1-247) |
| timeout | number | No | 1000 | Response timeout in milliseconds |
Inputs
{
"payload": {
"fc": 3,
"address": 0,
"quantity": 10
},
"slaveId": 1
} {
"payload": {
"fc": 6,
"address": 100,
"value": 2500
},
"slaveId": 1
} Outputs
{
"payload": [2500, 1800, 3200, 0, 0, 0, 0, 0, 0, 0],
"slaveId": 1,
"fc": 3,
"address": 0,
"quantity": 10,
"timestamp": "2025-01-15T10:30:00.000Z"
} {
"payload": true,
"slaveId": 1,
"fc": 6,
"address": 100,
"value": 2500
} Wiring Diagram (RS-485 RTU)
USB-to-RS485 Adapter
Raspberry Pi USB-RS485 Modbus Device
+-----------+ +---------+ +-----------+
| | USB | | A+ | |
| USB ---|--------| RS485 |--------|-- A+ |
| Port | | Adapter | B- | |
| | | |--------|-- B- |
+-----------+ +---------+ GND | |
--------|-- GND |
+-----------+ Wiring Notes
A+ connects to A+ on all devices (daisy-chain)
B- connects to B- on all devices (daisy-chain)
GND common ground between all devices
Tip: Add 120 ohm termination resistors at both ends of the RS-485 bus for long cable runs.
Example Use Cases
Read Temperature from Modbus Sensor
Poll a Modbus RTU temperature sensor every 5 seconds and display on dashboard.
[
{
"id": "poll-trigger",
"type": "inject",
"repeat": "5",
"payload": "{ "fc": 3, "address": 0, "quantity": 2 }",
"payloadType": "json"
},
{
"id": "modbus-read",
"type": "modbus",
"mode": "rtu",
"port": "/dev/ttyUSB0",
"baudRate": "9600",
"slaveId": 1
},
{
"id": "convert-temp",
"type": "function",
"name": "Convert Register to Temp"
},
{
"id": "temp-gauge",
"type": "gauge",
"name": "Temperature"
}
] Control Modbus Relay via TCP
Toggle a relay coil on a Modbus TCP device from a dashboard button.
[
{
"id": "relay-btn",
"type": "button",
"label": "Toggle Relay"
},
{
"id": "modbus-write",
"type": "modbus",
"mode": "tcp",
"host": "192.168.1.100",
"tcpPort": 502,
"slaveId": 1
},
{
"id": "write-debug",
"type": "debug",
"name": "Write Result"
}
] Multi-Slave Energy Monitor
Poll multiple Modbus energy meters and store readings to InfluxDB.
[
{
"id": "energy-poll",
"type": "inject",
"repeat": "10",
"payload": ""
},
{
"id": "meter-1",
"type": "modbus",
"mode": "rtu",
"port": "/dev/ttyUSB0",
"slaveId": 1,
"baudRate": "9600"
},
{
"id": "store-influx",
"type": "influxdb",
"measurement": "energy"
}
] Common Use Cases
Industrial Sensors
Poll temperature, pressure, and flow sensors on RS-485 bus
Energy Monitoring
Read power meters and energy analyzers via Modbus TCP
PLC Integration
Read/write PLC registers for process control automation
HVAC Control
Interface with HVAC controllers and VFDs over Modbus