Skip to content
S

OLED

Interfacing SSD1306 0.96" OLED with STM32 Blue Pill

What is the SSD1306 0.96" OLED?

SSD1306 0.96" OLED practical reference

The SSD1306 drives a 0.96-inch monochrome OLED panel at 128x64 pixels over I2C (an SPI variant also exists, but the 4-pin I2C module is what most people reach for first). Unlike character LCDs, every pixel is individually addressable, so you can draw shapes, plot graphs, show custom fonts and icons, and scroll bitmap animations — not just fixed-width text.

Because OLED pixels are individually lit rather than backlit through a filter, contrast is excellent and there's no potentiometer to fiddle with like on character LCDs. The tradeoff is a bit more setup: you need both Adafruit's GFX library (the generic drawing engine) and the SSD1306-specific driver on top of it, and the API is graphics-oriented (draw calls + a buffer you flush to the screen) rather than the simple print() calls a character LCD uses.

Key specifications

  • Display: 128 × 64 pixels, monochrome OLED
  • Operating voltage: 3.3V – 5V (most breakout modules have an onboard regulator)
  • Interface: I2C (this module); SPI variants also exist on other boards
  • I2C address: 0x3C default on most modules, 0x3D on some — scan to confirm
  • Viewing technology: Self-emissive OLED — high contrast, no backlight, wide viewing angle
  • Driver + graphics library: Requires Adafruit GFX (drawing engine) plus the Adafruit SSD1306 driver on top of it

Pinout and connection notes

Pin order varies more between SSD1306 modules than most parts — some print GND/VCC/SCL/SDA left to right, others VCC/GND/SCL/SDA. Always check the silkscreen labels on your specific board rather than assuming pin position. Unlike the character-LCD backpacks, most SSD1306 breakouts genuinely work fine at 3.3V, making them an easier fit for ESP32/Pi/STM32 without the 5V-rail workarounds those LCDs need.

  • 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

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. 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 SSD1306 0.96" OLED with STM32 Blue Pill

Library

Adafruit SSD1306 by Adafruit

Boards Manager → add the STM32duino package URL → install "STM32 MCU based boards" → then Library Manager → search "Adafruit SSD1306" (accept the "Adafruit GFX Library" dependency prompt)

Library guide

Wiring

Component pinSTM32 Blue Pill pinNote
VCC3.3VMost SSD1306 modules run fine directly off 3.3V, which matches this board's logic level.
GNDGND
SDAPB7Default I2C1 data pin on most STM32duino core mappings.
SCLPB6Default I2C1 clock pin on most STM32duino core mappings.

Swipe sideways to see every column →

C++
  • Same 0x3C-vs-0x3D address and display.display()-flushes-the-buffer notes as the other boards.
  • I2C1 defaults to PB6/PB7 on most STM32duino core versions — double-check your specific board variant/core if the display doesn't initialize.
  • Usual Blue Pill Serial-over-USB caveat: a USB-TTL adapter or ST-Link virtual COM port is typically needed to see Serial output, which is why this sketch avoids relying on it and just halts silently if init fails.

Related Components

Related Guides & Projects