Skip to content
BoKSA

Node-RED for IoT

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
[ MQTT in ] → [ JSON ] → [ function ] → [ dashboard chart ]
                ↓
           [ InfluxDB / file / email ]
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

  1. Mosquitto broker on Pi or PC (1883)
  2. Node-RED installed (node-red-start)
  3. MCU publishes lab/device1/temperature
  4. Flow subscribes, converts payload, updates UI
  5. Optional: flow publishes lab/device1/cmd/led back 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


Starting points

  1. Install Node-RED on a Pi; open editor at http://<pi-ip>:1880.
  2. Drag MQTT In + Debug; subscribe to # and see traffic.
  3. Publish test message with mosquitto_pub; watch Debug panel.
  4. 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.