Node-RED changes

This commit is contained in:
Romain Bazile 2020-07-19 19:29:55 +02:00
parent 18b19238c4
commit eb532068a7

View file

@ -224,48 +224,62 @@ sudo ./build
gpio -v gpio -v
``` ```
### Install Node-RED The last command should output something similar to the following:
[Installing Node-RED on Raspberry Pi](https://nodered.org/docs/getting-started/raspberrypi) ```
gpio version: 2.60
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Pi 4B, Revision: 01, Memory: 4096MB, Maker: Sony
* Device tree is enabled.
*--> Raspberry Pi 4 Model B Rev 1.1
* This Raspberry Pi supports user-level GPIO access.
#### Prerequisites
Ensure npm is able to build any binary modules it needs to install.
```
sudo apt-get install build-essential
``` ```
More information can be found on Yahboom website, on the page [Installing RGB Cooling HAT](https://www.yahboom.net/study/RGB_Cooling_HAT).
### Install Node-RED
#### Download and installation #### Download and installation
To install Node.js, npm and Node-RED onto a Raspberry Pi, run the following command will that download and install them: To install Node.js, npm and Node-RED onto a Raspberry Pi, you just need to run the following command. You can review the content of this script [here](https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered).
``` ```sh
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
``` ```
Due to the limited memory of the Raspberry Pi, you will need to start Node-RED with an additional argument to tell the underlying Node.js process to free up unused memory sooner than it would otherwise. Type `y` at both prompts to accept the installation and its settings.
```
node-red-pi --max-old-space-size=256
```
#### Autostart on boot #### Enable start on boot and launch Node-RED
Run Node-RED when the Pi is turned on, or re-booted, enable the service to autostart by running the command: To run Node-RED when the Pi is turned on or restarted, you need to enable the systemd service by running this command:
```sh ```sh
sudo systemctl enable nodered.service sudo systemctl enable nodered.service
``` ```
#### Check the installation You can now start Node-RED by running the following:
Make sure NodeRed is correctly installed by reaching the following page from the broswer of your pi : http://localhost:1880. ```sh
sudo systemctl start nodered.service
#### Install few nodes
These nodes will be used in Node-RED:
``` ```
cd .node-red/
npm install node-red-dashboard #### Check the installation
npm install node-red-contrib-python3-function Make sure Node-RED is correctly installed by reaching the following page from the browser of your pi http://localhost:1880 or http://planktoscope.local:1880 from another computer on the same network.
npm install node-red-contrib-camerapi
npm install node-red-contrib-gpsd #### Install the necessary nodes
npm install node-red-contrib-web-worldmap These nodes will be used by the PlanktoScop software and needs to be installed:
```sh
cd ~/.node-red/
npm install node-red-dashboard node-red-contrib-python3-function node-red-contrib-camerapi node-red-contrib-gpsd node-red-contrib-web-worldmap node-red-contrib-interval
sudo systemctl restart nodered.service
``` ```
#### Import the last GUI #### Import the last GUI
Import the lastest version of the GUI from https://raw.githubusercontent.com/tpollina/PlanktonScope/master/scripts/flows_planktonscope.json> From Node-RED gui in your browser, choose the Hamburger menu top right, and then Import. You can paste the code directly from the lastest version of the GUI available [here](https://raw.githubusercontent.com/tpollina/PlanktonScope/blob/master/flows/main.json).
#### More information
[Installing Node-RED on Raspberry Pi](https://nodered.org/docs/getting-started/raspberrypi)
### Install Mosquitto MQTT ### Install Mosquitto MQTT