OpenMarine
SignalK and SSD1306 OLED - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: SignalK and SSD1306 OLED (/showthread.php?tid=5085)



SignalK and SSD1306 OLED - DroZDi - 2024-01-10

I have just worked a bit to make possible read data from SignalK with signalK API and redirect it to OLED screen.
I didnt want to read directly from I2C bus as already openplotter-i2c-read module does  and it sends to signalK.

It was tested on my orange pi 5 plus with i2c bus =2 (/dev/i2c-2) and SSD 1306 OLED screen (i2c device address should be 0x3C).
This is customized solution only for 3 sensors as temperature/humidity and pressure (example).

Idea is simple:
- read data from signalK through API (info.sh)
- format / filter data and prepare log file to display (info.log -> info2.log)
- oled128x64 reads info2.log file and it sends to OLED screen , next after 30 s, it turns it off (main program: sensors.sh)

To clear OLED display, please use: ./oled128x64clear /dev/i2c-2 command.

oled128x64 and oled128x64clear were rewritten and based on https://forum.armbian.com/topic/3747-sh1106-128x64-ssd1306-i2c-oled-display-library/


RE: SignalK and SSD1306 OLED - DroZDi - 2024-01-12

Second version based on some code found in Python.
This time it is designed for OLED 128x32 display.
Idea is similar:
- read data from signalK through API (info.sh)
- format / filter data and prepare log file to display (info.log -> info2.log)
- oled128x32.py reads info2.log file and it sends the line to OLED screen one by one every 15 s and finally it turns the display off (main program: sensors2.sh)

Based on https://www.waveshare.com/wiki/0.91inch_OLED_Module
Please also go there to download Font.ttf which is needed here. Probably it is possible to get ttf fonts from windows and use it also here changing name in oled128x32.py but not tested.
In the file SSD1306.py please adjust too I2C bus number according to your configuration: -> i2c-2  -> SMBus(2)