OLED wiring and first text

Wire an SSD1306 OLED to the Pico over I2C, find its address, install the ssd1306.py driver and say hello

By Kevin McAleer,    4 Minutes

Page last updated November 24, 2026


Course Cover Image


The buddy can sense the door, but only you and a blinking LED know. Time to give it a face. In this lesson we wire up an OLED screen and make it say hello. This begins the Show section.

Kev’s OLED video, the one at the top of the course introduction, covers this in detail. It is worth a rewatch before you wire up.


What is an OLED?

OLED stands for Organic Light-Emitting Diode. Unlike an LCD, every pixel makes its own light, so there is no backlight. You get crisp contrast, wide viewing angles and very low power, because pixels that are off use nothing.

The common maker version has an SSD1306 driver chip, 128 by 64 pixels, and talks over I2C, which needs only two data wires.

We don’t re-teach I2C here. If you want the theory, Working with I2C and SPI covers it, including how addresses work.

Wiring

OLED pin Pico pin
VCC 3.3V (pin 36)
GND GND (pin 38)
SCL GP5 (pin 7)
SDA GP4 (pin 6)

Important: use the 3.3V pin, not 5V. Double-check VCC and GND before you power up, because reversed power can damage the display.

These are different pins from the original OLED post, which used GP0 and GP1. We keep GP0 free for SAM’s speaker, as the pin plan in lesson 2 explained.

Find the display’s address

Every I2C device has an address. Let’s check the Pico can see the screen. Save and run this:

from machine import Pin, I2C

# I2C bus 0 on GP4 (SDA) and GP5 (SCL)
i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400000)

devices = i2c.scan()

if devices:
    print("I2C devices found:")
    for device in devices:
        print("  Address: 0x{:02x}".format(device))
else:
    print("No I2C devices found. Check your wiring!")

You should see Address: 0x3c. That is the default for most SSD1306 screens. If yours says 0x3d, note it down and use it in place of 0x3c below.

Install the ssd1306.py driver

MicroPython doesn’t include an SSD1306 driver, so we copy one onto the Pico. Kev’s OLED post points to this file:

The MicroPython project also publishes an SSD1306 driver in its own repository, which the post lists in its useful links.

Get the file onto the Pico in either of these ways:

  • Thonny: download ssd1306.py, open it in Thonny, then choose File, Save as, Raspberry Pi Pico, and save it with the name ssd1306.py
  • mpremote: download the file, then from the same folder run mpremote cp ssd1306.py : which copies it to the Pico’s root

To check it worked, type import ssd1306 in the Thonny shell. No error means success.

Hello, OLED

from machine import Pin, I2C
from ssd1306 import SSD1306_I2C

i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400000)

# 128 x 64 pixels, default I2C address 0x3c
oled = SSD1306_I2C(128, 64, i2c)

oled.fill(0)                       # clear: 0 is off, 1 is on
oled.text("Hello World!", 0, 0)    # text at x=0, y=0
oled.text("Status buddy", 0, 20)
oled.text("is awake", 0, 40)
oled.show()                        # push the buffer to the screen

Three calls do the work:

  1. oled.fill(0) clears the buffer
  2. oled.text("...", x, y) draws text with its top-left corner at pixel (x, y)
  3. oled.show() sends the buffer to the screen

Remember: drawing only changes a buffer in memory. Nothing appears until you call oled.show().

The built-in font is 8 pixels wide and 8 tall, so a 128-pixel screen fits 16 characters per line and 8 lines.

Try it Yourself

  1. Put your own name on the screen.
  2. Make a three-line menu using y positions 0, 16 and 32.
  3. Challenge: centre a word. Its width is 8 pixels times the number of letters.

Common Issues

Problem: The scan finds nothing.

Solution: Check SDA and SCL aren’t swapped, and VCC and GND are right. Make sure your code says scl=Pin(5), sda=Pin(4).

Why: I2C needs both wires on the right pins, and a swapped pair simply looks like an empty bus.

Problem: ImportError: no module named 'ssd1306'.

Solution: The driver file isn’t on the Pico. Copy ssd1306.py to its root and try again.

Why: MicroPython can only import files on the Pico itself, not on your computer.

Problem: The screen stays blank even though the scan works.

Solution: Add oled.show() after drawing.

Why: Drawing only changes the buffer.

< Previous Next >

Was this lesson helpful?

Course complete

Congratulations, you finished MicroPython Projects - Make It Show, Talk and Connect!

That's all 17 lessons done. Let people know, it's a great way to inspire someone else to start.

Share card: I completed MicroPython Projects - Make It Show, Talk and Connect on KevsRobots
Post Bluesky LinkedIn Facebook


What are you looking for?
Watch Videos Get Ideas Learn Something Read a Review Read the Blog Search
... Z Z z