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

How to Use oled: Examples, Pinouts, and Specs

Image of oledDesign with oled in Cirkit Designer

Introduction

An Organic Light Emitting Diode (OLED) is a display technology that uses organic compounds to emit light when an electric current is applied. Unlike traditional LCDs, OLED displays do not require a backlight, resulting in deeper blacks, higher contrast ratios, and more vibrant colors. Additionally, OLEDs offer wide viewing angles and fast response times, making them ideal for a variety of applications.

Common applications of OLED displays include:

This documentation focuses on using an OLED display with the Arduino UNO (manufacturer part ID: UNO).

Explore Projects Built with oled

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 Touch Interface with OLED Display and Servo Feedback: A project utilizing oled in a practical application
Arduino UNO Controlled Touch Interface with OLED Display and Servo Feedback

This circuit features an Arduino UNO microcontroller connected to a touch sensor, an OLED display, a servomotor, and a buzzer. The touch sensor's output is connected to a digital pin on the Arduino for touch input detection. The OLED display communicates with the Arduino via I2C (SDA and SCL lines connected to A4 and A5), the servomotor is controlled by a digital PWM output (D9), and the buzzer is connected to another digital pin (D8) for audio feedback.

Open Project in Cirkit Designer

Technical Specifications

Below are the key technical details for a typical OLED display module compatible with the Arduino UNO:

Specification Details
Display Type OLED (Organic Light Emitting Diode)
Resolution 128x64 pixels
Interface I2C (Inter-Integrated Circuit)
Operating Voltage 3.3V - 5V
Current Consumption ~20mA (varies with brightness)
Viewing Angle ~160°
Dimensions Varies (e.g., 0.96", 1.3", etc.)
Driver IC SSD1306

Pin Configuration

The OLED module typically has 4 pins for I2C communication. Below is the pin configuration:

Pin Name Description
VCC Power supply (3.3V or 5V)
GND Ground
SCL Serial Clock Line (I2C clock)
SDA Serial Data Line (I2C data)

Usage Instructions

Connecting the OLED to Arduino UNO

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

  1. Connect the VCC pin of the OLED to the 5V pin on the Arduino UNO.
  2. Connect the GND pin of the OLED to the GND pin on the Arduino UNO.
  3. Connect the SCL pin of the OLED to the A5 pin on the Arduino UNO (I2C clock line).
  4. Connect the SDA pin of the OLED to the A4 pin on the Arduino UNO (I2C data line).

Installing Required Libraries

To control the OLED display, you need to install the following libraries in the Arduino IDE:

  1. Open the Arduino IDE.
  2. Go to Sketch > Include Library > Manage Libraries.
  3. Search for "Adafruit GFX" and "Adafruit SSD1306" in the Library Manager.
  4. Install both libraries.

Example Code

Below is an example code to display "Hello, World!" on the OLED:

#include <Adafruit_GFX.h>       // Graphics library for OLED
#include <Adafruit_SSD1306.h>  // SSD1306 driver library

#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 (not used with I2C)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  // Initialize the display
  if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
    // Check if the display is connected
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Loop forever if initialization fails
  }

  display.clearDisplay();       // Clear the display buffer
  display.setTextSize(1);       // Set text size (1 = small, 2 = medium, etc.)
  display.setTextColor(SSD1306_WHITE); // Set text color to white
  display.setCursor(0, 0);      // Set cursor position (x, y)
  display.println(F("Hello, World!")); // Print text to the display
  display.display();            // Display the text on the screen
}

void loop() {
  // Nothing to do here
}

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. The OLED display does not turn on.

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

    • Ensure the correct libraries are installed and included in the code.
    • Verify the I2C connections and ensure no loose wires.
  3. The text or graphics are not visible.

    • Check the contrast/brightness settings in the code.
    • Ensure the display.display() function is called after drawing.

Tips for Troubleshooting

By following this documentation, you can successfully integrate and use an OLED display with the Arduino UNO for various projects.