User Tools

Site Tools


phototurbidostatv1

Phototubridostat V1

Introduction

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:

Material

Microcontrollers

  • Arduino Mega
  • Arduino Nano
  • Arduino Pro Mini

You can use cheaper Arduino and Wemos clones

Electronic

Single Board Computer

We used an Orange Pi Win Plus but any SBC would work as long as it is able to run Node-Red.

Tools and Consumables

  • 3D Printer
  • Soldering iron
  • Screwdriver, plier, …
  • 1.75mm Plastic (ABS, PLA, PETG, …)
  • Solder wire
  • Expoxy resin

Softwares


1. Prepare your SBC

1.1 Install the operating system

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 ?

How to install Armbian ?

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 ?

1.2 Setup Node-Red

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 :

Node-Red Documentation

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 :

  • node-red-contrib-modbus
  • node-red-contrib-multipart-stream-decoder
  • node-red-contrib-nora
  • node-red-contrib-opi-gpio
  • node-red-contrib-stoptimer
  • node-red-dashboard
  • node-red-node-base64
  • node-red-node-serialport

You can finally import our flow LINK

1.3 Setup the MQTT Broker

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.

2. Setup your computer

Work in progress

3. 3D Files

Work in progress

4. Arduino Programming

Work in progress

5. Wemos Programming

Work in progress

6. Turbidimeter

Work in progress

7. Lighting system

Work in progress

8. Pumps

Work in progress

9. Pumps Calibrator

Work in progress

10. Power Supply

Work in progress

phototurbidostatv1.txt · Last modified: 2019/08/22 11:04 (external edit)