ModPackQTModPackQT
ResourcesSign up
HomeResourcesNode-RED Modbus Examples
30 copy-paste examples

Node-RED Modbus Examples

Real, paste-ready Node-RED flows for every Modbus data type — from basic FC03 reads to 32-bit floats in all byte orders, MQTT bridges, and InfluxDB logging. Every example includes a "same in ModPackQT in 30 seconds" shortcut.

Category:
Setup: All examples use node-red-contrib-modbus. Install it via Manage Palette in Node-RED or run npm install node-red-contrib-modbus in your Node-RED directory. Update the tcpHost in the modbus-client config node to your device's IP address.

Reads

6 examples

Read Holding Registers (FC03)

Reads

Reading holding registers is the most common Modbus operation.

View example

Read Input Registers (FC04)

Reads

Input registers (3x range) are read-only 16-bit values — typically live sensor readings like temperature, pressure, or ADC counts.

View example

Read Coils (FC01) and Discrete Inputs (FC02)

Reads

Digital I/O over Modbus.

View example

Read FLOAT32 Across All Four Byte Orders

Reads

Reading a 32-bit float is straightforward once you know the byte order.

View example

Read 32-bit Integers (INT32 / UINT32)

Reads

Energy counters, position feedback, and large totals often come back as 32-bit integers spread across two registers.

View example

Read a String Register (Device Name / Firmware Version)

Reads

Some Modbus devices expose text — serial numbers, firmware strings, model names — in consecutive registers, two ASCII characters per register.

View example

Writes

4 examples

Write a Single Register (FC06)

Writes

Writing a single holding register (FC06) is how you send setpoints, configuration values, or commands to a Modbus device.

View example

Write a Single Coil ON/OFF (FC05)

Writes

Writing a coil controls a digital output — a relay, an LED, a solenoid.

View example

Write Multiple Registers — Including FLOAT32 (FC16)

Writes

FC16 writes a block of consecutive holding registers atomically.

View example

Mask Write Register (FC22) — Set/Clear Individual Bits

Writes

FC22 lets you flip individual bits in a holding register without disturbing the rest.

View example

Integration

5 examples

Modbus → MQTT Bridge

Integration

Forward Modbus register values to an MQTT broker so other systems (dashboards, cloud platforms, other PLCs) can subscribe.

View example

Log Modbus Data to InfluxDB

Integration

Store Modbus register values as time-series data in InfluxDB for trending, analytics, and dashboards (Grafana, Chronograf).

View example

Threshold Alert — Notify When a Register Exceeds a Limit

Integration

Trigger an alert when a Modbus register value crosses a threshold — an email, a Telegram message, or a webhook.

View example

Live Modbus Dashboard with Gauges

Integration

Display live Modbus values in a Node-RED Dashboard with gauge and chart widgets.

View example

Handle Modbus Exceptions and Timeouts Cleanly

Integration

Modbus communication fails — devices go offline, CRC errors happen, exception responses arrive.

View example

Slave TCP

2 examples

Modbus TCP Server — Update Holding Registers

Slave TCP

This example turns Node-RED into a Modbus TCP slave (server) and shows how to update holding register values in the server's memory so any Modbus master can read them with FC03.

View example

Modbus TCP Server — Update Coil Registers

Slave TCP

Extend the Modbus TCP slave example to coil registers (0x range).

View example

Slave RTU

4 examples

Modbus RTU Server — Update Holding Registers

Slave RTU

Run a Modbus RTU slave directly from Node-RED over a serial port (RS-485 or USB-to-serial adapter) and keep its holding registers fresh from your flows.

View example

Modbus RTU Server — Update Coil Registers

Slave RTU

Expose boolean output states (relays, valve open/close, enable flags) from Node-RED as Modbus RTU coils over RS-485.

View example

Modbus RTU Slave — Publish Sensor Data as Read-Only Registers

Slave RTU

In node-red-contrib-modbus, there is no standard Modbus function code that lets a Node-RED flow write into input registers (FC04) — those are truly read-only from the master's side by spec.

View example

Modbus RTU Slave — Publish Boolean States via Coils

Slave RTU

Discrete inputs (FC02) in node-red-contrib-modbus cannot be updated from user flows — their buffer is not writable via any standard Modbus function code.

View example

Master TCP

2 examples

Modbus TCP Master — Read Registers

Master TCP

A focused Modbus TCP master read flow covering all four register types — holding (FC03), input (FC04), coils (FC01), and discrete inputs (FC02) — over a single TCP connection.

View example

Modbus TCP Master — Write Registers

Master TCP

A complete Modbus TCP master write reference covering single register (FC06), multiple registers (FC16), and single coil (FC05) writes.

View example

Master RTU

2 examples

Modbus RTU Master — Read Registers

Master RTU

Poll a Modbus RTU slave over RS-485 from Node-RED.

View example

Modbus RTU Master — Write Registers

Master RTU

Send FC06 (single register), FC16 (multiple registers), and FC05 (single coil) write commands over Modbus RTU from Node-RED.

View example

Data Types

5 examples

Float32 Decode — All Byte Orders in Node-RED

Data Types

32-bit IEEE 754 floats span two consecutive 16-bit Modbus registers.

View example

INT16 / UINT16 Scaling in Node-RED

Data Types

Every raw Modbus holding and input register value is a 16-bit unsigned integer (0–65535).

View example

INT32 / UINT32 in Node-RED

Data Types

32-bit integers span two Modbus registers (like float32) and can be signed (INT32: −2 billion to +2 billion) or unsigned (UINT32: 0 to 4.

View example

INT64 / Long (64-bit) in Node-RED

Data Types

Some high-precision energy meters and counters store 64-bit integer values across four consecutive Modbus registers.

View example

Boolean / Coil Bit Handling in Node-RED

Data Types

Modbus coils (FC01) and discrete inputs (FC02) return boolean arrays in Node-RED.

View example

Skip the flow wiring entirely

Every example in this directory can be done in ModPackQT with a few clicks — no JavaScript, no function nodes, no flow deployments. Works with Modbus TCP and RTU.

ModPackQT · Node-RED Modbus Examples · Updated 2026

TermsPrivacyPricingResources