Chill-Division / M5Stack-ESPHome

Collection of information for getting M5Stack sensors / controllers working with ESPHome
Apache License 2.0
70 stars 9 forks source link

(Working Example) M5Stack OLED Unit 1.3" 128 × 64 Display (SH1107) #13

Open DavidGeorge528 opened 2 days ago

DavidGeorge528 commented 2 days ago

Here is a minimal example for running the M5 Stack OLED Unit 1.3" display

i2c: 
  sda: 2
  scl: 1

font:
  - file: "gfonts://Roboto@medium"
    id: my_font
    size: 18
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/³µ'

display:
  - platform: ssd1306_i2c
    model: "SH1107 128x64"
    address: 0x3C
    update_interval: "30s"
    rotation: 90
    offset_y: 96
    lambda: |-
      it.printf(0, 0, id(my_font), "Hello");
      it.printf(0, 20, id(my_font), "World!");

IMG_4064 2

This example assumes the device is plugged into the Grove port on an M5 stack Atom or similar, I2C pins will likely differ for others.

Some caveats:

ChillingSilence commented 1 day ago

Thanks @DavidGeorge528 ! I get that same warning message on my other screens too, it just takes too long for ESPHome to draw the screen from what I understand so that's not really too concerning.

Really appreciate you submitting this, I think it was the offset that may have been my issue because I was getting garbage on-screen too. I'll find my unit and give it a whirl on an Atom Lite and a PoESP32 later on. Thanks again 🙏