Writing an SPI driver for SH1107 Oled display

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
aspleet
Posts: 4
Joined: Mon Oct 25, 2021 8:16 am

Writing an SPI driver for SH1107 Oled display

Post by aspleet » Mon Oct 25, 2021 8:30 am

Hello everyone,

I'm new here and to MicroPython. I'm finding many insightful comments here, this forum is great!

I decided to make a first build around a Raspberry Pi Pico, bought some components... and didn't realise that MicroPython drivers were missing for most of them! I've found workarounds for some, but currently my biggest roadblock is the Oled display, a monochrome Waveshare 128x64 display controlled by an SH1107 <edit>that I'd like to keep in SPI mode to avoid fiddling with soldering on the back to switch to I2C</edit>.

Waveshare offers a python driver for it on its wiki, but it relies on spidev (for the SPI version) and other non-MicroPython libraries, I suppose it's aimed at the ARM versions of RPis. I've found several drivers for MicroPython for the SH1106, including discussed on this forum. I've tried restarting from one (from @robert-hh), and adapting it as I could, but although some things have happened on screen, I've not been successful in getting it to work as intented.

Before I bore you with the details of my misfortunes, I should start with a simple question: does anyone know of an SH1107 MicroPython driver out there that I've missed? That would sure be helpful!

I'll throw in another of these questions, just in case: anyone know of a MicroPython driver for the Adafruit AW9523?

Thanks!
Last edited by aspleet on Mon Oct 25, 2021 1:35 pm, edited 1 time in total.

neveregret
Posts: 28
Joined: Sun Aug 08, 2021 5:48 pm

Re: Writing a driver for SH1107 Oled display

Post by neveregret » Mon Oct 25, 2021 9:38 am

aspleet wrote:
Mon Oct 25, 2021 8:30 am
Hello everyone,

I'm new here and to MicroPython. I'm finding many insightful comments here, this forum is great!

I decided to make a first build around a Raspberry Pi Pico, bought some components... and didn't realise that MicroPython drivers were missing for most of them! I've found workarounds for some, but currently my biggest roadblock is the Oled display, a monochrome Waveshare 128x64 display controlled by an SH1107.

Waveshare offers a python driver for it on its wiki, but it relies on spidev (for the SPI version) and other non-MicroPython libraries, I suppose it's aimed at the ARM versions of RPis. I've found several drivers for MicroPython for the SH1106, including discussed on this forum. I've tried restarting from one (from @robert-hh), and adapting it as I could, but although some things have happened on screen, I've not been successful in getting it to work as intented.

Before I bore you with the details of my misfortunes, I should start with a simple question: does anyone know of an SH1107 MicroPython driver out there that I've missed? That would sure be helpful!

I'll throw in another of these questions, just in case: anyone know of a MicroPython driver for the Adafruit AW9523?

Thanks!
Isn't this SH1107 driver ? https://github.com/nemart69/sh1107-micropython . Are you looking for SPI version ?

aspleet
Posts: 4
Joined: Mon Oct 25, 2021 8:16 am

Re: Writing a driver for SH1107 Oled display

Post by aspleet » Mon Oct 25, 2021 10:25 am

Ah yes, sorry about that, should have been more specific. I'd prefer to stick to SPI if possible, so as not to fiddle with the whole soldering thing that's necessary on my SH1107 to switch it to I2C. But, if all else fails, that'll be my backup plan. Thanks for the link!

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Writing an SPI driver for SH1107 Oled display

Post by mcauser » Wed Nov 17, 2021 5:44 am


aspleet
Posts: 4
Joined: Mon Oct 25, 2021 8:16 am

Re: Writing an SPI driver for SH1107 Oled display

Post by aspleet » Wed Mar 23, 2022 9:44 pm

Thanks for your help. Unfortunately, at this point I haven't been able to get it to work. In the mean time I tried what you suggested @mcauser but still had issues (screen stuck in portrait mode), then learned to solder a little and swapped the connector to I2C mode, but for some reason that's still not working. The OLED is embedded in a rather large project now, and I've got no pull-up resistors on my I2C lines so I would need to take the screen out and test everything in a decoupled way at some point. That's on my todo list.

As a side note, I asked in the original post if anyone had a micropython driver for Adafruit's AW9523 LED driver. I've now made a small one myself, for anyone interested: https://github.com/clapeyre/micropython-aw9523.

Post Reply