Quick answer: Node-RED is a free, browser-based visual programming tool for wiring devices, APIs and services together. You drag nodes onto a canvas, connect them into flows, and messages (msg, with the data in msg.payload) travel along the wires. Install it on a Raspberry Pi, PC or Docker, open http://<host>:1880, build Inject → Function → Debug as your first flow, then connect ESP32 boards through MQTT, add a Dashboard 2.0 interface, and automate with schedules and conditions. This guide is the roadmap, with links to a detailed tutorial for every step.
Node-RED runs on a computer, server or Raspberry Pi, not on the ESP32 itself. The ESP32 runs its own firmware, reads sensors and switches pins; Node-RED receives its messages and coordinates everything else.
| Where to run it | Install command | Guide |
|---|---|---|
| Raspberry Pi (OS Bookworm) | bash <(curl -sL https://github.com/node-red/linux-installers/releases/latest/download/update-nodejs-and-nodered-deb) | Install on Raspberry Pi 5 |
| Windows | Install Node.js LTS, then npm install -g --unsafe-perm node-red | Install on Windows |
| Docker | docker run -it -p 1880:1880 -v node_red_data:/data --name nodered nodered/node-red | Official Docker docs |
| Home Assistant | Install the Node-RED add-on from the add-on store | Home Assistant docs |
What Node-RED does, and where it runs
| Term | Meaning |
|---|---|
| Node | One block that does one job: inject a message, subscribe to MQTT, run JavaScript, send an email |
| Flow | A tab of connected nodes |
Message (msg) | The JavaScript object passed along a wire; data lives in msg.payload, a label often in msg.topic |
| Deploy | Saves and starts your changes (the red button, top right) |
| Palette | The node library on the left; add more via Menu → Manage palette |
| Context | Memory between messages (flow.set, global.get) |
A temperature workflow might receive a reading from an ESP32, convert it to a number, compare it with a threshold, update a gauge and send an alert only when needed. Each stage is visible and testable on its own. That transparency is Node-RED's superpower, but a simple-looking flow can still be unreliable if it ignores reconnects, bad data or errors, so learn the message model first.
Step 1: understand nodes, flows and messages
Build the classic first flow: Inject → Function → Debug.
- Drag an inject node onto the canvas; set its payload to a number, for example
21.5. - Add a function node with:
msg.payload = msg.payload * 9 / 5 + 32; // °C to °F
msg.topic = "temperature_f";
return msg;- Add a debug node, wire the three together, click Deploy, then click the inject node's button. The Debug sidebar shows
70.7.
Change one thing at a time and keep a debug node after anything you're unsure about. Detailed walk-throughs: Your first flow: inject, function and debug and Nodes, flows and msg.payload explained.
The core nodes you'll use constantly
| Node | Use |
|---|---|
| inject | Start a flow by hand or on a schedule |
| debug | See what a message contains |
| function | Custom JavaScript |
| change | Set, move or delete message properties without code |
| switch | Route messages by value (if/else) |
| delay / trigger | Rate-limit, wait, or build timeouts and watchdogs |
| mqtt in / mqtt out | Talk to ESP32s and other devices through a broker |
| http in / http response / http request | Build APIs or call web services |
| catch / status | Handle errors and watch connections |
Step 2: run Node-RED reliably
A Raspberry Pi makes a good always-on automation host. Install Node-RED on Raspberry Pi 5 covers the official script, running it as a service with sudo systemctl enable nodered, and opening the editor from another computer. On Windows, see install Node-RED on Windows.
Check three things before relying on it: the service starts after a reboot, you can open the editor at the host's LAN address, and your flows still behave correctly after a restart.
Step 3: connect devices with MQTT
MQTT is a publish/subscribe messaging protocol often used to connect constrained devices and automation systems. A device publishes a message to a topic; a broker routes it to subscribers. Node-RED can publish with MQTT Out nodes and receive messages through MQTT In nodes.
Follow Node-RED with MQTT: Connect Mosquitto, Publish & Subscribe to connect the editor to an existing broker and test messages before adding hardware. Then use Install Mosquitto on Raspberry Pi 5 if you want to host your own broker.
Use clear topic names, distinguish commands from reported state, and decide whether a message should be retained. A retained command such as ON can be replayed to a reconnecting device; that may be wrong for a physical actuator. Retained state is often safer than a retained one-shot action.
Step 4: take the flow to real ESP32 hardware
Once the broker path works, connect a real board. Control an ESP32 LED with Node-RED and MQTT sends explicit ON and OFF commands through MQTT and reports device state back. It is a useful first hardware integration because it makes the whole command path visible without requiring a sensor.
A reliable design separates command and reported-state topics. Do not assume publishing an ON command proves the pin changed. Wait for state feedback or a meaningful acknowledgement, and show connection status separately from the output's last reported state.
For sensors, validate incoming payloads before converting them to numbers. Reject empty strings, unexpected JSON shapes and out-of-range values rather than silently turning them into zero. For relay and mains projects, hardware safety and appropriate isolation matter regardless of whether the command came from a dashboard or an automation.
Step 5: build a modern dashboard
For new dashboard work, use FlowFuse Dashboard, often called Dashboard 2.0, package @flowfuse/node-red-dashboard. The legacy node-red-dashboard package is deprecated. Install the modern package from Palette Manager and build the interface with its own UI nodes; do not assume legacy nodes and settings will transfer unchanged.
Start with Node-RED Dashboard 2.0: Install Buttons, Switches & Gauges. Build a button, a switch and a gauge, and connect each widget to a flow that validates inputs and reports its result. For real hardware, update displayed state from device feedback rather than trusting the browser widget's last click.
Read the official Dashboard 2.0 getting-started guide and migration guide before upgrading an existing interface.
Step 6: add sensors, serial data and HTTP APIs
Data can reach Node-RED in several ways:
- MQTT: a good fit for Wi-Fi devices such as ESP32 boards that publish structured measurements.
- Serial: useful when an Arduino Uno or Nano sends newline-delimited readings over USB. Select the correct port and baud rate; keep debugging text separate from machine-readable data.
- HTTP: useful when a device sends JSON to an endpoint or a flow calls an external API. Validate method, body shape, authentication and response codes.
- Camera snapshots: an ESP32-CAM can expose or send an image, but browser access, network routing and authentication should be designed explicitly.
For a live sensor dashboard, label units and timestamps. A stale sensor value is not the same as a zero reading, and no incoming message should not be mistaken for a valid measurement.
Step 7: move from a demo to useful automation
A dashboard lets a person request an action. An automation decides when to act. Begin with a schedule or an LDR-based lighting rule, then add conditions such as occupancy, time window and a minimum interval between actions.
For motion alerts, use a state transition to detect the start of an event, then add a delay, rate limit or cooldown. Otherwise a PIR sensor held HIGH may create dozens of messages. Make notifications idempotent where possible: repeated input messages should not create repeated physical actions or a flood of alerts.
If you store measurements, give each record a timestamp and clear unit. InfluxDB is designed for time-series measurements; Grafana can query and visualize them. Decide a retention period early, and do not store unlimited debug messages as a substitute for a data model.
Step 8: make flows understandable and recoverable
As a flow grows, use subflows for reusable logic, Link In/Out nodes to separate areas of a workspace, and Catch nodes to route supported node errors to an explicit handler. Label nodes according to their purpose, validate messages at system boundaries, and handle empty or malformed data intentionally.
Keep operational state separate from the last measurement. A sensor may report 0 °C; that does not mean it has disconnected. Track last-seen time, device availability and timestamp alongside values. Decide what should survive a restart and configure context storage accordingly; in-memory context alone is not durable.
Export important flows regularly, store reviewed exports in Git, and document credentials as environment/configuration requirements rather than embedding secrets in shared flow JSON. A backup should be restorable; periodically prove you can restore it to a test instance.
Security before remote access
A default Node-RED editor is not a public-facing authenticated control panel. The official documentation warns that the editor is unsecured by default; anyone who can reach it may be able to modify flows. On a trusted LAN this may be acceptable for initial development, but it is not appropriate for direct internet exposure.
Before remote access, configure editor/admin authentication, HTTPS or a secure reverse-proxy setup, restrict network access, and secure HTTP endpoints and dashboards. Use MQTT authentication, topic access controls and TLS when traffic crosses networks you do not trust. Store tokens and passwords outside exported flows, redact secrets from screenshots, and keep Node.js, Node-RED and installed nodes updated.
Step-by-step: Secure Node-RED: login, HTTPS, MQTT TLS and backups. Official reference: Securing Node-RED. Never port-forward editor port 1880 straight to the internet; use a VPN instead.
The SolderHub Node-RED learning path
Work through these in order, or jump to the one that matches your project.
Beginner
- Node-RED Tutorial for Beginners: Nodes, Flows & msg.payload
- Install Node-RED on Raspberry Pi 5: Autostart & Remote Editor
- Your First Node-RED Flow: Inject, Function & Debug
- Node-RED with MQTT: Connect Mosquitto, Publish & Subscribe
- Control an ESP32 LED with Node-RED and MQTT
Intermediate
- Node-RED Dashboard 2.0: Install Buttons, Switches & Gauges
- Live DHT11 and BMP280 Dashboard with ESP32 and MQTT
- Read Arduino Uno/Nano Sensors over Serial in Node-RED
- 8-Channel Relay Dashboard with MQTT State Feedback
- HTTP In Node-RED: Build an API and Receive ESP32 POST Data
Advanced
- PIR Motion Alerts to Telegram or Email without Notification Floods
- InfluxDB and Grafana: Store and Chart Node-RED Sensor Data
- Node-RED Automations: Schedules, LDR Lighting and Context
- Secure Node-RED: Login, HTTPS, MQTT TLS, Backups and Git
- Reliable Node-RED Flows: Subflows, Link Nodes and Catch
Choosing a platform
Beginner troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Can't open http://<host>:1880 | Node-RED not running, wrong IP, or firewall | node-red-start (Pi) or check the service; use the host's LAN IP; allow port 1880 |
| Changes do nothing | Not deployed | Click Deploy after every edit |
| Debug shows nothing | Debug node not wired, or disabled (green tab on the right) | Wire it and enable it |
| Function errors like "msg is not defined" or nothing passes | Missing return msg; | End function code with return msg; |
| MQTT node stuck on "connecting" | Wrong broker IP, user/password, or broker refusing remote clients | See Node-RED with Mosquitto |
| Payload is a string, comparisons fail | MQTT/HTTP delivered text | Set mqtt in to parsed JSON, or Number(msg.payload) |
Dashboard page 404 at /ui | Old dashboard URL | Dashboard 2.0 is at /dashboard |
| Flows lost after a restart | Running a temporary install, or editing a different user directory | Check the log for the flows file path; back up ~/.node-red |
Frequently asked questions
Is Node-RED free? Yes, it's open source (Apache 2.0). FlowFuse offers paid hosting if you'd rather not run it yourself.
Do I need to know JavaScript? Not to start. Many flows use only change, switch and template nodes; Function nodes accept JavaScript when you need it.
Does Node-RED run on an ESP32? Normally no. Run the Node-RED runtime on a computer, Raspberry Pi or server and let the ESP32 execute its own firmware while exchanging data through MQTT, HTTP or another transport.
Should I use the old Dashboard package? For new work, start with @flowfuse/node-red-dashboard. The legacy package is deprecated; plan migration rather than mixing tutorials written for different node sets.
Can Node-RED control GPIO on Raspberry Pi 5? Raspberry Pi 5 uses the RP1 I/O controller and its GPIO software stack differs from older models. Do not copy a legacy GPIO-node tutorial without checking current Pi 5 support and testing the exact hardware/software combination. For a portable first hardware path, use an ESP32 over MQTT and keep the Pi as the server.
Can I expose the editor over the internet? Not without a deliberate security design. Add authentication, encrypted access and network restrictions; a public port-forward is not sufficient.




