Project Overview

The OLED modules used here are 0.96-inch, 128×64-pixel displays based on the SSD1306 controller. The controller receives commands and display data from the Arduino and manages the individual OLED pixels.

The SSD1306 also contains its own display memory, so the Arduino does not need to continuously refresh every pixel. OLED pixels generate their own light, eliminating the need for a backlight and providing good contrast, deep blacks, and wide viewing angles.

Most of these modules operate from 3.3V to 5V, and many include an onboard 3.3V regulator, allowing them to be connected directly to a 5V Arduino board.

Hardware Required

  • Arduino Nano R3
  • 0.96-inch 128×64 I2C OLED with SSD1306 controller
  • 0.96-inch 128×64 SPI OLED with SSD1306 controller
  • USB-A to Mini-B cable
  • Jumper wires
  • 5V power adapter

OLED Module Hardware

I2C OLED

An I2C OLED normally has a four-pin interface consisting of VCC, GND, SCL, and SDA. Depending on the module, the PCB may also contain an address-selection jumper, pin-swap jumper, voltage regulator, resistors, capacitors, and the OLED panel connector.

The 3.3V regulator converts a higher input voltage, such as 5V, to a stable 3.3V supply for the display circuitry.

The I2C address jumper allows the SSD1306 address to be selected. The controller commonly supports 0x3C and 0x3D in 7-bit addressing. For example, 0x3C becomes 0x78 when left-shifted by one bit for 8-bit representation. On the module used in this project, the jumper is set for 0x3C, so that is the address used by the Arduino code.

SPI OLED

The SPI version uses more connections because SPI requires separate clock, data, and control signals. The OLED panel and SSD1306 controller are essentially the same, but the interface typically uses six pins.

Unlike I2C, SPI does not require pull-up resistors on the communication lines because it uses push-pull signaling. Therefore, the resistor arrangement on an SPI module can differ from an I2C version.

SSD1306 Display Memory

Understanding the SSD1306 memory structure helps explain how graphics are stored on the display.

The controller contains 1KB (1024 bytes) of GDDRAM, which works as the display's frame buffer. Each bit represents the ON or OFF state of one OLED pixel.

For a 128×64 display, the memory is arranged as:

  • 8 pages, numbered Page 0 through Page 7
  • Each page contains 128 columns
  • Each column controls 8 vertical pixels

Therefore:

8 pages × 128 columns × 8 bits = 8,192 bits = 1,024 bytes = 1KB

Interestingly, SSD1306 modules contain the same 1KB memory even when the physical display resolution is different. A 128×64 display uses all eight pages, while a 128×32 display uses only the first four.

Display Specifications

The OLED used in this project is a monochrome Organic LED display with a 0.96-inch screen, 128×64 resolution, and an operating voltage of 3.3V–5V. Its typical maximum operating current is around 20mA.

I2C OLED Pinout

The four pins on the I2C module are:

  • GND: Ground connection to the Arduino.
  • VCC: Power input. The modules used here support 3.3V–5V operation.
  • SCL: I2C clock line.
  • SDA: I2C data line. It carries both command information and pixel data to the SSD1306.

SPI OLED Pinout

The SPI OLED uses six pins:

  • GND: Ground connection.
  • VCC: Power supply for the display.
  • SCK: SPI clock signal generated by the microcontroller.
  • MOSI: Transfers commands and display data from the Arduino to the OLED.
  • CS: Chip Select, used to enable or disable communication with the OLED.
  • D/C: Data/Command selection. LOW indicates a command, while HIGH indicates display data.

Connecting the OLED to Arduino Nano

I2C Wiring

The I2C version only requires four connections.

Connect VCC to 5V and GND to GND on the Arduino Nano. For I2C communication, connect the OLED's SCL to A5 and SDA to A4.

This simple two-wire communication interface makes I2C OLEDs convenient when several other peripherals also need to be connected to the Arduino.

SPI Wiring

The...

Read more »