This is an old revision of the document!
This guide explain how to build from scratch the BotaBotLab's Phototubridostat V1. This device integrate autonomous sub-modules that can be used for different applications. The following module are described in this guide but more detailed information can be found on their specific guides:
You can use cheaper Arduino and Wemos clones
We used an Orange Pi Win Plus but any SBC would work as long as it is able to run Node-Red.
By default, the Arduino IDE is compatible only with the Arduino Boards. As we also wanted to use ESP8266 board to being able to communicate with the Node-Red server via MQTT, it is mandatory to add ESP support to the Arduino IDE. Further infromation can be found on The following instructable
How to install Raspbian on a Raspberry Pi ?
All the terminal commands can be type directly on the SBC (it will require and monitor and a keyboard) but also from an other computer (Windows/Linux/Mac) via SSH (much more convenient).
How to activate SSH on Raspbian ?
On Armbian SSH ins enabled by default.
For Windows user : Putty allow to easily control your device by SSH. How to use Putty on Windows ?
Some Single Board Computer distributions such as Raspbian for the Raspberry Pi have Node-Red preinstalled. It was not the case for the Armbian distro for the Orange Pi. The following commands allows to install and setup Node-Red on almost any SBC (et least thoses running on Ubuntu/Debian).
First of all, update your board by typing the following commands on the terminal :
sudo apt update sudo apt upgrade
Then you can install Node-Red
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - sudo apt install -y nodejs sudo npm install -g --unsafe-perm node-red
To automatically start Node-Red on boot you can use the following command (for Raspberry Pi)
sudo systemctl enable nodered.service
The previous command will not work for SBC that do not have Node-Red pre-installed because the nodered service does not exist. It is therefore necessary to create it as follows:
sudo nano /etc/systemd/system/node-red.service
This command will create an empty node-red.service, which must be completed by this (don't forget to place the specific name of your device) :
[Unit] Description=Node-RED After=syslog.target network.target [Service] ExecStart=/usr/bin/node-red --max-old-space-size=128 -v Restart=on-failure KillSignal=SIGINT SyslogIdentifier=node-red StandardOutput=syslog WorkingDirectory=/home/PLACE USER NAME HERE/ User=root Group=root [Install] WantedBy=multi-user.target
Finally, you should be able to enable the service node-red as for the Raspberry Pi
sudo systemctl enable node-red.service
To manually start Node-Red, type the following command in the terminal :
node-red
The Grapical User interface should be accessible by any computer/smartphone connected to the same network as your server. To know the local IP of your server type this command in the terminal :
ifconfig
The local IP should appear here.
This command also allows you to obtain your IP address :
hostnname -I
On your Web-Browser type yourserverip:1880 in this example 192.168.8.10:1880. The following windows will appear :
Now that Node-Red is installed, you will need to add some libraries (Manage palette on the top right corner) to be able to run our program correctly. The required libraries are :
You can finally import our flow LINK
Type the following commands on the terminal (directly from the SBC or by SSH)
sudo apt install -y mosquitto mosquitto-clients sudo systemctl enable mosquitto.service
The MQTT broker is now installed. All the MQTT nodes should work properly.
If the Node-Red server is running on the same device as the Mosquitto broker, it is nos necessary to modify the broker IP.
To modify the broker IP, double clic on the MQTT node (the Pink/Purple ones) and replace localhost:1883 by brokerIP:1883
The broker IP can be obtained by ifconfig or hostname -I commands.