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


I recently started playing with ESPHome again, a very powerful firmware generator for ESP8266/ESP32 IOT modules. I’ve been creating a control panel for my Chinese laser-cutting machine to display coolant temperatures and control the speed of the fume extractor. It’s based on a RobotDyn IOT AC dimmer which has an integrated power supply and uses a Wemos D1 Mini-compatible module with an ESP8266.

At the moment, the module has the following additional peripherals attached:

  • 2 waterproof Dallas 18B20 1-wire temperature sensors
  • MCP23017 I/O expander
  • 3 TM1637 0.56″ 4-digit 7-segment LED displays

I had a DYIMore 2.42″ 128×64 pixel OLED display lying around from a previous project (DYI OpenTX transmitter), so I thought it might be nice to have a larger display as well.

And finally to the point of this post. The display supposedly uses the SSD1309 driver – it’s listed as such on the product page, and it’s silkscreened on the display itself. SSD1309 is not supported by ESPHome. However, after some googling I found out the display works just fine with the ESPHome SSD1306 driver. I’m running the display over I²C (it also supports SPI, but was configured for I²C by default), so it needs the following connections:

  • VCC (+5 V)
  • GND (ground, 0 V)
  • SDA (I²C data)
  • SCL (I²C clock)
  • RST (reset)

Here’s the complete relevant snippet from my ESPHome configuration:

i2c:
  - id: iic
    sda: D2
    scl: D3
    scan: true

font:
  - file: "~/.local/share/fonts/monaco.ttf"
    id: monaco10
    size: 10

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    reset_pin: D5
    address: 0x3C
    contrast: 50%   # Lower the brightness
    rotation: 180°  # I'm using the display upside down
    update_interval: 60s
    lambda: |-
      it.print(0, 0, id(monaco10), "Hello World!");

That’s it.

More about the laser control panel soon :)

, ,