Getting Started with Node-RED on Raspberry Pi

This post is an introductory guide to Node-RED. I’ll cover what’s Node-RED, how to install it, how to use the visual interface to create a simple flow.


Before you start reading this blog post, I’m making an assumption that you are already familiar with the Raspberry Pi and you know how to install the operating system.

If you don’t, please read this blog post: Getting Started with Raspberry Pi. By the end, you should have Raspbian or Raspbian Lite installed in your Raspberry Pi.

If you like the home automation and you want to learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino. I recommend that you download my course: Build a Home Automation System for $100.

Let’s get started!

What’s Node-RED?

Node-RED is a powerful open source tool for building Internet of Things (IoT) applications with the goal of simplifying the programming component.

It uses a visual programming that allows you to connect code blocks, known as nodes, together to perform a task.

The nodes when wired together are called flows.


Why do I think Node-RED is a great solution?

Node-RED is open source and developed by IBM.

The Raspberry Pi runs Node-RED perfectly.

With Node-RED you can spend more time making cool stuff, rather than spending countless hours writing code.

Don’t get me wrong. I love programming and there is code that needs to be written throughout this course, but Node-RED allows you to prototype a complex home automation system quickly.

What can you do with Node-RED?

Node-RED makes it easy to:

  • Access your RPi GPIOs
  • Establish an MQTT connection with other boards (Arduino, ESP8266, etc)
  • Create a responsive graphical user interface for your projects
  • Communicate with third-party services (,, Thing Speak, etc)
  • Retrieve data from the web (weather forecast, stock prices, emails. etc)
  • Create time triggered events
  • Store and retrieve data from a database

Here’s a library with some examples of flows and nodes for Node-RED.

Installing Node-RED

Getting Node-RED installed in your Raspberry Pi is quick and easy. It just takes a few commands.

Having an SSH connection established with your Raspberry Pi, enter the following commands to install Node-RED:

[email protected]:~ $ bash <(curl -sL

The installation should be completed after a couple of minutes.

Autostart Node-RED on boot

To automatically run Node-RED when the Pi boots up, you need to enter the following command:

[email protected]:~ $ sudo systemctl enable nodered.service

Now, restart your Pi so the autostart takes effect:

[email protected]:~ $ sudo reboot

Testing the Installation

When your Pi is back on, you can test the installation by entering the IP address of your Pi in a web browser followed by the 1880 port number:


In my case is:

A page like this loads:


Node-RED overview

Let’s take a look at the Node-RED visual interface.


Main sections

On the left-side, you can see a list with a bunch of blocks. These blocks are called nodes and they are separated by their functionality. If you select a node, you can see how it works in the info tab.

In the center, you have the Flow and this is where you place the nodes.


Creating a simple flow

Let’s test a simple example of a flow. Start by dragging an Inject node to your flow. Then, also drag a Debug node.


Connect your nodes together. You can drag them to confirm that they are connected.

Now, let’s edit the inject node. Double-click the node. In the figure below you can see different settings you can change.

Select string and type Hello!.


To save your application, you need to click the deploy button on the top right corner.


Your application is saved.

Testing the flow

Let’s test our simple flow. Open the debug window and click the Inject node to trigger the “Hello!” string.


As you can see, our message is being printed in the debug window. This is a very basic example and it doesn’t do anything useful. However, the purpose of this post is to get you familiar with the Node-RED interface.

Wrapping Up

This post is a quick guide to setup Node-RED on a Raspberry Pi and create a simple flow. I’ll be posting future tutorials doing things with a real world application, but I thought it would be useful to introduce this software first.

Like home automation? Learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino with my course: Build a Home Automation System for $100.

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Enjoyed this project? Stay updated by subscribing our newsletter!

22 thoughts on “Getting Started with Node-RED on Raspberry Pi”

      • In the latest distro (buster) dubbed “Raspberry Pi OS, Node Red is not part of the image, it has to be installed. I am a novice with the Pi, and found it a bit frustrating to try to put it on a Raspberry Pi 0 W. After ignoring many warnings and error reports, it seemed to run, but much too slow to functional. I wanted to use the Pi 0 W in my project due to it’s size and built-in wifi but that may not be feasible. In the meantime I’ll try learning about Node Red and the next phase “Dashboard” using a Laptop with Ubuntu with Node Red and Dashboard installed on it.
        Thank you Rui and Sara for all your work!

  1. Thanks a lot! I’ve been looking for something more refine then scratch to introduce my high school students to Raspberry Pie programming, I think I may have found it!

  2. Thanks for the great video. I am presently using as a broker and ESP8266 as devices.
    This arrangement works well for me. My concern is that I depend on Adafruit as a broker. My question is: does your system give me independence by running on Raspberry Pi? Can I connect to it from anywhere in the world? is it limited to “Home Automation” or can it be autonomous ?


    • With the system that I should you install the MQTT broker (mosquitto broker) locally in your Raspberry Pi and you install a software called ngrok that allows you access your device securely from anywhere in the world.
      You could always change your MQTT broker from Adafruit to another service quite easily.

      Thanks for asking,

  3. I want to thank you on the great tutorials of raspberry-Pi and mosquito installation. I like your format of line by line instructions rather than lengthy Youtube videos.
    My question is: I prefer to use the mosquito as a broker rather than and be independent, so now, do I need the both Node-RED and the Python server for MQTT?
    I have mosquito installed and tested, now I am not sure if I should just continue with Node-RED or what? I am not too interested in Home Automation very much but I want to access my mosquito from anywhere on the web. Will I be able to do it with Node-RED?

    Thank you very much,

    • Hi Leonardo.
      Our MQTT tutorials use Raspberry Pi, Node-RED, and Mosquitto.
      We don’t have tutorials with OpenHAB or Home Assistant.
      Sara 🙂

  4. loaded a freshly made SD card and after it finished installing, I looked under the programming flyout and there is no node-red. I had to load it with the link you provided.

  5. If I understand correctly: NODE-RED is a GUI and it is easy to build communication flows. But I am looking for something different: I want to send messages from one system to many subscribed ESP32 boards with a program. I understand that a broker only runs on a Raspberry or even better a PC, but do I really need a broker? If I only want to broadcast messages from one system to several others (in my project 30..40 ESP32 boards) is there an easier solution, like using the MQTT client library on an ESP32 and broadcast messages to all other connected ESP32 in the local network?

    • In order to control the flow of messages you need a broker. The esp XXX can receive and send messages, the broker distributes them. Mosquitto MQTT broker seems to be the favorite. Everything I’ve read says that the ESP family of controllers don’t have the power to “broker” the messages. Node Red is a great interface to connect messages to their destination in whatever fashion you desire. For example rather than simply a 1 or 0 (binary), or a number, or even text, you can create web pages that load on your cell phone or other mobile (or fixed) device. I currently have 5 esp8266 modules around monitoring temperature& humidity in various places, one monitoring heating oil level in a tank, and lock status in various locations. I plan more, the beauty of it all is the broker running on a pi or equivilant is the central reporting point and “flows” can be easily added to it. I’m currently using a Raspberry Pi 2b, and and have several other versions lying around I want to try. I’ve been told that the Rpi zero will work, and the zero 1 and 2 W have wifi built in; a great advantage if you want to go wireless. Hope that helps.

      • Hi John, thank you, your answer was a great help to me. It looks like, that Node-RED is a good “dashboard” for looking at status and controlling IoT devices.
        But I am looking for something different: I want to write a program (for example C++) that broadcasts messages to all connected devices. If I understand correctly I can write a program that talks to a broker, and the broker sends messages to the clients. I think that using the Rest API from a broker like Mosqitto could work.
        This looks a little bit oversized to me, all I want is a simple way to broadcast messages from one client in a network to all others and to receive answers from them.


Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.