Configuring and Installing Node-RED on Raspberry Pi

Configuring and Installing Node-RED on Raspberry Pi

When you pick up your Raspberry Pi, has it been sleeping in the corner, gathering dust? The Raspberry Pi, as a powerful microcomputer, holds endless possibilities waiting to be discovered. In this series, we will take you into the world of Raspberry Pi, exploring the fun and challenges step by step, from configuration to installation. Let’s start this creative journey together, first learning how to configure and install Node-RED, injecting more wisdom and inspiration into the Raspberry Pi.

Confirm Device Status

Use Advanced_IP_Scanner to scan the local area network to obtain the Raspberry Pi’s network address without a screen.

Configuring and Installing Node-RED on Raspberry Pi

Putty Remote

10.10.40.220

pi raspberry

View Hardware and System Information

uname -a

pi@raspberrypi:~ $ uname -a

Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

cat /proc/device-tree/model

pi@raspberrypi:~ $ cat /proc/device-tree/model

Raspberry Pi 3 Model B Plus Rev 1.3

Rewrite Image File

Configure Username and Password

The classic username pi and raspberry have been removed, and you need to manually add the configuration file or use the wizard to create it.

Create userconf or userconf.txt and add the following content

pi:$6$Q7yQqYO94B9fI9jn$trNI8/yvcZ8WYleaYKN5qlrzQ3AhZXLZtcNkYJlSH16xGloh2ZiM4KeAay8GSBoQ09LZI/wMOxM3qeou7uZXq.

Configure SSH

Create a new file in the boot partition, it can be blank, named ssh. Note that it should be lowercase and have no extension. The Raspberry Pi will automatically enable the SSH service upon startup after detecting this file. You can then find the Raspberry Pi’s IP address by logging into the router and connect to the Raspberry Pi via SSH.

Modify Source

Software Source

sudo nano /etc/apt/sources.list

deb http://mirrors.sysu.edu.cn/raspbian/raspbian/ bullseye main contrib non-free

deb-src http://mirrors.sysu.edu.cn/raspbian/raspbian/ bullseye main contrib non-free

Edit System Source

sudo nano /etc/apt/sources.list.d/raspi.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main ui

Ctrl+o to save, then press Enter to confirm, then Ctrl+x to exit.

#Update Software Source List

sudo apt-get update

#Update Software Version

sudo apt-get upgrade

sudo apt-get dist-upgrade

Storage Space Usage

df -h

Configure Proxy

**Proxy

Install Node-RED

Run Installation Script

You need a proxy, otherwise it cannot be executed.

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

Configuring and Installing Node-RED on Raspberry Pi

After installation is complete, it will prompt to initialize the configuration file, configure username and password, etc.

Configuring and Installing Node-RED on Raspberry Pi

Username: nealwang Password: 12345678

Other settings are mostly default, GitHub project management is set to no, which can be discussed later if needed.

Run Locally

Due to the limited memory of the Raspberry Pi, you need to use additional parameters to start Node-RED to tell the underlying Node.js process to release unused memory faster than otherwise.

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

Configuring and Installing Node-RED on Raspberry Pi

Run as a Service

The installation script for Pi will also set it to run as a service. This means it can run in the background and be able to start automatically at boot.

Use the following commands to manage the service:

  • node-red-start– This will start the Node-RED service and display its log output. PressingCtrl-C or closing the window will not stop the service; it keeps running in the background

  • node-red-stop– This will stop the Node-RED service

  • node-red-restart– This will stop and restart the Node-RED service

  • node-red-log– This displays the log output of the service

You can also start the Node-RED service from the Raspberry Pi OS desktop by selecting the menu option Menu -> Programming -> Node-RED.

Enable Auto Start on Boot

If you want Node-RED to run when the Pi is powered on or rebooted, you can enable the service to start automatically by running the following command:

sudo systemctl enable nodered.service

To disable the service, run the following command:

sudo systemctl disable nodered.service

Open the Editor

http://<hostname>:1880

You can find the IP address by running hostname -I on the Pi.

Configuring and Installing Node-RED on Raspberry Pi

Stars and the Sea

By configuring and installing Node-RED, we have injected more wisdom and inspiration into the Raspberry Pi, opening a brand new journey of exploration. In the future, we can utilize the powerful features of Node-RED to create various amazing applications and projects, allowing the Raspberry Pi to shine even brighter. Let us embrace the unknown challenges together, exploring a world of infinite possibilities, letting creativity and technology bloom with brilliant colors on the stage of Raspberry Pi. May our inspiration and efforts illuminate the future of Raspberry Pi, bringing us more surprises and achievements. Let us move forward together, exploring a broader innovative world – continue to eat dust!

Reference Links

https://nodered.org/

https://shumeipai.nxez.com/

https://pan.baidu.com/s/1mkkbNVa2x7Rf-i7wFJBgmQ

Leave a Comment

×