I have the 1.12 SPi OLED Breakout
Plugged into Pico Breakout Garden Pack.
Wich I’m trying to get working in Micro Python. There is no Pimoroni support for this setup so I hunted around online and found this.
I have the sh1107.py downloaded and saved to the Pico.
And I’m attempting to modify this file to work with the Breakout garden setup.
from machine import Pin, SPI
import sh1107
import time
# 1. Setup SPI (adjust baudrate and pins for your board)
# Example for Raspberry Pi Pico
spi = SPI(0, baudrate=1000000, polarity=0, phase=0,
sck=Pin(2), mosi=Pin(3), miso=Pin(4))
# 2. Setup Control Pins
reset_pin = Pin(14, Pin.OUT)
dc_pin = Pin(13, Pin.OUT)
cs_pin = Pin(15, Pin.OUT)
# 3. Initialize Display Driver
display = sh1107.SH1107_SPI(128, 128, spi, dc=dc_pin, res=reset_pin, cs=cs_pin)
# 4. Draw to Display
display.fill(0) # Clear screen
display.text('Hello MicroPython!', 0, 0, 1)
display.show()
The dc_pin = Pin(13, Pin.OUT) and cs_pin = Pin(15, Pin.OUT) don’t make sense to me?
GP 2 is SCK SPIO 0
GP 3 is TX SPIO 0
GP 4 is RX SPIO 0
But GP 13 is SPI 1 CSn?
And GP 15 is SPI 1 TX?
So this is what I have so far.
from machine import Pin, SPI
import sh1107
import time
# 1. Setup SPI (adjust baudrate and pins for your board)
# Example for Raspberry Pi Pico
spi = SPI(0, baudrate=1000000, polarity=0, phase=0,
sck=Pin(18), mosi=Pin(19), miso=Pin(16))
# 2. Setup Control Pins
#reset_pin = Pin(14, Pin.OUT)
dc_pin = Pin(22, Pin.OUT)
cs_pin = Pin(17, Pin.OUT)
# 3. Initialize Display Driver
display = sh1107.SH1107_SPI(128, 128, spi, dc=dc_pin, cs=cs_pin)
# 4. Draw to Display
display.fill(0) # Clear screen
display.text('Hello MicroPython!', 0, 0, 1)
display.show()
All I get is a flash to all black, and then snow.
The SPI slot on the pack uses the following
GP 22 - Pin 29 - GPIO (DC)
GP 19 - Pin 25 - MOSI (TX)
GP 18 - Pin 24 - SCLK
GP 17 - Pin 22 - CS
GP 16 - Pin 21 - MISO (RX)

