OLED
Interfacing SH1106 13 OLED with ESP32
What is the SH1106 13?
SH1106 13 practical reference
The SH1106 looks nearly identical to the SSD1306 — same 1.3-inch monochrome OLED form factor, same 4-pin I2C breakout, same 0x3C default address — but it's a different controller chip with a different internal frame buffer, and code written for one will not display correctly on the other. The SH1106's buffer is 132 pixels wide even though only 128 are visible, so the panel is offset by 2 pixels compared to the SSD1306, and libraries need to account for that offset explicitly.
In practice this means one thing matters more than anything else when working with this display: use a library that explicitly supports SH1106 (Adafruit_SH110X, or U8g2 with the correct constructor), not the Adafruit_SSD1306 library. Swap the constructor and everything else — drawing calls, fonts, buffer-and-flush pattern — works the same way as the SSD1306 you may already be used to.
Key specifications
- Display: 128 x 64 visible pixels, monochrome OLED (132-pixel-wide internal buffer)
- Operating voltage: 3.3V - 5V (most breakout modules have an onboard regulator)
- Interface: I2C (this module); SPI variants also exist
- I2C address: 0x3C default on most modules — scan to confirm, some ship at 0x3D
- Driver chip: SH1106 — NOT interchangeable in software with the visually similar SSD1306
- Known quirk: 132px internal buffer vs 128px visible — needs a 2px horizontal offset that SH1106-specific libraries handle automatically
Pinout and connection notes
The pinout is electrically identical to the SSD1306 module, so wiring mistakes aren't the usual failure mode here — a garbled or shifted image with correct wiring is almost always a library mismatch, not a hardware fault. Always confirm with Adafruit_SH110X or a U8g2 SH1106 constructor before assuming a display is faulty.
- GND: Ground
- VCC: Power, 3.3V-5V DC depending on the module's onboard regulator
- SCL: I2C clock line
- SDA: I2C data line
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up SH1106 13 with ESP32
Library
Adafruit SH110X by Adafruit
Library Manager → search "Adafruit SH110X" → install (also installs Adafruit GFX as a dependency)
Wiring
| Component pin | ESP32 pin | Note |
|---|---|---|
| GND | GND | |
| VCC | 3V3 | |
| SCL | GPIO22 | Default ESP32 I2C clock pin |
| SDA | GPIO21 | Default ESP32 I2C data pin |
Swipe sideways to see every column →
Code is identical to Arduino Uno — Wire.begin() on ESP32 defaults to GPIO21/22, so no pin remapping is needed in software.
Related Components
Related Guides & Projects
MicroPython vs Arduino on ESP32: Which Should You Learn First?
An honest comparison for beginners: where MicroPython is easier, where Arduino C++ is faster, how libraries and memory differ, and how to choose based on your project instead of hype.
MicroPython ESP32 Web Server: Control an LED or Relay from Your Browser
Create a working web server with the socket module, parse requests, serve a responsive control page for an LED or a relay, keep the displayed state truthful, choose a safe relay startup state and make the server survive bad or repeated requests.
MicroPython on ESP32 and Raspberry Pi Pico W: The Complete Guide
A structured MicroPython learning path for ESP32 and Pico W. Set up your tools, control GPIO, read sensors, connect to WiFi, build web servers, publish MQTT data and make projects reliable. Start here, then follow the links by level.
boot.py vs main.py in MicroPython: What Runs, When and Why
Understand the difference between boot.py and main.py in MicroPython, startup order, Wi-Fi setup, project structure, and recovery from boot errors.