Interactive Mission

Connect OLED Display with ESP32

Serial Monitor is great for debugging — but a real screen on your project looks amazing. This mission adds a tiny OLED display that shows your own messages.

Quick BuildBeginner10–15 minutesParent SafeTeacher Friendly
Connect OLED Display with ESP32 guide illustration

Review, Testing, and References

Author: Abdul Mubeen and the ESP32 Engine editorial team. Last updated: 2026-06-26. Reviewed: educational accuracy and beginner safety. Level: Beginner. Estimated time: 10–15 min.

This guide is written for learning and bench prototyping. Check the testing notes before adapting the circuit to different boards, batteries, relays, motors, or outdoor hardware.

Quick Build

Give Your Project a Face!

The Story

Blinking lights and sensor numbers are cool — but every great gadget has a screen. Game consoles, phones, even microwave ovens show you what's happening.

Your ESP32 will talk to a small OLED display using just four wires. When you see "Hello, Maker!" glow on that blue screen, your project starts to feel like a real product.

Explain Like I'm 12

The OLED is a tiny TV screen with only four wires: power, ground, and two communication wires called SDA and SCL. They form a language called I2C — like a two-lane road where the ESP32 sends drawing instructions and the screen shows them.

Mission Goal

Serial Monitor is great for debugging — but a real screen on your project looks amazing. This mission adds a tiny OLED display that shows your own messages.

Estimated Time

10–15 min

Difficulty

Beginner

Prerequisites

No prerequisites.

Skills You'll Learn

  • Wire SSD1306 OLED via I2C (SDA, SCL, 3.3 V, GND)
  • Use Adafruit SSD1306 and GFX libraries
  • Draw text on a 128×64 screen

Components Required

Engineering Explanation

I2C lets multiple devices share two wires — SDA (data) and SCL (clock). Each device has an address; OLED modules usually use 0x3C.

The Adafruit SSD1306 library handles the hard work. You call display.println() like Serial, then display.display() to refresh the pixels.

Real-World Analogy

The OLED is a tiny TV screen with only four wires: power, ground, and two communication wires called SDA and SCL. They form a language called I2C — like a two-lane road where the ESP32 sends drawing instructions and the screen shows them.

Wiring Diagram

Follow these steps in order. Unplug USB before you change any wires.

Wiring Diagram OLED VCC to 3.3V, GND to GND, SDA to GPIO21, SCL to GPIO22
  1. 1

    Unplug USB. Place the OLED module on the breadboard or connect its pins directly.

  2. 2

    Connect OLED VCC to ESP32 3.3 V.

  3. 3

    Connect OLED GND to ESP32 GND.

  4. 4

    Connect OLED SDA to ESP32 GPIO21 (default I2C SDA).

  5. 5

    Connect OLED SCL to ESP32 GPIO22 (default I2C SCL).

  6. 6

    Install Adafruit SSD1306 and Adafruit GFX libraries in Arduino IDE.

Arduino Code

Copy this into Arduino IDE, then click Upload.

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

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for (;;) {}
  }
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 20);
  display.println("Hello,");
  display.println("Maker!");
  display.display();
}

void loop() {
}

Expected Behaviour

After upload, the OLED shows "Hello," on the first line and "Maker!" on the second in bright white text on a dark background.

If the screen stays blank, run an I2C scanner sketch or check SDA/SCL wiring. Try address 0x3D if 0x3C doesn't work on your module.

Mini Challenge

No wrong answers — experiment and have fun!

Show live DHT22 temperature on the OLED if you completed Mission 2 — combine both sketches! Or animate text: scroll "ESP32 Engine" across the screen using setCursor in a loop.

Previous Mission

Start here.

Next Mission

Continue Learning