This is a tutorial on how to install the AndinoIO Controller script. For a tutorial on how to connect to the TCP server established by the script via NodeRed, please refer to Andino X1: Digital Inputs and Relay Output custom node

The AndinoIO controller script allows the user to easily use read the inputs and control the relays of the AndinoIO board from other applications. The script establishes a TCP server on port 1997 by default.

First, make sure that you have python3 installed on your RaspberryPi

sudo apt-get install -y python3 python3-pil python3-pip

You also need to install fontconfig:

sudo apt-get install -y fontconfig

After the installation is complete, we need to install some drivers and other dependencies for the OLED:

sudo pip3 install adafruit_ssd1306
sudo pip3 install gpiozero
sudo pip3 install rpi.gpio

Navigate to the pi home directory

cd /home/pi

and download the script from Github

wget https://raw.githubusercontent.com/andino-systems/Andino/master/Andino-Common/src/NodeRed/AndinoIONode/python/v2/oee-tcp-multiple.py

make sure the script is executable

chmod 755 oee-tcp-multiple.py

The script can now be started using

python3 oee-tcp-multiple.py

To start the script on boot, first edit the rc.local file

sudo nano /etc/rc.local

Right before exit 0, add the following line

/home/pi/io-controller-scripts.sh

Press Ctrl + O to save and Ctrl + X to exit. Then, create the new script in the pi home directory

nano /home/pi/io-controller-scripts.sh

Add the following content in the file:

#!/bin/bash

pkill python3
cd /home/pi/
/usr/bin/python3 oee-tcp-multiple.py &

Save and quit, then make sure the script is executable

chmod 755 /home/pi/io-controller-scripts.sh

When rebooting, the controller script should now start automatically.