Featured Image - Install Node Red on Raspberry Pi

Posted on

by

in

How to install Node-Red on Raspberry Pi

Introduction

This post will show you how to install the Node-Red application on your Raspberry Pi Device.

If you want to see this post in video format then please see below or watch it on my YouTube channel.

Prerequisites

Node Red Logo

You should have a Raspberry Pi device running the latest Raspberry Pi OS. I am using the Raspberry Pi 4 Model B in this post.

Disclosure: These are affiliate links and I will earn small commissions to support my site when you buy through these links.

Related Content:
Setup Raspberry Pi Headless No Monitor

How to install Node-Red in Raspberry Pi?

Connect to your Raspberry Pi either thru ssh or putty and open a terminal.

Install essential packages

Download and install the following essential packages especially if you are running a different OS like Ubuntu.

sudo apt install build-essential git curl

Install Node-Red

Install the Node-Red application by executing the below command.

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Running Node-Red locally

To run your Node-Red installation then execute the below command. The option ‘max-old-space-size‘ is needed to tell the application to free up unused memory sooner as the Raspberry Pi only has limited memory capacity.

node-red-pi --max-old-space-size=256

You should be seeing the following messages displayed at your command prompt.

pi@raspberrypi4:~ $ node-red-pi --max-old-space-size=256
15 Feb 20:29:29 - [info]

Welcome to Node-RED
===================

15 Feb 20:29:29 - [info] Node-RED version: v3.0.2
15 Feb 20:29:29 - [info] Node.js  version: v16.19.0
15 Feb 20:29:29 - [info] Linux 5.15.84-v8+ arm64 LE
15 Feb 20:29:30 - [info] Loading palette nodes
15 Feb 20:29:32 - [info] Dashboard version 3.3.1 started at /ui
15 Feb 20:29:32 - [info] Settings file  : /home/pi/.node-red/settings.js
15 Feb 20:29:32 - [info] Context store  : 'default' [module=memory]
15 Feb 20:29:32 - [info] User directory : /home/pi/.node-red
15 Feb 20:29:32 - [warn] Projects disabled : editorTheme.projects.enabled=false
15 Feb 20:29:32 - [info] Flows file     : /home/pi/.node-red/flows.json
15 Feb 20:29:32 - [info] Server now running at http://127.0.0.1:1880/
15 Feb 20:29:32 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

15 Feb 20:29:32 - [info] Starting flows
15 Feb 20:29:32 - [info] Started flows

Note: You should keep this terminal open while you are working with Node-Red.

Access the Node-Red application

To access the application then open your browser and point the URL to the IP address of your Raspberry Pi and the default port.

http://<IP-ADDRESS-RPI>:1880

How to uninstall Node-Red in Raspberry Pi?

If for some reason you wanted to uninstall the Node-Red application on your Raspberry device then execute the below code.

sudo npm -g remove node-red
rm -R ~/.node-red

References

If you run into any issues then please cross-check with the official Node-Red documentation.

Wrap Up

I have shown you how to install the Node-Red application on your Raspberry Pi device in this post. You can now begin creating your next awesome Internet of Things (IoT) applications. We will use this setup in future projects.

I hope you learned something. Happy Exploring!

If you like my post then please consider sharing this. Thanks!

4 responses to “How to install Node-Red on Raspberry Pi”

  1. Node-Red – DHT11/DHT22 – Custom Weather Station Dashboard

    […] Content: How to install Node-Red on Raspberry PiSetup Raspberry Pi Headless No […]

  2. Node-Red – Display Arduino Sensor Readings thru WebSocket

    […] Content: How to install Node-Red on Raspberry PiHow to install Node-Red on Windows or […]

  3. Node-Red – IoT Dashboard with Arduino – No Coding Required!

    […] Content: How to install Node-Red on Raspberry PiHow to install Node-Red on Windows or […]

  4. Exploring Node-Red, Dashboard 2.0, and MQTT

    […] Related Posts: How to install Node-Red (or Node Red) on a Windows environment?How to install Node-Red on Raspberry Pi […]

Leave a Reply

Your email address will not be published. Required fields are marked *