Problem:
You would like to use a OLED display with a I2C interface with a Raspberry pi using a SH1106 controller ,
Solution:
That type of OLE Display have 4 connections, just follow the next wire schema to connect it to the Raspberry.
Connect the wires directly between the oled display and the Raspberry:
OLED pins >> Raspberry Pi
VDD >> 5V
GND >> GND
SCK >> SCL ( more information )
SDA >> SDA ( more information)
*Check the panel in your OLED display to ensure the correct pin definition in the oled panel
Setup the software:
Activate the I2C Interface option in system configuration, use the command raspi-config and go to interface settings, there you will fine the I2C option.
Install libraries:
Just use the following command:
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools
sudo apt-get reinstall build-essential
sudo apt-get install i2c-tools$ sudo apt-get update$ sudo apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 libtiff5 -y$ sudo -H pip3 install luma.oled
Check if the system detect it:
You can check it if you find signal in this interface map, use the
command: sudo i2cdetect -y 1
1.- Clonning the exmaple repository:$ git clone https://github.com/rm-hull/luma.examples.git$ cd luma.examples2.- install librariessudo -H pip install -e .3.- run examplescd examplessudo python3 3d_box.py
Hardware: