Waveshare 2.23inch OLED HAT - Usage/Quirks. [knowledge-sharing]

Howdy Beautiful People!

TL;DR
I’ve been here reading and using some of your work for a while now,
i thought it is time to return the favor.
Had one of these puppies for a time now and beside the example code on pi,
i always had struggles to get proper output from it.
(NodeRED, Python, etc…)
Waveshare 2.23inch-OLED-HAT
I used I2C connection mode, but the display settings need to be tuned so it should not make a difference.

In ESPHome you CAN get it to work, with a bit of fiddling:

i2c:
  sda: sdagpio              # Set  according to your wiring.
  scl: sclgpio              # Set  according to your wiring.
  scan: False               # If you encounter errors with the connection, to 'True' and check log output for address.
  frequency: 800khz         # Raised to 800khz to avoid component should block warnings with the display. (Component display took a long time for an operation (x ms).|Components should block for at most 30 ms.)


display:
  - platform: ssd1306_i2c
    model: "SSD1305 128x32" # The display is driven by SSD1305(check notes on contrast) <- https://www.waveshare.com/wiki/2.23inch_OLED_HAT#
    id: waveshare_oled128x32
    address: i2caddr        # Set i2c: 'scan: True' and check log output for address.
    contrast: 50%           # Tolerance: 0-50% otherwise artifacts appear. In my case brightness had no effect, regardless of SSD1305. <- https://esphome.io/components/display/ssd1306.html
    offset_x: 4             # 4 pixels to align with display.
    offset_y: 0             # No tuning was required in my case.
    lambda: |-
      it.print(0, 0, id(font), "Hello World!");

Cheers,

1 Like