SPI SSD1306

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
lbayo
Posts: 24
Joined: Tue Mar 16, 2021 2:10 pm

Re: SPI SSD1306

Post by lbayo » Tue Mar 16, 2021 2:17 pm

A few days ago, I bought a 1.3 "OLED. By mistake, I bought it with the SPI interface instead of the I2C interface. No problem! It tells me that the SPI interface is as easy as I2C.
Well, I plugged in an ESP32 development kit with 128 x 64 SPI OLED display (see photo) and, programming in micropython, tried to get it to work. I have done various tests, with SPI, SoftSPI, various pins, etc.

Nothing! It does not work. The screen appears as a mosaic of random pixels. I add a list of the program used.

from machine import Pin,SoftSPI
import ssd1306,framebuf
from time import sleep

vspi = SoftSPI(baudrate=1000000, polarity=0, phase=0, bits=8, firstbit=SoftSPI.MSB, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
oled=ssd1306.SSD1306_SPI( 128, 64, vspi, dc=Pin(17), res=Pin(5), cs=Pin(16))
oled.init_display()
sleep (5)
oled.text('Hello, World 1!', 0, 0)
oled.show()


Some functions work correctly: invert, turn off, turn on, but not the text () or show () function.

The actual pinout is

- PIN WIRING -
OLED ESP32
Vdc 3.3V
GND GND
SCK GPIO 18
SDA GPIO 23
RES GPIO 5
DC GPIO 17
CS GPIO 13

What happens?
What am I doing wrong?
Can anybody help me?
Image

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SPI SSD1306

Post by pythoncoder » Tue Mar 16, 2021 6:04 pm

Are you certain the display has an SSD1306 controller?
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: SPI SSD1306

Post by Roberthh » Tue Mar 16, 2021 9:12 pm

That's right. At 1.3 inch it may also be a SH1106 device.

lbayo
Posts: 24
Joined: Tue Mar 16, 2021 2:10 pm

Re: SPI SSD1306

Post by lbayo » Wed Mar 17, 2021 7:33 am

Thanks !!!
I tried with sh1106 and it woks perfectly !

Post Reply