Installing Node-RED on a Raspberry Pi?

Node-RED is an open-source visual programming tool for wiring together hardware devices, APIs, and online services. It provides a browser-based flow editor that makes it easy to wire together flows using a wide range of nodes for tasks like reading sensor data, controlling devices like LEDs or motors, connecting to services like Twitter or MQTT brokers, and more.

Installing Node-RED on a Raspberry Pi?


Before starting, you’ll need:

  • A Raspberry Pi with Raspbian installed. Any model of Pi will work, but Pi 3 or 4 is recommended
  • Ability to access the command line on your Pi
  • Node.js and npm installed
    • To check, run node -v and npm -v. If not installed, follow guides to install them
  • Git installed
    • To check, run git –version. If not installed, follow guides to install git

Step 1 – Install Node-RED

With the prerequisites ready, we can install Node-RED using the following steps:

  1. Update package lists and install dependencies:


sudo apt-get update

sudo apt-get install build-essential git curl python3-pip libffi-dev

Use npm to install Node-RED globally with the -g flag:


sudo npm install -g –unsafe-perm node-red

Once installed, start Node-RED:


  1. node-red

    You should see output showing the Node-RED server starting on port 1880.

  2. Open a web browser and navigate to http://localhost:1880 or http://{your Pi’s IP address}:1880. You should see the Node-RED editor load.

And that’s it – Node-RED is now up and running on your Raspberry Pi! The next step is creating your first flow…

Step 2 – Creating Your First Flow

The basic building block of Node-RED is the “flow” – a collection of “nodes” connected together to form an application.

In this simple example, we’ll create a flow that listens for a message input and outputs it to the debug console.

  1. Drag an inject node (left sidebar > input) and debug node (left sidebar > output) onto the canvas and connect them together.
  2. Click the inject node and set the topic to “Hello” and payload to “World”. This will inject the message “Hello World” when deployed.
  3. Click the debug node and leave the defaults. This will output any messages to the debug sidebar.
  4. Click the Deploy button (top right).
  5. Click the button on the inject node to send the message.

You should see “Hello World” output in the debug sidebar – congratulations, you’ve created your first Node-RED flow!

With your imagination the only limit, you can now wire together flows connecting the huge collection of over 225 core nodes available.

Key Things Node-RED is Used For

Now that you have Node-RED setup and have wired your first simple flow, let’s look at some of the popular things it can be used for:

Home Automation

Node-RED is commonly used to create home automation solutions, connecting things like:

  • Smart home hubs and devices
  • Environmental sensors
  • Relays to control lights, motors and more
  • Notifications and text-to-speech services

Complex rules and logic can be created visually with easy to understand flows.

IoT and Hardware Projects

For IoT and hardware prototypes, Node-RED makes it simple to connect devices like:

  • Microcontrollers (Arduino, ESP8266, Raspberry Pi GPIO)
  • Industrial sensors (temperature, pressure, etc.)
  • Cameras, microphones and other multimedia devices

Rapidly build functioning prototypes that deal with all aspects – data collection, analysis, notifications etc.

APIs, Web Services and Backends

Using Node-RED you can connect to services like:

  • Twitter, Email, IFTTT
  • IoT cloud platforms
  • MQTT brokers and pub/sub messaging
  • Databases
  • Webhooks

Build backends that collect data then act on it automatically – send notifications, update databases, post to social media and more.

Data Visualization and Dashboards

Node-RED has charting and GUI nodes that make it easy to build insightful, attractive real-time dashboards showing metrics and KPIs.

Combine this with flows for data collection, analysis and notifications to create comprehensive systems.

Teaching and Learning

The visual drag-and-drop editor makes Node-RED a great tool for teaching or learning topics like:

  • Programming and coding
  • IoT and hardware devices
  • APIs, web services and backends
  • Data analysis and visualization

Seeing flows execute step-by-step helps understanding and speeds up learning.

With so many possibilities, there’s no limit to using Node-RED for your next project!

Optimizing the Node-RED Experience

Here are some tips for optimizing Node-RED on the Raspberry Pi for the best experience:

1. Increase Memory Allocation

Node-RED can consume a large amount of memory on more complex flows. To avoid crashes, allocate more memory:

  1. Edit ~/node-red/settings.js

  2. Under AdminAuth, add:

  1. nodeMaxOldSpaceSize: 1024

  2. Save changes and restart Node-RED

This increases the maximum old space size V8 will use to 1024MB.

2. Persist Flows Externally

By default, flows are saved to ~/node-red. For persistence after reboot and recovery:

  1. Connect an external drive to the Pi

  2. Update settings.js to set flow File property:

  1. flow File: ‘/mnt/external_drive/flows.json’

  2. Now flows will save to the external drive

3. Improve GUI Speed

The GUI can become slow on lower powered Pis. For better performance:

  1. Disable GUI animation in settings.js:


editor Theme: {

    projects: {

        enabled: false,

  1. Overclock your Pi to improve overall performance

4. Monitor Resource Usage

Keep an eye on resource usage to catch performance issues early:

  • Use htop to monitor overall CPU and memory usage
  • Check flows for inefficient code – batch API calls, use change nodes etc.
  • Identify and throttle high frequency messages
  • Split complex flows into simpler re-usable flows

By optimizing your flows and system config, you’ll get the best experience running Node-RED on a Raspberry Pi.


Installing Node-RED on a Raspberry Pi opens up a world of possibilities for home automation, IoT prototypes and more. With this guide, you now have it up and running – ready for your imagination to run wild creating your own innovative flows and applications!

Start simple but think big. The community contributed nodes make it possible to connect an incredible diversity of hardware devices, APIs and online services together using Node-RED. The only limit is your creativity.

So grab your Raspberry Pi and start wiring! We can’t wait to see what you build.

Key Takeaways:

  • Node-RED provides a browser-based visual editor that makes it easy to wire hardware devices, APIs and services together into flows
  • It can be easily installed on a Raspberry Pi and used for home automation, IoT, dashboards, learning and more
  • Creating simple flows connects nodes together – such as injecting messages that are debugged
  • Key optimizing tips covered include increasing memory, persisting flows externally, speeding up the GUI and monitoring resource usage

Frequently Asked Questions

  1. How do I access the Node-RED editor on my Pi?
    The Node-RED editor is accessible via web browser at http://{your Pi IP address}:1880.

  2. Do I need any hardware to use Node-RED?
    No hardware is necessary. Node-RED can connect to online services. But it really shines when used with IoT devices like sensors.

  3. Can I use Node-RED on a Pi Zero or older Pi models?
    Yes it will work on any Pi model, but at least a Pi 3 or newer is recommended for performance reasons.

  4. Is Node-RED secure? Can I password protect the editor?
    AdminAuth can be enabled in settings.js to set a username and password to secure the editor and enable HTTPS. Further security tips can be found in the Node-RED documentation.

  5. How do I make my Node-RED flows start automatically on boot?
    The Node RED init script in /etc/init.d can be used to configure Node-RED to start automatically when the Pi boots up.

  6. What programming knowledge is required to use Node-RED?
    It is designed to be visual programming, perfect for non-programmers. But knowledge of JavaScript can help create more advanced custom nodes if desired.

  7. Can I export and share my Node-RED flows with others?
    Yes! The Import/Export menu option lets you export any flow as JSON then easily import it on another Node-RED instance to reuse and share between projects.

  8. Is there detailed documentation available for Node-RED?
    Extremely detailed documentation covering usage, nodes, API development, security hardening and more is available on the Node-RED site.

  9. What Raspberry Pi OS distributions support Node-RED?
    Most common distributions have good support including Raspberry Pi OS and Ubuntu Server for ARM. Some tweaks may be needed depending on OS.

  10. How do I connect a Raspberry Pi Pico to Node-RED?
    The node-red-node-pi-pico package adds a Raspberry Pi Pico node making it easy to wire the Pico to Node-RED. Follow the guide on GitHub to install it.

  11. Can I use Node-RED with Home Assistant?
    Yes, the node-red-contrib-home-assistant-WebSocket addon allows seamlessly integrating Node-RED flows with your Home Assistant automations.

  12. Is Node-RED an alternative to programming languages like Python?
    It has similarities, but focuses on connecting services. For complex logic or calculations, Node-RED can shell out to languages like Python via function nodes.

  13. How is Node-RED different from Node.js?
    Node-RED is a flow-based application built on top of Node.js. So it leverages Node.js but makes composing applications via flows visual and easy.

  14. What hardware protocols can Node-RED connect to?
    Via community nodes it supports hardware protocols like: MQTT, HTTP, TCP, I2C, SPI, Serial, GPIO, BLE, WiFi and many more. New nodes are added all the time.

  15. Can I monitor or log data from Node-RED flows?
    Yes, using dashboard nodes you can build visualizations of flow data. The Node-RED Storage module persisting it to databases for historical monitoring. And debug nodes output messages.

  16. Is Node-RED an Internet of Things platform?
    It is commonly used as an IoT platform, offering easy device connectivity, data collection, analysis rules and processing needed for IoT solutions. Services like AWS IoT integration further leverage cloud scale and capabilities.

  17. Can I use Node-RED with Alexa or Google Assistant for voice control?
    Yes, contrib nodes like node-red-contrib-alexa-local and node-red-contrib-google-smart-home allow you to connect IoT devices wired via Node-RED to the assistants for voice control.

  18. How do I connect a sensor to my Raspberry Pi with Node-RED?
    Many sensor nodes are available like node-red-node-dht-sensor to easily get sensor data into Node-RED. Generally they connect via GPIO or protocols like I2C. Refer to the sensor’s documentation for wiring instructions.

  19. Can I use Node-RED with WordPress?
    Yes, there is a node-red-node-wordpress node that allows interacting with WordPress instances to post content, query posts and more. Useful for publishing automated posts based on IoT data.

  20. Is IBM still involved with Node-RED development?
    While created by IBM Emerging Technology, Node-RED was contributed to the JS Foundation in 2016 for open source community-led development. IBM and others are still active contributors.

Leave a Comment