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

How to Use OLED SSD1309 : Examples, Pinouts, and Specs

Image of OLED SSD1309 Design with OLED SSD1309 in Cirkit Designer

Introduction

The OLED SSD1309 is a versatile display driver designed for small OLED screens. Manufactured by AITRIP with the part ID 12864 4 Pin IIC I2C, this component is ideal for applications requiring high-contrast graphical or textual displays. It supports resolutions up to 128x64 pixels and operates with low power consumption, making it suitable for battery-powered and embedded systems.

Explore Projects Built with OLED SSD1309

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 Controlled OLED Display with 9V Battery and Step-Down Converter: A project utilizing OLED SSD1309  in a practical application
Arduino UNO Controlled OLED Display with 9V Battery and Step-Down Converter

This circuit features an Arduino UNO connected to a 128x64 OLED display via I2C communication lines (SDA and SCL), with the Arduino providing control signals to the display. A 9V battery powers the circuit through a 12v to 5v step-down power converter, which supplies a regulated 5V to both the Arduino and the OLED display. The embedded code on the Arduino is configured to blink an onboard LED with a 1-second interval.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

Key Technical Details

Parameter Value
Manufacturer AITRIP
Part ID 12864 4 Pin IIC I2C
Display Resolution 128x64 pixels
Interface I2C (Inter-Integrated Circuit)
Operating Voltage 3.3V to 5V
Operating Current ~20mA
Communication Address 0x3C (default)
Display Type Monochrome OLED
Driver IC SSD1309
Operating Temperature -40°C to +85°C

Pin Configuration

The OLED SSD1309 module has a 4-pin interface for I2C communication. Below is the pinout:

Pin Number Pin Name Description
1 GND Ground (0V)
2 VCC Power Supply (3.3V or 5V)
3 SCL I2C Clock Line
4 SDA I2C Data Line

Usage Instructions

Connecting the OLED SSD1309 to an Arduino UNO

To use the OLED SSD1309 with an Arduino UNO, follow these steps:

  1. Wiring:

    • Connect the GND pin of the OLED to the GND pin of the Arduino.
    • Connect the VCC pin of the OLED to the 5V pin of the Arduino.
    • Connect the SCL pin of the OLED to the A5 pin of the Arduino (I2C clock line).
    • Connect the SDA pin of the OLED to the A4 pin of the Arduino (I2C data line).
  2. Install Required Libraries:

    • Install the Adafruit_GFX and Adafruit_SSD1306 libraries from the Arduino Library Manager.
  3. Example Code: Use the following code to display text on the OLED:

    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    
    // Define the OLED display width and height
    #define SCREEN_WIDTH 128
    #define SCREEN_HEIGHT 64
    
    // Create an SSD1306 display object
    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
    
    void setup() {
      // Initialize the display
      if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
        // If initialization fails, print an error message
        Serial.println(F("SSD1309 initialization failed!"));
        for (;;); // Halt execution
      }
    
      // Clear the display buffer
      display.clearDisplay();
    
      // Set text size and color
      display.setTextSize(1); // Small text size
      display.setTextColor(SSD1306_WHITE);
    
      // Display a message
      display.setCursor(0, 0); // Set cursor to top-left corner
      display.println(F("Hello, SSD1309!"));
      display.display(); // Render the text on the screen
    }
    
    void loop() {
      // Nothing to do here
    }
    

Important Considerations

Troubleshooting and FAQs

Common Issues and Solutions

  1. The display does not turn on:

    • Verify the wiring connections, especially the power (VCC and GND) and I2C lines (SCL and SDA).
    • Ensure the OLED is receiving the correct voltage (3.3V or 5V).
    • Check if the I2C address in the code matches the OLED's default address (0x3C).
  2. The display shows random or garbled data:

    • Confirm that the correct libraries (Adafruit_GFX and Adafruit_SSD1306) are installed and up to date.
    • Ensure the I2C clock speed is compatible with the OLED (typically 100kHz or 400kHz).
  3. The display remains blank after uploading the code:

    • Double-check the initialization code (display.begin()) and ensure the correct I2C address is used.
    • Test the I2C connection using an I2C scanner sketch to detect the OLED's address.
  4. The text or graphics appear distorted:

    • Verify the resolution settings in the code (SCREEN_WIDTH and SCREEN_HEIGHT).
    • Ensure the display buffer is cleared before rendering new content (display.clearDisplay()).

FAQs

Q: Can I use the OLED SSD1309 with a 3.3V microcontroller?
A: Yes, the OLED SSD1309 is compatible with both 3.3V and 5V logic levels.

Q: What is the maximum I2C cable length for this module?
A: The maximum cable length depends on the pull-up resistor values and the I2C clock speed. For typical setups, keep the cable length under 50cm to ensure reliable communication.

Q: Can I use this module with other microcontrollers like ESP32 or Raspberry Pi?
A: Yes, the OLED SSD1309 is compatible with any microcontroller that supports I2C communication, including ESP32, ESP8266, and Raspberry Pi.

Q: How do I display custom graphics on the OLED?
A: Use the Adafruit_GFX library's functions, such as drawBitmap(), to render custom graphics. You can create bitmaps using online tools or image-to-bitmap converters.

By following this documentation, you can effectively integrate the OLED SSD1309 into your projects and troubleshoot common issues with ease.