Interfacing Arduino with SSD1331 Color OLED Display

Adding a display to an electronic circuit can significantly enhance the functionality, usability, and overall user experience of the electronic project. Whether it’s a simple LCD, an OLED display, or a TFT screen, displays provide visual feedback and interaction capabilities between the circuit and human that are essential for many applications.
As an addition to the above, adding a display to an electronic circuit can help solve project code issues.

This Arduino tutorial shows how to interface Arduino UNO board with SSD1331 color OLED display module that has a size of 0.95-inch and resolution of 96×64 pixel.
The example shows how to print texts and draw shapes (circles, rectangular…) on the SSD1331 OLED display.

Abbreviations:
LCD: Liquid Crystal Display.
OLED: Organic light Emitting Diode.
PLED: Polymer OLED.
TFT: Thin Film Transistor.
SPI: Serial Peripheral Interface.
IoT: Internet of things.

SSD1331 OLED display with Arduino example test circuit

The SSD1331 Color OLED Display Module:
The SSD1331 is a popular OLED/PLED display controller chip commonly used in small colored OLED displays. It supports a maximum resolution of 96×64 pixels and can drive RGB (Red, Green, Blue) OLED panels.

The SSD1331 OLED display module is a compact, color OLED display module that uses the SSD1331 controller. It typically has a resolution of 96×64 pixels and supports 16-bit color (65K colors).
The SSD1331 color OLED display is often used in applications where small, low-power displays are required.

The SSD1331 OLED display module used in this project is the one below:

SSD1331 Color OLED display module 0.95" 96*64 pixel

The SSD1331 display shown above works with SPI interface mode and has 7 pins. Below is the pinout for the display module, which is essential for connecting it to a microcontroller like Arduino, ESP32, Raspberry Pi, or Microchip PIC.

  • GND: Ground pin, connected to circuit common ground.
  • VCC: Power supply pin, may be 3.3V or 5V (refer to your display datasheet for power supply voltage range, some modules works only with 3.3V).
  • SCL: Serial clock pin for the SPI interface. Connected to the SPI clock pin (SCK) of the microcontroller.
  • SDA: Serial data pin for the SPI interface. Connected to the SPI data pin (MOSI) of the microcontroller.
  • RES: Reset pin. Used to reset the display. If used, it is connected to any general purpose output pin of the microcontroller.
  • DC: Data/Command selection pin. Connected to a digital output pin on the microcontroller. It determines whether the data on the bus is a command or actual pixel data.
  • CS: Chip Select pin (active low). Connected to a digital pin on the microcontroller. Used to enable or disable the communication with the SSD1331 OLED display.

Interfacing Arduino with SSD1331 Color OLED Display:
This post shows how to interface Arduino board with SSD1331 OLED display. Circuit diagram is shown below.

The SSD1331 color OLED display module shown in project wiring diagram has 7 pins: (from left to right): GND (ground), VCC, SCL (serial clock), SDA (serial data), RES (reset), DC (data/command), and CS (chip select).

Interfacing Arduino board with SSD1331 color OLED display module circuit

Hardware Required:
Required parts are listed below.

  • Arduino UNO (or similar) board   —> Board details
  • SSD1331 OLED display module
  • 5 x 2k ohm resistor
  • 5 x 1k ohm resistor
  • Breadboard
  • Jumper wires

Since the SSD1331 OLED display operates at 3.3V logic level and the Arduino uno board at 5V, I used a resistive voltage divider to reduce the 5V output of the Arduino to about 3.3V.
The resistive voltage divider may be the simplest method, but other more efficient ways can be used such as using logic level shifters.

As we have 5 data lines between the Arduino board and the SSD1331 display there are also 5 resistive voltage divider where each one is implemented with two resistors of 1k and 2k.

Connecting a 5V microcontroller directly to the SSD1331 OLED display violates the electrical characteristics written in the display datasheet and may damage the controller circuit of the display.

The SSD1331 display module is supplied with 3.3V from the Arduino board where:

  • GND pin of the SSD1331 display is connected to GND pin of the Arduino board, and
  • VCC pin of the display is connected to pin 3.3V of the Arduino board.

Other pins are connected as follows (each one through voltage divider):

  • SCL pin is connected to Arduino digital pin 13.
  • SDA pin is connected to Arduino digital pin 11.
  • RES pin is connected to Arduino digital pin 8.
  • DC pin is connected to Arduino digital pin 9.
  • CS pin is connected to Arduino digital pin 10.

Note that pins 13 and 11 of the Arduino uno and similar boards are hardware SPI pins of the ATmega328P microcontroller, for SCK (Serial Clock) and MOSI (Master-Out Slave-In), respectively.

Interfacing Arduino with SSD1331 Color OLED Display Code:
Project Arduino code is just an example of graphics test provided by Adafruit Industries, with some modifications.

To be able to compile project Arduino code, two libraries from Adafruit Industries are required:
The first library is a driver for the SSD1331 OLED display and it can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries…, in the search box write “ssd1331” and install the one from Adafruit).
The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.
During the installation of the Adafruit SSD1331 display library, Arduino IDE may ask for installing some other libraries form Adafruit Industries (dependencies).

Project code was tested with the following library versions:
Adafruit GFX Library: Version 1.11.11.
Adafruit SSD1331 OLED driver: Version 1.2.2.
Adafruit BusIO: Version 1.17.0.

The used libraries are included in the Arduino code as shown below:

The connection between the SSD1331 display and the Arduino board is as shown in the above wiring diagram, it is defined in the Arduino code as shown below:

The SSD1331 OLED is library is initialized with the previous defined connections and hardware SPI pins:

The SSD1331 OLED display must be initialized before any print operation, if the initialization failed then the display will show only black screen. The initialization function of the display is the one below:

For more details about Arduino SPI communication, see the following page:
Arduino & Serial Peripheral Interface (SPI)

Rest of code is described through comments.

Full Arduino code:
Project Arduino code is below. Use the following URL to browse the code on GitHub:
Arduino-SSD1331-OLED

Interfacing Arduino with SSD1331 OLED Display Video:
The following video shows a test hardware circuit of Arduino board with SSD1331 OLED display.


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top