It's easy to use the Adafruit 128x64 OLED FeatherWing with CircuitPython and the Adafruit CircuitPython DisplayIO SH1107 module.  This module allows you to easily write CircuitPython code to control the display.

CircuitPython Wiring

Connecting up the FeatherWing to a Feather is super simple!

  • Solder the Feather with female headers on top or stacking headers.
  • Attach the OLED FeatherWing using the stacking method.

CircuitPython Installation of DisplayIO SH1107 Library

To use the 128x64 OLED FeatherWing with your Adafruit CircuitPython Feather board you'll need to install the Adafruit CircuitPython DisplayIO SH1107 module on your board.

you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle.  Our CircuitPython starter guide has a great page on how to install the library bundle.

Install the following libraries individually on your board:

  • adafruit_displayio_sh1107
  • adafruit_bus_device

To work through the code example below, you'll also need the following library:

  • adafruit_display_text

Before continuing make sure your board's lib folder or root filesystem has the adafruit_displayio_sh1107.mpy, adafruit_bus_device and adafruit_display_text files and folders copied over.

CircuitPython Usage

Save the following to your Feather as

Author: Mark Roberts (mdroberts1243) from Adafruit code
This test will initialize the display using displayio and draw a solid white
background, a smaller black rectangle, miscellaneous stuff and some white text.


import board
import displayio
import terminalio

# can try import bitmap_label below for alternative
from adafruit_display_text import label
import adafruit_displayio_sh1107

# oled_reset = board.D9

# Use for I2C
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)

# SH1107 is vertically oriented 64x128
WIDTH = 128

display = adafruit_displayio_sh1107.SH1107(display_bus, width=WIDTH, height=HEIGHT)

# Make the display context
splash = displayio.Group(max_size=10)

color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF  # White

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)

# Draw a smaller inner rectangle in black
inner_bitmap = displayio.Bitmap(WIDTH - BORDER * 2, HEIGHT - BORDER * 2, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000  # Black
inner_sprite = displayio.TileGrid(
    inner_bitmap, pixel_shader=inner_palette, x=BORDER, y=BORDER

# Draw some white squares
sm_bitmap = displayio.Bitmap(8, 8, 1)
sm_square = displayio.TileGrid(sm_bitmap, pixel_shader=color_palette, x=58, y=17)

med_bitmap = displayio.Bitmap(16, 16, 1)
med_square = displayio.TileGrid(med_bitmap, pixel_shader=color_palette, x=71, y=15)

lrg_bitmap = displayio.Bitmap(32, 32, 1)
lrg_square = displayio.TileGrid(lrg_bitmap, pixel_shader=color_palette, x=91, y=28)

# Draw some label text
text1 = "0123456789ABCDEF123456789AB"  # overly long to see where it clips
text_area = label.Label(terminalio.FONT, text=text1, color=0xFFFFFF, x=8, y=8)
text2 = "SH1107"
text_area2 = label.Label(
    terminalio.FONT, text=text2, scale=2, color=0xFFFFFF, x=9, y=44

while True:

That's all there is to using CircuitPython with your 128x64 OLED FeatherWing!

This guide was first published on Sep 04, 2020. It was last updated on Sep 04, 2020.

This page (CircuitPython) was last updated on Nov 04, 2020.