SSD1306 based OLED connected to Arduino

jandelgado edited this page Mar 17, 2017 · 16 revisions

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).

Go here if you want to connect the SSD1306 to an ESP8266.

This is how the display looks like

OLED connected to Arduino Back side of OLED

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:

Pin Alternate Names Description
VCC Power supply
GND Ground
DC A0 Data/Command
CS Chip Select

Working sketches

Sketch using Adafruit library

Wiring used in the Sketch:

Display Arduino Pin
D0 12
D1 11
CS 8
DC 9
RES 10

Sketch using u8g

The sketch uses the same wiring as in the Adafruit example.

Smart Components sketch

Wiring for sketch:

Display Arduino Pin
D0 10
D1 9
DC 11
RES 13
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.