-
Notifications
You must be signed in to change notification settings - Fork 5
Node RED
Node-RED is a graphical development environment which enables rapid application development. Node-RED runs on Node.JS, so is available on the Raspberry Pi, it can run on local laptops or on the cloud. Node-RED has an extensive library of 'nodes' available that add functionality, such as controlling hardware attached to the Raspberry Pi. Before Node-RED can control TobyJnr some additional nodes and packages need to be installed.
Before installing any new nodes you need to install an additional package to add the developer content for libasound library. This is needed so the Node.js library can access the C library. Enter the following command to install the package:
sudo apt-get install -y libasound2-dev
Next install the libraries needed to drive the RGB pixels. This is not available as a Raspbian package, so the following command will download the content from github and then automatically install it:
curl https://get.pimoroni.com/unicornhat | bash
Now we can install the required nodes. Enter the following commands to install the needed nodes. The videos following will explain what the nodes are and how to use them, so simply enter the commands and let the installs run through:
cd ~/.node-red
npm install node-red-contrib-speakerpi node-red-contrib-micropi node-red-node-pi-neopixel
npm install node-red-node-watson node-red-dashboard node-red-contrib-camerapi
npm install node-red-node-pi-gpiod
The last change needed is to ensure a service is started to allow the GPIO node to work. Edit file /etc/rc.local and then add the line /usr/bin/pigpiod -l to the end of the file, but before the last line, exit 0 :
sudo nano /etc/rc.local
then add line:
/usr/bin/pigpiod -l
If you are using a DHT11 or DHT22 sensor instead of a SenseHAT then you need to run the following commands to install the required software to drive the DHT sensor:
cd
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.55.tar.gz
tar zxvf bcm2835-1.55.tar.gz
cd bcm2835-1.55
./configure
make
sudo make check
sudo make install
sudo npm install --unsafe-perm -g node-dht-sensor
sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor
To make all the changes live reboot the pi:
sudo reboot -n
Now Node-RED is setup it is time to connect the hardware.