ReadsNode-RED Modbus Example
Read Input Registers (FC04)
Input registers (3x range) are read-only 16-bit values — typically live sensor readings like temperature, pressure, or ADC counts. This example reads 8 input registers on a 2-second poll cycle.
What you need
- Node-RED v3+
- node-red-contrib-modbus installed
- Modbus TCP slave with input registers
Flow Overview
┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐ ┌────────────┐
│ Inject (2s) │──▶│ Modbus Flex Getter │──▶│ Function │──▶│ Debug │
│ │ │ FC04 · addr:0 · qty:8 │ │ extract data │ │ │
└──────────────┘ └──────────────────────────┘ └──────────────┘ └────────────┘
Modbus TCP port 502
(slave's read-only process values)
Node-RED Flow JSON
To import: open Node-RED → Hamburger menu → Import → paste this JSON → Deploy.
Expected Output
msg.payload = [8432, 9100, 7234, 6001, 5500, 5498, 5502, 0] // 8 UINT16 values from input registers 30001–30008
Common Gotchas
- Input registers (FC04) and holding registers (FC03) have separate address spaces — address 0 in each refers to a different register.
- Most energy meters expose real-time measurements (V, A, W) in the input register table.
- You cannot write to input registers; use holding registers for setpoints.
- The modbus-flex-getter dataType must be 'InputRegister' (capital I, capital R) — exact string match.
- If your device only implements FC03, map input register addresses to holding registers in device settings.
Same in ModPackQT — in 30 seconds
ModPackQT lets you switch between FC03 and FC04 with a dropdown — no need to rewire a flow. The register table shows all values live with timestamps.
Was this example helpful?
More Reads examples