Node-RED for IoT
Introduction
Your ESP32 publishes MQTT messages, now what? Node-RED is a visual flow editor that runs on a Raspberry Pi, laptop, or server. You drag nodes (MQTT in, JSON parse, dashboard gauge, HTTP post) and wire them without recompiling firmware.
In HBO-ICT IoT projects, Node-RED is the usual glue between devices, databases, and dashboards. It pairs with MQTT and IoT messaging and Connectivity architecture.
What Node-RED does
1 2 3 | |
| Piece | Role |
|---|---|
| Flow | One canvas of connected nodes |
| Inject | Manual or timed test trigger |
| MQTT nodes | Subscribe/publish to broker |
| Function | Small JavaScript snippet on message |
| Dashboard | Buttons and charts in browser |
In plain terms
Node-RED is Lego for data pipes. Firmware sends one JSON blob; Node-RED splits, filters, and shows it, without flashing the MCU again.
Typical lab setup
- Mosquitto broker on Pi or PC (
1883) - Node-RED installed (
node-red-start) - MCU publishes
lab/device1/temperature - Flow subscribes, converts payload, updates UI
- Optional: flow publishes
lab/device1/cmd/ledback to device
Broker address, use static IP or hostname everyone agrees on.
Security (do not skip in production)
- Change default editor port protection, set admin password
- Use TLS on MQTT when not on isolated lab VLAN
- Do not expose Node-RED editor to the public internet without hardening
Official guides: Securing Node-RED
Custom nodes (advanced)
Teams sometimes package reusable flows as custom nodes, same idea as firmware modules, but in JavaScript.
Videos, other ways to learn
Fundamentals (part 1)
Intro to Node-RED: Part 1 Fundamentals
MQTT publish and subscribe in Node-RED
MQTT Publish and Subscribe Using Node Red
End-to-end ESP8266 demo
[DEMO] ESP8266 and Node-RED with MQTT
Relevant topics
- MQTT and IoT messaging
- Computer networks
- Wireless for embedded
- Docker for edge and IoT
- Connectivity architecture
Starting points
- Install Node-RED on a Pi; open editor at
http://<pi-ip>:1880. - Drag MQTT In + Debug; subscribe to
#and see traffic. - Publish test message with
mosquitto_pub; watch Debug panel. - Add Dashboard gauge, show one sensor field.
Focus points
- Topic naming, match MCU firmware exactly (case sensitive).
- JSON, invalid payload breaks Function node; validate in Debug first.
- One flow per concern, sensor ingest vs command outbound.
- Version flows, export JSON to Git with your project.
Key points
- Node-RED connects MQTT devices to dashboards and backends without MCU changes.
- Runs on Pi/PC/server next to your MQTT broker.
- Learn MQTT first, then wire flows; secure before leaving the lab network.