adds code

Top 10 Sensors and Relays for Node-RED

Published: 2026-03-07

Quick answer: For a first Node-RED project, pair one input sensor with one relay module: a DHT22 temperature-and-humidity sensor plus a basic 5 V relay board wired to a Raspberry Pi is enough to build the classic read-sensor, run-logic, switch-a-load loop.

Both parts are inexpensive, widely documented, and supported by ready-made Node-RED nodes, so you can go from unboxing to a working flow in an afternoon.

Watch: Top Sensors and Relays for Node-RED

This walkthrough shows the hardware side of a Node-RED build: the sensor modules that feed readings in, and the relay boards that switch real loads on and off. Watching it first makes the written sections below easier to follow, because every category it mentions — temperature sensors, PIR motion detectors, and single-channel relay boards — gets its own explanation with wiring notes further down the page.

The video above walks through popular sensor and relay options for Node-RED builds. As you watch, pay attention to three details that decide whether a module will play nicely with your setup: the logic voltage the board expects (3.3 V for a Raspberry Pi GPIO header, 5 V for most Arduino boards), the contact rating of any relay (the maximum voltage and current it can safely switch), and whether the manufacturer documents a library or an example flow you can import.

The sections below serve as the written companion: they explain what each hardware category does, how sensor data actually reaches Node-RED over GPIO, serial, HTTP, or MQTT, and how to choose a sensible first purchase instead of an over-featured one. If you would rather follow a step-by-step written walkthrough with wiring details, the Getting Started with sensors/relays guide covers the same ground in more depth.

Which sensors work well with Node-RED?

Any sensor that can deliver its readings as GPIO pulses, serial data, HTTP requests, or MQTT messages can drive a Node-RED flow — the connection method matters more than the brand.

  • Temperature and humidity: DHT22, the classic beginner choice
  • Motion: PIR modules for presence-triggered automations
  • Light: photoresistors for automatic lighting
  • Water leak: contact probes for home safety alerts
  • Sound: microphone modules for noise-triggered rules

The DHT22 is a particularly common starting point because it reports two useful values — temperature and humidity — over a single data wire. Adafruit’s DHT guide documents wiring and usage with Arduino and Raspberry Pi (learn.adafruit.com/dht).

What does a relay do in a Node-RED project?

A relay is an electrically controlled switch. A small control signal from a Raspberry Pi or Arduino opens or closes the relay’s contacts, which lets Node-RED turn larger loads such as fans, lamps, or pumps on and off.

Typical first uses include switching a USB fan when a room gets warm, triggering a siren when motion is detected, or controlling a grow-light on a schedule.

Safety note: many relay modules can switch mains voltage. If you are new to electronics, practice with low-voltage loads such as USB fans and 12 V LED strips first, and only work with mains power if you fully understand the risks.

Not every switching job needs a relay, though. If your goal is simply to turn a mains-powered appliance on and off — a lamp, a heater, a coffee machine — a smart plug gives you the switching and often energy monitoring with no wiring at all: it plugs into the wall socket and joins your network over Wi-Fi or Zigbee. Before picking one, it is worth checking measured specifications rather than marketing claims; our smart plug comparison with verified specs collects standby draw, maximum load, and energy-monitoring accuracy for popular models so you can match the plug to the appliance.

If you buy through links on the sites we recommend, we may earn a small commission.

How do sensors send data into Node-RED?

Sensor readings reach Node-RED over four common transport paths, and each maps to ready-made input nodes:

ConnectionTypical hardwareBest for
GPIOSensors wired directly to the Raspberry Pi 40-pin headerLow-cost builds on the Pi itself
USB serialArduino boards streaming readingsMicrocontrollers without Wi-Fi
HTTPESP32/ESP8266 posting web requestsSimple networked sensors
MQTTWi-Fi devices or Zigbee bridges publishing to a brokerScalable multi-device IoT setups

If you wire sensors straight to the Pi, remember its GPIO header operates at 3.3 V logic levels — the interactive reference at pinout.xyz documents every pin. For larger projects, MQTT is the usual backbone: it is a lightweight publish/subscribe messaging standard designed for IoT devices (mqtt.org).

How do you build your first sensor-to-relay flow?

  1. Install Node-RED using the instructions in the official documentation.
  2. Open the browser editor and drop an inject node and a debug node onto the canvas to confirm messages flow.
  3. Add your sensor input node (GPIO, serial, HTTP, or MQTT) and watch live readings arrive.
  4. Insert a switch node that only passes messages above your threshold.
  5. Connect the switch output to a GPIO or MQTT output node that drives the relay.
  6. Deploy, then browse the flow library for ready-made examples once the basics work.

Frequently Asked Questions

Can Node-RED read sensors directly?

Yes. On a Raspberry Pi, GPIO input nodes read wired sensors directly; on other hosts, Node-RED typically receives sensor data over serial, HTTP, or MQTT.

Do I need a Raspberry Pi to follow this?

No. Node-RED runs on the Raspberry Pi, other Linux single-board computers, and regular desktop machines. The Pi is simply the most popular host for sensor projects because of its built-in GPIO header.

Are relay modules safe for beginners?

With low-voltage loads, yes — they are one of the standard ways to learn automation. Treat mains-voltage switching as advanced work and follow proper electrical safety practices.

What should I buy after my first sensor and relay?

A Zigbee coordinator dongle is a common next step because it unlocks large meshes of affordable smart-home sensors without extra Wi-Fi load. Our Getting Started with Zigbee coordinators guide explains how to pick one and pair it with Node-RED.

Sources

Node-RED Automation

Published: 2026-03-07

Previous Post Next Post