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.
What You'll Build
An SSD1306 128×64 OLED connected to ESP32 over I2C. Your code clears the screen and displays a message in large text — the foundation for showing sensor readings, menus, and game scores.
Things You'll Need
- ESP32 DevKit board
- SSD1306 OLED display0.96 inch, 128×64, I2C interface
- Breadboard and jumper wiresFour wires for VCC, GND, SDA, SCL
- USB cable
Component Spotlight
Learn more about the parts in your circuit.
What Is I2C?
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.
Wiring Diagram
Follow these steps in order. Unplug USB before you change any wires.
-
1
Unplug USB. Place the OLED module on the breadboard or connect its pins directly.
-
2
Connect OLED VCC to ESP32 3.3 V.
-
3
Connect OLED GND to ESP32 GND.
-
4
Connect OLED SDA to ESP32 GPIO21 (default I2C SDA).
-
5
Connect OLED SCL to ESP32 GPIO22 (default I2C SCL).
-
6
Install Adafruit SSD1306 and Adafruit GFX libraries in Arduino IDE.
Code
Copy this into Arduino IDE, then click Upload.
#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 Output
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 Quiz
Quick check — no grades, just confidence!
Q1. Which two pins carry I2C communication on ESP32?
Q2. What function updates the pixels on the screen?
Challenge Yourself
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.
Mission Complete!
Your ESP32 now has a display! You learned I2C wiring, display libraries, and how embedded devices show information without a computer attached. This is exactly how commercial IoT gadgets work.
- Wire SSD1306 OLED via I2C (SDA, SCL, 3.3 V, GND)
- Use Adafruit SSD1306 and GFX libraries
- Draw text on a 128×64 screen