OLED-SSD1306 Module

From Wiki
Jump to: navigation, search



SSD1306 is a single-chip CMOS OLED/PLED driver with controller for organic / polymer light emitting diode dot-matrix graphic display system. It consists of 128 segments and 64commons. This IC is designed for Common Cathode type OLED panel. The SSD1306 embeds with contrast control, display RAM and oscillator, which reduces the number of external components and power consumption. It has 256-step brightness control. It is suitable for many compact portable applications, such as Smart watch,eal-time image display of camera on smart car,Battery management device,etc.




  • For OLED-SSD1306, a more elaborate and beautiful screen than LCD, with more functions
  • High contrast, thus supporting clear display With no need of backlight
  • Working voltage: 2.7V - 5.5V; PCB size: 2.8 x 3.2cm
  • Standard double-sided printed circuit board, 1.16mm thick, with an elegant layout, 3-mm holes at two corners for easy fixing
  • Low power consumption: 0.04W during normal operation


To use the OLED with Arduino, you can take the following steps.

Step1:Connecting circuit 
SSD1306 ------- Arduino Uno/Mega2560
GND --------- GND
VCC ------- 5V
SCL ------- A5 Uno/pin21 Mega2560
SDA ------- A4 Uno/pin20 Mega2560
Step2:Install the Arduino IDE in your computer.For detailed steps,refer to 


Step3:Add U8glib library. 

1) Through the links at the bottom of the page to download U8glib.zip and unzip.

2)the Arduino IDE, import the library from the "Add Library" Menu.

Add ssd1306.jpg

3) Find the u8glib folder you just extracted,clink open.


Step4:Open Graphics_Test.ino, Before clicking the Upload  icon, set the Port and Board under Tools menu.Then upload the code to the board 


To use the OLED with Raspberry Pi, you can take the following steps.

Step1:Connecting circuit 
SSD1306 ------- Raspberry Pi
GND ------- GND
VCC ------- 3.3V
SCL ------- SCL
SDA ------- SDA



git clone https://github.com/adafruit/Adafruit_Python_SSD1306


Go to the folder extracted from the package file downloaded:
cd Adafruit_Python_SSD1306
sudo python setup.py install

Step4:Edit the code

Go to the examples folder and you can see some example files inside. Let's take shapes.py for example.
cd examples
nano shapes.py
Since we use the I2C interface, the lines for SPI interface need to be commented out.
Add a # to the beginning of the lines to do it.
Here comment out the Line 23 #import Adafruit_GPIO.SPI as SPI.
Comment out Line 34, 35, and 36:
Comment out Line 46:
Comment out Line 49:
Press Ctrl+O to save, and Ctrl+X to exit.

Then run the program:
Python shapes.py