ReadsNode-RED Modbus Example
Read a String Register (Device Name / Firmware Version)
Some Modbus devices expose text — serial numbers, firmware strings, model names — in consecutive registers, two ASCII characters per register. This example reads 8 registers and assembles them into a human-readable string.
What you need
- Node-RED v3+
- node-red-contrib-modbus installed
- Device that exposes string registers (check datasheet for character registers)
Flow Overview
registers 100–107: 0x4D6F → "Mo" 0x6462 → "db" 0x7573 → "us" 0x2044 → " D" 0x6576 → "ev" 0x6963 → "ic" 0x6520 → "e " 0x0000 → "" Assembled: "Modbus Device"
Node-RED Flow JSON
To import: open Node-RED → Hamburger menu → Import → paste this JSON → Deploy.
Expected Output
msg.payload = "Modbus Device v1.4" // A human-readable string extracted from 8 holding registers
Common Gotchas
- Some devices store strings low-byte-first (lo = first char) — swap hi and lo if you get reversed text.
- Null-terminated strings stop at the first 0x00 byte; pad-terminated strings fill unused space with spaces (0x20).
- Register count = ceil(string_length / 2) — a 14-character string needs 7 registers.
- Some devices use FC04 (input registers) for device information strings.
- Always trim and filter null bytes — Buffer.toString('ascii') works too if you assemble a Buffer instead.
Same in ModPackQT — in 30 seconds
ModPackQT displays register values as hex, decimal, or ASCII — switch format in the row dropdown. String decoding requires no custom function node.
Was this example helpful?
More Reads examples