ReadsNode-RED Modbus Example
Read Holding Registers (FC03)
Reading holding registers is the most common Modbus operation. This example polls 4 consecutive registers from a TCP slave every 5 seconds and logs the raw 16-bit values. It covers the basic wiring you'll reuse in almost every project.
What you need
- Node-RED v3+ installed
- node-red-contrib-modbus installed (npm install node-red-contrib-modbus)
- A Modbus TCP slave device or simulator accessible on your network
Flow Overview
┌─────────────────┐ ┌──────────────────────────┐ ┌────────────────┐
│ Inject (5s) │───▶│ Modbus Flex Getter │───▶│ Debug (vals) │
│ [trigger] │ │ FC03 · addr:0 · qty:4 │ │ │
└─────────────────┘ │ Server: 192.168.1.100:502│ └────────────────┘
└──────────────────────────┘
Modbus TCP slave
(responds with 4 registers)
Node-RED Flow JSON
To import: open Node-RED → Hamburger menu → Import → paste this JSON → Deploy.
Expected Output
msg.payload = {
data: [1234, 5678, 100, 0], // raw UINT16 values
buffer: <Buffer 04 d2 16 2e 00 64 00 00>
}Common Gotchas
- Register address 0 in Node-RED corresponds to datasheet address 40001 — you do NOT add 40000.
- If the device does not respond, confirm the unit ID matches the slave's configured slave address.
- The modbus-flex-getter output has two ports: port 1 = data, port 2 = full Modbus response object.
- Default timeout is 1000 ms — increase it for slow serial-to-TCP gateways.
- Multiple Modbus nodes sharing one modbus-client will queue requests, not send simultaneously.
Same in ModPackQT — in 30 seconds
In ModPackQT you do the same thing — enter the IP, port, start address, and count — and click Poll. No flow wiring required. Results appear in the register table instantly, with optional live graphing.
Was this example helpful?
More Reads examples