PROJECT 10 · DISPLAY

OLED Display (SSD1306)

Show text on a 0.96″ 128×64 I²C screen — a building block for local, phone‑free output.

⬇ Download the sketch Save Project_10_ESP32_OLED_Display.ino, then open it in the Arduino IDE (setup: Project 0b). Needs the Adafruit SSD1306 + GFX libraries.

1 · About the display & I²C

The SSD1306 is a crisp 128×64 monochrome OLED — self‑lit pixels, great contrast, low power. It talks over I²C, a two‑wire bus (SDA + SCL). ESP32 defaults: GPIO 21 (SDA), GPIO 22 (SCL). This module's I²C address is 0x3C.

OLED pinESP32
VCC3.3 V
GNDGND
SCLGPIO 22
SDAGPIO 21
The 0.96 inch SSD1306 OLED module
0.96″ SSD1306 OLED (GND · VCC · SCL · SDA).

2 · Install the required libraries

Two Adafruit libraries (both in the Library Manager):

Restart the IDE after installing.

3 · Wiring

OLED: SDA to GPIO 21, SCL to GPIO 22, VCC to 3.3 V, GND to GND
Four wires — SDA → 21, SCL → 22, VCC → 3.3 V, GND → GND. No resistors.

4 · The drawing API

Clear → set style → position → print → push to the display. Nothing appears until display():

display.clearDisplay();          // erase the buffer
display.setTextSize(2);          // 1 = small ... bigger = larger
display.setTextColor(WHITE);     // white text on black
display.setCursor(0, 30);        // x, y start
display.println("LAFVIN");       // write into the buffer
display.display();               // <-- actually show it

Scrolling is built in: startscrollright(), startscrollleft(), stopscroll().

5 · Upload & expected serial output

==============================================
 Project 10: ESP32 OLED Display (SSD1306)
==============================================
I2C: SDA = GPIO 21, SCL = GPIO 22, address 0x3C
[OLED] Display initialized OK.
[OLED] Showing text: "LAFVIN" (will scroll).

The improved sketch confirms the display started and prints a wiring/address hint if it can't find the screen (the original just froze silently on failure).

6 · Demonstration

OLED showing LAFVIN on a breadboard
The text appears, then scrolls right and left on a loop.

7 · Troubleshooting

SymptomLikely causeFix
"display not found"Wiring or wrong addressSDA→21, SCL→22, VCC→3.3 V, GND→GND; try 0x3D
Blank, no serial errorVCC floatingConfirm VCC is 3.3 V
Compile error (SSD1306/GFX)Libraries missingInstall Adafruit SSD1306 and GFX
Garbled pixelsLoose I²C wiresReseat SDA/SCL
← Project 9 · DHT11 Web Server 🏠 Back to the Project Hub