ESPHOME OLED SSD1322 SPI Interface

So I got myself one of these…

Following this https://esphome.io/components/display/ssd1322.html

I am trying to figure out the correct connections for a nodemcu 32s and so far have come up with this configuration.

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23

display:
  - platform: ssd1322_spi
    model: "SSD1322 256x64"
    reset_pin: GPIO17
    cs_pin: GPIO5
    dc_pin: GPIO16
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");

font:
  - file: '39335_UniversCondensed.ttf'
    id: font1
    size: 8  

This does not work.

So I look more closely at the back of the SSD1322

I have resistors R6 and R8 fitted, does this mean it is configured for 80XX and not SPI?

If this is the case can try and move the position of R6 to R5 to make it SPI?

That’d be my first step, yes. Steady hands and tweezers!

Bit the bullet and success

1 Like

can you share your pins used on the oled itself?

Hi,

I have same screen and I’m trying to make a MediaPlayer dashboard :slight_smile:

Here is my code:

esphome:
  name: cxn
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "414ba6ff284ea38563287250f6f5940c"
  encryption:
    key: "x/hpkt5Dre2eCR5X0iPPqxhkksFLS+9/At8VuajiFl4="

ota:
  password: "414ba6ff284ea38563287250f6f5940c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cxn Fallback Hotspot"
    password: "Sy7tXPvPJsKt"

captive_portal:

time:
  - platform: homeassistant
    id: zaman
  - platform: sntp
    id: esptime

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 15s
    id: sstrength



text_sensor:
  - platform: homeassistant
    id: albumname
    entity_id: media_player.cambridge_cxn
    attribute: media_album_name
    internal: true
  - platform: homeassistant
    id: mediatitle
    entity_id: media_player.cambridge_cxn
    attribute: media_title
    internal: true
  - platform: homeassistant
    id: mediaartist
    entity_id: media_player.cambridge_cxn
    attribute: media_artist
    internal: true
  - platform: homeassistant
    id: mediatime
    entity_id: media_player.cambridge_cxn
    attribute: media_duration
    internal: true


font:
  - file: 'arial.ttf'
    id: font1
    size: 10

  - file: 'Ubuntu-M.ttf'
    id: font2
    size: 14

  - file: 'arial.ttf'
    id: font3
    size: 12

  - file: 'BebasNeue-Regular.ttf'
    id: font4
    size: 24

  - file: "Ubuntu-M.ttf"
    id: sseg
    size: 26
  - file: "Ubuntu-M.ttf"
    id: tiny
    size: 12
  - file: "Ubuntu-M.ttf"
    id: teeny
    size: 10




# Example configuration entry
spi:
  clk_pin: D5
  mosi_pin: D7

globals:
   - id: coords
     type: int
     restore_value: no
     initial_value: "1"
   - id: length
     type: int
     restore_value: no
     initial_value: "1"
interval:
  - interval: 250ms
    then:
        lambda: |-
            if (id(coords) < -(id(length))) {
             id(coords) = 0;
                }
            else  {
               id(coords) -= 1;
            }

display:
  - platform: ssd1322_spi
    model: "SSD1322 256x64"
    reset_pin: D1
    cs_pin: D8
    dc_pin: D6
    lambda: |-
      if (id(albumname).has_state()) {
        std::string printout = id(mediatitle).state;
        int clength = printout.length();
        id(length)=clength*5;
        it.print(id(coords), 0, id(font2), printout.c_str());
        it.printf(0, 20, id(font2), "%s", id(albumname).state.c_str());
        it.printf(0, 40, id(font2), "%s", id(mediaartist).state.c_str());        
        int x=(int)id(sstrength).state; 
        {
        if (x<0)
          if ((x>-90) && (x<0)) it.filled_rectangle( 220,14,5,4); else  it.rectangle( 220,14,5,4);          
          if ((x>-70) && (x<0)) it.filled_rectangle( 226,11,5,7); else  it.rectangle( 226,11,5,7);   
          if ((x>-50) && (x<0)) it.filled_rectangle( 232, 8,5,10); else it.rectangle( 232, 8,5,10);
          if ((x>-30) && (x<0)) it.filled_rectangle( 238,5,5,13); else it.rectangle( 238,5,5,13); 
        }
        }

I was able to make this by combining some codes I found on the internet and playing on it.

My second goal is putting progress bar bottom of the screen. But I don’t know anything about how can I do :slight_smile:

Dou you have any suggestion?

Thank you.

Looks like you have media duration already — you just need to get the current position from HA (if it is even available as a state) into the ESP device and work out the percentage elapsed. Then use the rectangle code to draw the appropriate bars.

If the current position is not available in HA, you’re out of luck.