Arduino UNO OLED Display Tutorial

An OLED (Organic Light Emitting Diode) display is a compact screen used to display text and graphics in embedded systems.

Unlike LCDs, OLED displays do not require a backlight, making them more power efficient and providing better contrast.

In this tutorial, you will learn how to connect an OLED display to Arduino UNO and display text using I2C communication.

1. Required Components

Arduino UNO board

OLED Display (SSD1306 0.96 inch, I2C)

Jumper wires

USB cable

2. OLED Display Wiring

Most OLED displays come with 4 pins for I2C communication:

VCC → 5V (or 3.3V)

GND → Ground

SCL → A5 (Arduino UNO)

SDA → A4 (Arduino UNO)

3. Connection Summary

OLED VCC → Arduino 5V

OLED GND → Arduino GND

OLED SCL → A5

OLED SDA → A4

4. Required Libraries

Adafruit SSD1306

Adafruit GFX

Install these libraries using the Arduino Library Manager.

5. Arduino Code

Program: OLED display example
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {
  Serial.begin(9600);

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED not found");
    while(true);
  }

  display.clearDisplay();

  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(10, 20);

  display.println("Hello!");
  display.display();
}

void loop() {
}

This program initializes the OLED display and prints 'Hello!' on the screen.

6. Working Principle

The OLED display communicates with Arduino using the I2C protocol.

The Arduino sends data to the display using SDA and SCL lines.

The SSD1306 controller processes this data and displays it on the screen.

7. Common Mistakes

Wrong I2C address (use 0x3C or 0x3D).

Incorrect wiring of SDA and SCL pins.

Missing required libraries.

Loose connections causing display issues.

8. Best Practices

Use short wires for stable communication.

Always connect common ground.

Clear the display before updating new data.

Use correct I2C address by scanning devices.

Conclusion

Interfacing an OLED display with Arduino UNO is simple and useful for displaying real-time data.

With just a few connections and libraries, you can build advanced embedded system interfaces.

You can extend this project by displaying sensor data, animations, or menus.