Join GitHub today
SSD1306 based OLED connected to Arduino
A few weeks ago I bought two of these cheap "I2C OLED 0.96 inch displays" on eBay. Since it took me a while to get them up and running, i want to share my findings with you. I will give three example sketches, each using a different library (Adafruit, u8g and smart components).
This is how the display looks like
Although it was sold as an I2C display, it turned out that it operates as an SPI device by default. If you look at the back side, you can see that it is in 4-wire SPI mode. I2C operation will be researched in another post later.
- Display technology: OLED
- Size: 0.96"
- Resolution: 128x64
- Protocol: SPI
- Power supply range: 3V-5V
- Chipset: SSD1306, Datasheet
PIN name confusion
The display has the following pins: GND, VCC, D0, D1, RES, DC, CS. Since pin names are often named differently, i will give an overview of commonly used names for refernce:
Sketch using Adafruit library
Wiring used in the Sketch:
- Sketch: https://github.com/pacodelgado/arduino/tree/master/ssd1306_sample_adafruit
- Libraries: https://github.com/adafruit/Adafruit_SSD1306 and https://github.com/adafruit/Adafruit-GFX-Library
Sketch using u8g
The sketch uses the same wiring as in the Adafruit example.
Smart Components sketch
Wiring for sketch: