I2C OLED For Raspberry Pi
Just 1/4th the size of an RPi, the SunFounder 0.9" OLED is an extension to make your projects easier. White-on-blue OLED display is made of 128x32 individual white OLED pixels, each of which is turned on or off by the controller chip - SSD1306 IC. A great way to display debug information and to visualize data without the need of a serial terminal.
The driver chip SSD1306 communicates via I2C, so only 6 pins are required to communicate with Raspberry Pi and you can insert the chip into in all versions of RPis. To make things super interesting, because the display makes its own light, you will not require any backlight. This reduces the power required to run the OLED and is why the display has such a high contrast.
Please note that OLED displays are made of hundreds of...OLEDs! That means each pixel is a little organic LED, and if it's kept on for over 1000 hours it'll start to dim. If you want to keep the display uniformly bright, please turn off the display (set the pixels off) when it isn't needed to keep them from dimming.
- Size: 0.9 inch
- Resolution: 128 x32
- Type: OLED
- Color: Single white
- Communication Interface: I2C
- 1 x 0.9 OLED Display
Firstly, you need to switch on the i2c function RPi.
- sudo apt-get install -y python-smbus
- sudo apt-get install -y i2c-tools
- sudo raspi-config
- sudo reboot
Install Adafruit-SSD1306 library.
Finish your installation as indicated in the command.
- sudo python -m pip install --upgrade pip setuptools wheel
Note: In this step, if there is an error prompt "TypeError: unsupported operand type(s) for -=: ‘Retry’ and ‘int’", you can try to reinstall pip to solve this problem.
- sudo apt-get remove python-pip python3-pip
- sudo apt-get install python-pip python3-pip
Install the PIL library and some image processing programs use this.
- sudo apt-get install python-pil python3-pil
Use pip to install adafruit-ssd1306 library.
- sudo pip install Adafruit-SSD1306
Save for downloading a code library containing examples.
- cd ~
- git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
In the sample directory, you can see that there is some ready code, after the screen is connected, you can run directly to see the effect.
- cd ~/Adafruit_Python_SSD1306/examples/