smarthome
Peter Weiß  

Setup Node-RED on Raspberry Pi with Raspi OS 64bit

In this blog post you learn how to setup Node-RED on a Raspberry Pi 4 with Raspberry Pi OS 64 bit. You could also install Node-Red on older Raspberry Pi’s, so read on there is just a small setting necessary. I have a full description to setup the Raspberry Pi 4 with 64bit on an external SSD disk, find the description in my blog Setup a Raspberry Pi with USB SSD Disk. Head over to the post, if you haven’t setup your Raspberry Pi already, also find some of my advices for hardware to boost disk I/O, without the problem with defect SD cards because of the disk I/O. But now lets jump into the Node-Red Setup.

Node-RED Documentation

You could find a really good documentation installing Node-RED on any device at the official homepage. For Raspberry Pi there is also an installation documentation, for more details follow the link to the getting started guide there. I have covered the important steps in the next sections, therefore let’s start with the setup.

Installation

The easiest way for you is to use the official installation script. The script removes older Versions of the Node-RED, Node.js and npm and installs the right versions for the found operating system. This is also the script for updating newer versions. If you prefer, you could download the script check the content and start it afterwards, your just start if with the following command.

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

After you have started the installation you get some questions, just answer them to start the installation process. You are able to see the progress and also some insights of the installed versions, as you are able to see in the next screenshot.

Successful Finished Node Red Installation

Raspberry Pi Memory Settings for Node-RED 

As I mentioned at the beginning, for older Raspberry Pi’s with less memory you should set the max memory size. This setting is not needed for the Raspberry Pi 4 models with 4 GB or even 8 GB. If you have a 2 GB model you could also use this settings, but with a higher value depending on, what else runs on your Raspberry beside Node-Red.

For the older 1 GB models set the Size to 256 MB with the following Command

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

Autostart Node-RED service on Raspberry Pi

To automatically start Node-RED, whenever you reboot your Raspberry Pi, you should enable the Node-RED service. This is simple done by enabling it with the following command.

sudo systemctl enable nodered.service

If you want to remove Node-RED in the future from automatically restart just disable the Service with the following command.

sudo systemctl disable nodered.service

Node-RED Command Line Tools

After you have installed Node-RED with the official script there are also command line tools available for easy operating. These commands should now be available, just call them with the option –help to get more informations.

node-red
node-red-pi

Manual Start/Stop Node-RED

If you manually want to start, stop, restart or reload Node-RED you could use one of the following commands

node-red-start
node-red-stop
node-red-restart
node-red-reload

Nod-RED Logs

To get your logs there is also a simple command which you could use

node-red-log

Node-RED State

After your installation was successful and you have started Node-RED as a service you could check the actual state with the following command. If you manually started Node-RED you should see the output already on your console. Be aware if Node-RED was started manually and you close your command prompt, it will also stop Node-RED.

node-red status

Have a look into the output, if everything works fine, you are able to open Node-RED in your browser.

Node-RED started all flows an is now ready

Node-RED Web Site

Start your browser and call the Url with the IP of your Raspberry Pi and the default Port 1880

http://<YOUR-IP-ADDRESS>:1880
Node-RED Web-Site after successful installation

You are now ready to start with your first flows, I’ll provide automation flows in my upcoming posts, and I also prepare a post How to migrate your Node-RED Installation, from an Old Raspberry Pi System to a new one. The needed files are also useful if you want to backup and restore an instance, so stay tuned for this upcoming post.

Summary

You installed Node-Red on a Raspberry Pi 4 – 64 Bit beta from my previous Post. Now you are ready to start with your own automation flows. I’m already writing further automation blog posts with Automation on Node-RED. With this setup you are ready to go and implement it on your own. Check my posts in the Smart Home section regularly. If you have some ideas for your automation project, leave me a comment. I’ll write a post if I have already implemented something similar.

If you have further questions or suggestions, please leave me a comment

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WordPress Appliance - Powered by TurnKey Linux