SSD1309 display driver with esphome

I have acquired a waveshure 128*64 2.42" oled display. The driver nominated is ssd1309. I am using an esp32 via esphome as the controller. Esphome doesn’t appear to support ssd1309, but there are comments by some that ssd1306 has been made to work. Unfortunately not for me.
GPIO configuration is: MOSI/DIN 23; CLK 18; CS 5; DC 25.
Appreciate any advice on alternative drivers that have been made to work, or any tweaks required, or any glaring error in pin designations.
Thanks Mike

2 Likes

Hi @Mike59427 - welcome to the forums :slight_smile:
Can you help us get oriented with your problem? There isn’t much to go off here for us to be very helpful.

  • What resources have you read that lead you to this conclusion?
  • Can you share the code / setup you’re working with?
  • And pictures of how everything is connected?
1 Like

Hi @Mike59427

Looking at the below blog post about a similar screen using the same driver as your Waveshare one, the author had success using the SSD1306 library which is supported by ESPHome to run their screen, you might have some luck giving that a shot

Using DYIMore 2.42″ 128×64 “SSD1309” OLED with ESPHome

2 Likes

Dan
Thanks for the link, I had found similar on esphome forum suggesting SSD1306, but thus far no luck and that link was for a different board. Note the link you highlighted refers to using I2C while I’m trying SPI. Have another board on order, possible I have a malfunctioning unit. Will try both spi and I2C when that arrives and update.
Mike

1 Like

Michael
Thanks for prompt follow up. Resources mostly google and esphome forums. On the off chance the unit I have is faulty, I have ordered a new one, arriving in couple of days. When gets here I will try again and try I2C as well as SPI and let you know the outcome.
Thanks Mike

1 Like

Dan
New unit works, suspect reverse polarity on other when breadboarding. Anyway has served to help me better understand spi and get to grips with the saleal logic analyzer I have had in the drawer for some time.
For benefit of anyone faced with same issue running the Waveshare 2.4" 128*64 oled display on esphome where recommended SSD1309 driver not supported. Following is the code I have used with an ESP32 controller and SSD1306 driver:

SPI config for display using VSPI and SSD1306 driver

spi:
mosi_pin: GPIO23 # Pin 37 to Oled DIN

miso_pin: GPIO19 # Pin.31

clk_pin: GPIO18 #Pin 30 to oled CLK
interface: hardware

display:

  • platform: ssd1306_spi
    model: SSD1306_128X64
    cs_pin: GPIO5 # Pin 29
    dc_pin: GPIO19 # Pin 9
    reset_pin: GPIO4 # Pin 10
    lambda: |-
    it.print(0, 0, id(roboto_12), TextAlign::TOP_LEFT, “Hello World!”);
    it.line(20, 20, 50, 50);

Regards
Mike

2 Likes

Michael
New unit works with SSD1306 driver, suspect reverse polarity when breadboarding the other.
For benefit of others following is esphome code with ESP32 controller:

spi:
  mosi_pin: GPIO23    # Pin 37 to Oled DIN
  clk_pin: GPIO18     # Pin 30 to oled CLK
  interface: hardware

display:
  - platform: ssd1306_spi
    model: SSD1306_128X64
    cs_pin: GPIO5   # Pin 29
    dc_pin: GPIO19  # Pin 9
    reset_pin: GPIO4 # Pin 10
    lambda: |-
      it.print(0, 0, id(roboto_12), TextAlign::TOP_LEFT, "Hello World!");
      it.line(20, 20, 50, 50);

Regards
Mike

2 Likes

Awesome to hear @Mike59427 :smiley:
Glad your project is back on track. FYI I edited your response with the working config to use a codeblock. You can find that syntax here: https://markdown-it.github.io/

1 Like

Apologies and thanks for reformatting. Have read the syntax and now appreciate the esphome comment slash is to be avoided when copying code.
Mike

2 Likes