Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use 128x64 OLED Display (I2C IIC SPI Serial): Examples, Pinouts, and Specs

Image of 128x64 OLED Display (I2C IIC SPI Serial)Design with 128x64 OLED Display (I2C IIC SPI Serial) in Cirkit Designer

Introduction

The DollaTek 128x64 OLED Display is a compact and versatile screen module that utilizes organic light-emitting diodes to provide a high-contrast, high-resolution display. This particular model, identified by the part ID SSH1106, is capable of displaying graphics and text in a monochrome (single-color) format. It supports multiple communication protocols, including I2C (Inter-Integrated Circuit), IIC (Intelligent Interface Controller, often used interchangeably with I2C), and SPI (Serial Peripheral Interface), making it highly adaptable to various microcontroller platforms, such as Arduino, Raspberry Pi, and others.

Explore Projects Built with 128x64 OLED Display (I2C IIC SPI Serial)

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO with I2C OLED Display Interface: A project utilizing 128x64 OLED Display (I2C IIC SPI Serial) in a practical application
Arduino UNO with I2C OLED Display Interface

This circuit connects an Arduino UNO to a 128x64 OLED display using I2C communication protocol. The Arduino provides power to the display and communicates with it via the SDA and SCL lines connected to the A4 and A5 pins, respectively. The embedded code initializes the display and prints 'Hello, World!' on it.

Open Project in Cirkit Designer
Image of Arduino Nano Controlled OLED Display Interface: A project utilizing 128x64 OLED Display (I2C IIC SPI Serial) in a practical application
Arduino Nano Controlled OLED Display Interface

This circuit connects an Arduino Nano to an OLED 128x64 I2C Monochrome Display. The Arduino provides power to the OLED display and communicates with it via the I2C protocol, using its A4 and A5 pins as SDA and SCK lines, respectively. The embedded code initializes the display and draws a single pixel on it, which suggests that the circuit is designed for visual output, possibly for a user interface or data visualization.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number I2C/IIC Mode SPI Mode Description
1 GND GND Ground
2 VCC VCC Power Supply (3.3V-5V)
3 SCL D0/CLK Serial Clock Line
4 SDA D1/MOSI Serial Data Line
5 RES RES Reset Pin
6 DC DC Data/Command Control Pin
7 CS CS Chip Select (SPI mode)
8 - - Not Connected

Usage Instructions

How to Use the Component in a Circuit

  1. Power Connections: Connect the VCC pin to a 3.3V or 5V power supply and the GND pin to the ground.
  2. Data Connections (I2C/IIC Mode): Connect the SCL pin to the I2C clock line and the SDA pin to the I2C data line of your microcontroller.
  3. Data Connections (SPI Mode): Connect D0/CLK to the SPI clock, D1/MOSI to the SPI MOSI line, CS to the chip select, DC to the data/command control pin, and RES to the reset pin of your microcontroller.
  4. Initialization: Upon power-up, the display must be initialized using the appropriate commands sent from the microcontroller.

Important Considerations and Best Practices

Example Code for Arduino UNO (I2C Mode)

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  // Initialize with the I2C addr 0x3C (for the 128x64)
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, WHITE);

  // Display the drawing
  display.display();
}

void loop() {
  // Nothing here for this simple example
}

Note: The example code provided uses the Adafruit SSD1306 library, which is compatible with the SSH1106 driver with minor differences. The library can be installed via the Arduino Library Manager.

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

FAQs

Q: Can I use this display with a 5V microcontroller? A: Yes, the display can be powered with 5V, but ensure that the logic levels for data lines match the microcontroller's.

Q: How do I know if my display is in I2C or SPI mode? A: The mode is determined by how you wire the display to your microcontroller and how you initialize it in your code.

Q: What library should I use for this display? A: For Arduino, the Adafruit SSD1306 library is commonly used, though you may need to make minor adjustments for the SSH1106 driver.

Q: Can I display images on this OLED? A: Yes, you can display bitmap images by converting them into a byte array format that the display can interpret.

Q: How do I adjust the contrast or brightness of the display? A: These settings can be adjusted through commands sent from the microcontroller to the display. Refer to the SSH1106 datasheet for specific commands.