ESP32 with OLED Display: SSD1306 & SH1106 Setup Guide
May 12th, 2026

OLED displays have become a favorite in ESP32 projects because they are small, sharp, and easy to use. Unlike traditional LCDs, they don’t need a backlight, which makes them more efficient and readable even in low-light environments. When paired with an ESP32, an ESP32 OLED Display becomes a simple way to show data, system status, or user interfaces without adding much complexity to your project.
What Is an OLED Display?
OLED stands for Organic Light Emitting Diode. Each pixel on the screen produces its own light, which means there is no need for a backlight.If you'd like to learn more about how OLED technology works, this OLED display overview provides additional technical details.
•Self-lighting pixels: Each pixel turns on independently
•Low power consumption: Only active pixels use energy
•High contrast: Deep blacks and bright whites
•Compact size: Ideal for small electronics projects
Because of these features, OLED displays are widely used in embedded systems and IoT devices.
SSD1306 vs SH1106: What’s the Difference?


Both ESP32 SSD1306 and ESP32 SH1106 modules are commonly used controller chips in monochrome OLED displays.They look similar but have small differences:
| Feature | SSD1306 | SH1106 |
|---|---|---|
| Controller Type | SSD1306 (Solomon Systech) | SH1106 (Sitronix) |
| Typical Resolution | 128×64 | 128×64 |
| Internal RAM | 128×64 (matches display) | 132×64 (extra columns) |
| Visible Area | Full RAM mapped to screen | Only 128 of 132 columns visible |
| Column Offset Issue | No | Yes (requires adjustment in some libraries) |
| I2C Support | Native and widely used | Supported but less consistent |
| SPI Support | Yes | Yes |
| Library Compatibility | Excellent (Adafruit, etc.) | Limited in Adafruit, better with U8g2 |
| Initialization Simplicity | Simple | May require specific constructor/settings |
| Display Alignment | Perfect by default | Sometimes shifted horizontally |
| Buffer Handling | Direct mapping | Offset handling required |
| Performance | Slightly faster (optimized libs) | Slightly slower in some cases |
| Power Consumption | Very low | Very similar |
| Availability | Very common | Also common in low-cost modules |
| Ease for Beginners | Easier | Slightly more complex setup |
In practice, both work well. The main difference is that SH1106 often requires a different library, while SSD1306 works directly with popular Adafruit libraries.
Why Use OLED with ESP32?
Using an OLED display with ESP32 opens up many possibilities for an ESP32 display project or beginner-friendly ESP32 OLED tutorial,especially for smart lighting, monitoring, and interactive electronics projects.
•IoT status screen: Show Wi-Fi status, IP address, or system info
•Sensor dashboard: Display temperature, humidity, or distance readings
•Clock: Build a digital or network-synced clock
•Menu system: Create simple user interfaces
•Portable gadgets: Perfect for battery-powered projects
The ESP32’s processing power combined with a clear display makes it ideal for interactive devices.
Components Required
For a basic ESP32 OLED setup, you’ll need:
•ESP32 development board
•OLED display (I2C interface, SSD1306 or SH1106)
•Jumper wires
•Breadboard (optional)
These components are easy to find and commonly used in beginner projects.
Understanding the Interface
Most ESP32 I2C OLED modules use I2C communication, which requires only two data lines:
•SDA (Serial Data): Transfers data
•SCL (Serial Clock): Synchronizes communication
If you're unfamiliar with ESP32 pins and interfaces, this ESP32 pinout guide can help.
Each I2C device also has an address. For OLED displays, the most common addresses are:
•0x3C
•0x3D
The correct address depends on the module, so it’s important to verify it when setting up your code.
ESP32 and OLED Wiring
Here is the typical wiring setup:
| OLED Pin | ESP32 Connection |
|---|---|
| VCC | 3.3V or 5V |
| GND | GND |
| SDA | GPIO 21 |
| SCL | GPIO 22 |
Most ESP32 boards use GPIO 21 for SDA and GPIO 22 for SCL by default.

Always check your OLED module specifications to confirm voltage compatibility.
Installing Libraries
To control the OLED display, you need to install the required libraries in the Arduino IDE:
•Adafruit SSD1306

•Adafruit GFX

These libraries handle display communication and graphics. If you are new to ESP32 development, you can also follow this step-by-step guide to install the ESP32 board in Arduino IDE.
If you are using an SH1106 display, consider using:
•U8g2 library
It supports a wider range of display controllers, including SH1106 OLED ESP32 modules.
Basic ESP32 OLED Example
Here is a simple ESP32 OLED example that displays “Hello World”:
#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() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10, 20);
display.println("Hello World");
display.display();
}
void loop() {
}
How it works:
•The SSD1306 OLED ESP32 display is initialized with its I2C address
•The screen is cleared before drawing
•Text size and position are set
•display.display() updates the screen
Displaying Sensor Data on OLED
Once your display works, you can show real data. For example:
•Temperature and humidity from a sensor
•Wi-Fi connection status
•ESP32 IP address
Example idea:
display.clearDisplay();
display.setCursor(0, 0);
display.println("Temp: 25C");
display.println("Humidity: 60%");
display.println(WiFi.localIP());
display.display();
This turns the OLED into a live ESP32 OLED dashboard, making it easier to monitor your project and display real-time hardware information.
Drawing Graphics and Icons
An ESP32 OLED screen can do more than just display text.You can draw shapes and graphics:
•Lines
•Rectangles
•Circles
•Bitmaps (custom icons)
Example:
display.drawLine(0, 0, 127, 63, WHITE);
display.drawCircle(64, 32, 10, WHITE);
display.display();
You can also display logos or simple animations using bitmap images. This is useful for creating user interfaces or visual indicators.You can also display logos or simple animations using bitmap images. This is useful for creating user interfaces or visual indicators.
Common Problems and Fixes
Here are some common issues with an ESP32 display module and how to fix them:
1. Blank Screen
•Check wiring connections
•Verify power supply
•Make sure display.display() is called
2. Wrong I2C Address
•Use an I2C scanner sketch
•Try 0x3C and 0x3D
3. Wrong Pins
•Ensure SDA and SCL match ESP32 defaults (21 and 22)
•Update code if using different pins
4. Power Issues
•Some modules need 3.3V, others support 5V
•Check specifications carefully
5. SH1106 Compatibility
•Use the correct library (like U8g2)
•SSD1306 libraries may not work properly
6. Nothing Updates on Screen
•Don’t forget to call display.display() after drawing
Fixing these small issues usually gets the display working quickly.
Conclusion
Using an OLED display with ESP32 is one of the easiest ways to create more interactive and user-friendly electronics projects. An ESP32 OLED Display is ideal for dashboards, portable gadgets, and beginner IoT systems. Whether you're building an IoT dashboard, a sensor monitor, or a portable gadget, SSD1306 and SH1106 displays provide a compact and efficient solution.
Once you master basic text and graphics, you can expand into menus, animations, and full project interfaces.
