Node-RED is a flow-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.
It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes.
In this tutorial I will show you, how to install Node-RED on your Raspberry Pi.
To install Node-RED, you need the following equipment:
- Raspberry Pi
- MicroSD Card with Raspbian
- Ethernet Cable or WiFi Dongle (Pi 3 has WiFi inbuilt)
- Power Adapter
Step 1: Setup
If you download and install 'Raspbian Stretch with desktop and recommended software' on your Pi, Node-RED is already installed.
You can see how to start it at the end of the tutorial.
Step 2: Check for Updates
Type in this command to check for updates:
sudo apt-get update
Step 3: Download and Install NodeJS
- Copy the link of the version you need from the NodeJS website
- Paste it after you type 'wget' in the console of your Pi
eg. wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv7l.tar.xz
- Press enter. NodeJS will now download
- After the download finished, extract the file
tar xf [YOUR_DOWNLOADED_NODEJS_FILE]
e.g. tar xf node-v10.16.0-linux-armv7l.tar.xz
- Navigate into the extracted directory
e.g. cd node-v10.16.0-linux-armv7l
- Copy all files to '/usr/local/'
sudo cp -R * /usr/local
Check if everything has installed successfully:
Those commands should now return the version of node and npm. If they don't do that, you have probably downloaded the wrong NodeJS version.
Step 4: Install and Start Node-RED
Install Node-RED via the Node Package Manager:
sudo npm install -g --unsafe-perm node-red
After Node-RED has installed, you can start it with this command:
The response should be something like this:
Welcome to Node-RED
25 Mar 22:51:09 - [info] Node-RED version: v0.20.5 25 Mar 22:51:09 - [info] Node.js version: v10.15.3 25 Mar 22:51:09 - [info] Loading palette nodes 25 Mar 22:51:10 - [warn] ------------------------------------------ 25 Mar 22:51:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node 25 Mar 22:51:10 - [warn] ------------------------------------------ 25 Mar 22:51:10 - [info] Settings file : /home/nol/.node-red/settings.js 25 Mar 22:51:10 - [info] Context store : 'default' [module=localfilesystem] 25 Mar 22:51:10 - [info] User Directory : /home/nol/.node-red 25 Mar 22:51:10 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable 25 Mar 22:51:10 - [info] Server now running at http://127.0.0.1:1880/ 25 Mar 22:51:10 - [info] Creating new flows file : flows_noltop.json 25 Mar 22:51:10 - [info] Starting flows 25 Mar 22:51:10 - [info] Started flows
The address of the server will be displayed in the response. (it's bold in this sample response)
Node-RED is now available at: http://[IP_OF_YOUR_PI]:1880/
You have now successfully installed Node-RED on your Raspberry Pi!