This tutorial explains how to install the driver and custom python script for the Andino IO board on the Raspberry Pi. This is a prerequisite for using Node-Red to print messages on the screen. For documentation on the Node-Red nodes, refer to Andino IO / Raspberry Pi: OLED display control nodes (Adafruit SSD1306)
Important: Due to the migration to the new Adafruit library, the OLED Node-Red connection is temporarily unavailable. This will be fixed with the upcoming unified Andino libraries & firmware in June/early July 2021. Displaying messages using python-scripts as described in this tutorial, however, still works normally.
First, without root privileges, navigate to your home directory
cd ~
If you have not yet installed python3 and some other dependencies, do it now:
sudo apt-get install python3 python3-pip python3-dev libopenjp2-7 libopenjp2-7-dev libtiff5
We also need to install some dependencies and the Adafruit library itself from pip3:
sudo pip3 install adafruit-circuitpython-lis3dh adafruit-circuitpython-busdevice adafruit-circuitpython-framebuf adafruit-circuitpython-ssd1306 pillow
The driver should now be installed. You can test the display by running a slightly modified example by Adafruit. Create a folder for the example:
mkdir oled && cd oled
mkdir examples && cd examples
Download the example:
wget 'https://raw.githubusercontent.com/andino-systems/Andino/master/Andino-IO/src/oled/examples/ssd1306_stats.py'
The unmodified version and several other examples (including ones with geometric shapes) can be found on the Adafruit Github Repository.
You can now run the script directly by running:
python3 ~/oled/examples/ssd1306_stats.py
To close the script again, press Ctrl + C.
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/display-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/display-scripts.sh
Add the following content in the file:
#!/bin/bash
pkill python3
# Run the OLED test script
cd /home/pi/oled/examples/
/usr/bin/python3 ssd1306_stats.py &
Save and quit, then make sure the script is executable
chmod 755 /home/pi/display-scripts.sh