Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Lilygo T5-4.7 inch ESP32-S3 (aka "plus"/V2.3) e-paper module #1960

Open
nickolay opened this issue Nov 15, 2022 · 86 comments
Open

Comments

@nickolay
Copy link

There's #1109 open for the original T5-4.7 module. This year the vendor introduced a new version of the module, which they call "T5 4.7 Inch E-paper V2.3" or "T5-4.7 Plus".

The vendor advertises the new ESP32-S3 chip and TF-card reader as the major new features, but there are multiple other differences as well. The pinout is incompatible, so any attempts to blindly run examples from #1109 on the new board without first figuring out the differences will fail.

I'll copy the description from the original feature request verbatim, as only the internals of the board are different; the use-case is the same:

Describe the problem you have/What new integration you would like
The Lyligo T5-4.7inch is a great e-paper module based on an ESP32. It has a resolution of 960*540, 16 gray level and support partial refresh. I would be great to have it integrated in ESPHome the same / similar way Waveshare e-paper screens and modules are.

Please describe your use case for this integration and alternatives you've tried:
To date there is no support for this module in ESPHome. The only support given by the maker is through Arduino IDE

Additional context
This is the maker's GitHub for this product: https://github.com/Xinyuan-LilyGO/LilyGo-EPD47

@nickolay
Copy link
Author

nickolay commented Nov 15, 2022

So far I managed to get esphome run to flash the chip, based on vendor's demo:

esphome:
  name: lilygo
  platformio_options:
    upload_speed: 921600
    monitor_speed: 115200
    board_build.mcu: esp32s3
    board_build.f_cpu: 240000000L
    #uncommenting the following causes: .platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/newlib/platform_include/assert.h:20:10: fatal error: sdkconfig.h: No such file or directory
    # board_build.arduino.memory_type: qspi_opi
    board_build.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.flash_type: qspi
    board_build.psram_type: opi
    board_build.memory_type: qspi_opi
    board_build.boot_freq: 80m

esp32:
  variant: esp32s3
  board: esp32-s3-devkitc-1

  framework:
    type: arduino
    version: 2.0.3
    platform_version: 5.1.1

With the above, basic ESP32 functionality like OTA updates work normally.
It's easy to detect physical button presses:

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

Hopefully someone will have time to adapt the screen library.

Update: there are three implementations for the original board discussed in #1109:

There's some work happening over at vroland/epdiy#203 for supporting ESP32-S3 in general and the new T5-4.7 in particular, but it's currently a bit too experimental for my taste, so I'm toying with approach similar to the one taken by tiaanv...

@nickolay
Copy link
Author

nickolay commented Dec 3, 2022

I'm toying with approach similar to the one taken by tiaanv...

OK, the screen appears to work for me: https://github.com/nickolay/esphome-lilygo-t547plus

@besanur
Copy link

besanur commented Feb 10, 2023

How did you flash, i was not able to flash it via esphome web. Only worked with esptool. I have a basic configuration to display the time, but it shows a wrong time, hour is alwas at 01:XX.
And if a look at esphome web ui in home-assistant the devices is not connected, but after i connect it to my computer and read logs via them after that it is connected the wifi.

My config:

esphome:
  name: lilygo
  platformio_options:
    # Unless noted otherwise, based on https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/1eb6119fc31fcff7a6bafecb09f4225313859fc5/examples/demo/platformio.ini#L37
    upload_speed: 921600
    monitor_speed: 115200
    board_build.mcu: esp32s3
    board_build.f_cpu: 240000000L
    board_build.arduino.memory_type: qspi_opi
    board_build.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.flash_type: qspi
    board_build.psram_type: opi
    board_build.memory_type: qspi_opi
    board_build.boot_freq: 80m
    build_flags: # the first three defines are required for the screen library to function.
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_RUNNING_CORE=0" # TODO: this conflicts with the value from platformio's idedata, spewing a lot of warnings during the build.
      - "-DARDUINO_EVENT_RUNNING_CORE=0" # and this too
      # In addition to lilygo's settings:
      # To enable reading logs over USB until `hardware_uart: USB_CDC` support
      # is added to `logger:`, as detailed in <https://github.com/esphome/feature-requests/issues/1906>:
      - "-DARDUINO_USB_MODE=1"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"

esp32:
  variant: esp32s3
  board: esp32-s3-devkitc-1

  framework:
    type: arduino
    # Just like in <https://community.home-assistant.io/t/enable-usb-cdc-to-log-hello-world-to-esp32-s3-dev-board-for-esphome/463164/10>
    # I had problems with newer versions; the following combination happens to work, so using it for now.
    version: 2.0.3
    platform_version: 5.1.1

logger:
  level: VERBOSE
  # hardware_uart: USB_CDC  # see note about <https://github.com/esphome/feature-requests/issues/1906> above

# Enable Home Assistant API
api:
  encryption:
    key: "rZjS7VS1G5PPFc7JLfwWYGMZ8LVg81Mokz9UUoCel00="

ota:
  password: "6903efa08992bfb72e6e2545357799ae"
  
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
    # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lilygo-T5 Fallback Hotspot"
    password: "xHMGPUOTHBjX"

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

external_components:
  source:
    type: local
    path: esphome-lilygo-t547plus/components/
  components: ["t547"]

time:
  - platform: homeassistant
    id: esptime

font: 
  - file: "fonts/Roboto-Regular.ttf"
    id: font_clock
    size: 78
    glyphs: [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

display:
  - platform: t547
    # rotation: 180
    update_interval: 30s
    lambda: |-
      it.strftime(it.get_width()/2, it.get_height()/2, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(esptime).now());

@lehovec
Copy link

lehovec commented Feb 10, 2023

You can add platformio board configuration from LilyGo-EPD47 GitHub repository to esphome. I added lilygo-t5-74-plus.json file to /config/esphome/.esphome/build/[your-esphome-device]/boards and I am am able to flash without problems.

esphome:
  name: liligo-t5-47-epaper-plus
  platformio_options:
    board_dir: boards
    #include https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/platformio/boards/lilygo-t5-47-plus.json as custom board
    board: lilygo-t5-47-plus

esp32:
  variant: esp32s3
  board: lilygo-t5-47-plus

  framework:
    type: arduino
    # You don't need to specify version and platform_version

i2c:
  sda: GPIO17
  scl: GPIO18
  # There is some problems with i2c scan so turn scan off if problem appear on your board
  scan: false
  id: bus_a

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]

display:
- platform: t547
  id: t5_display
  update_interval: 30s

@nickolay
Copy link
Author

i was not able to flash it via esphome web. Only worked with esptool

I'm not sure how you can provide the necessary platformio_options via esphome web, so I'm flashing using the CLI (esphome run basic.yaml), as noted in the readme.

I'm always flashing over USB to be able to see the logs from the first startup, which are very useful to troubleshoot the occasional problems, like the device booting into safe mode (i.e. ignoring most of the config). I've also added the device to Home assistant manually.

You can add platformio board configuration from LilyGo-EPD47 GitHub repository to esphome

Cool tip, thanks!

@besanur
Copy link

besanur commented Feb 10, 2023

You can add platformio board configuration from LilyGo-EPD47 GitHub repository to esphome. I added lilygo-t5-74-plus.json file to /config/esphome/.esphome/build/[your-esphome-device]/boards and I am am able to flash without problems.

esphome:
  name: liligo-t5-47-epaper-plus
  platformio_options:
    board_dir: boards
    #include https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/platformio/boards/lilygo-t5-47-plus.json as custom board
    board: lilygo-t5-47-plus

esp32:
  variant: esp32s3
  board: lilygo-t5-47-plus

  framework:
    type: arduino
    # You don't need to specify version and platform_version

i2c:
  sda: GPIO17
  scl: GPIO18
  # There is some problems with i2c scan so turn scan off if problem appear on your board
  scan: false
  id: bus_a

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]

display:
- platform: t547
  id: t5_display
  update_interval: 30s

with this solution it works much better and without problems.. thank you

@pfruh
Copy link

pfruh commented Apr 6, 2023

Has anyone figured out how to read the battery voltage? According to https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/schematic/T5-4.7-Plus.pdf the pin should be GPIO14, but there I'm getting ESP32S3 doesn't support ADC on this pin.

@nickolay
Copy link
Author

nickolay commented Apr 6, 2023

@kaeltis see Xinyuan-LilyGO/LilyGo-EPD47#87 for a C example, which seems to work okay. Didn’t try to use it from esphome yet.

@pfruh
Copy link

pfruh commented Apr 6, 2023

Thanks, I've forked an existing module that solved this for the old board revision and it seems to work.
I have pretty much no idea what I'm doing so this definitely needs improvements: https://github.com/kaeltis/esphome-lilygo-t547plus

@startQ341
Copy link

startQ341 commented May 9, 2023

You can add platformio board configuration from LilyGo-EPD47 GitHub repository to esphome. I added lilygo-t5-74-plus.json file to /config/esphome/.esphome/build/[your-esphome-device]/boards and I am am able to flash without problems.

esphome:
  name: liligo-t5-47-epaper-plus
  platformio_options:
    board_dir: boards
    #include https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/platformio/boards/lilygo-t5-47-plus.json as custom board
    board: lilygo-t5-47-plus

esp32:
  variant: esp32s3
  board: lilygo-t5-47-plus

  framework:
    type: arduino
    # You don't need to specify version and platform_version

i2c:
  sda: GPIO17
  scl: GPIO18
  # There is some problems with i2c scan so turn scan off if problem appear on your board
  scan: false
  id: bus_a

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]

display:
- platform: t547
  id: t5_display
  update_interval: 30s

a try your code but have a error code a try change jason file but same problem thanks for help

Processing obrazovka (board: lilygo-t5-47-plus; framework: arduino; platform: platformio/espressif32 @ 5.3.0)

Error: Could not load broken JSON: /config/esphome/.esphome/build/obrazovka/boards/lilygo-t5-47-plus.json

@lehovec
Copy link

lehovec commented May 9, 2023

@startQ341 error indicate that lilygo-t5-47-plus.json file is somehow corrupted. Try to download it from source repository again or check in some online json validator what is problem with that file.

@startQ341
Copy link

@lehovec
thank you for your help browser corrupted data while downloading

@zagnuts
Copy link

zagnuts commented Jul 4, 2023

Thanks guys for this - it's working perfectly for me now, both screen and battery estimate. Only minor hassle is the lack of partial refresh support but hopefully that will become available eventually. Oh, and it would be nice to be able to disable that blinding blue light with something civilised like

status_led:
  pin:
    number: GPIO05
    inverted: True

rather than having to contemplate crushing it with pliers! (FWIW it can be done via epd_poweroff_all() apparently)

@petrhod
Copy link

petrhod commented Jul 16, 2023

Please help me compile for Lilygo 4.7 pro.
I am able to program with the arduino ino and Lily works. I am not able to display anything in esphome. I always get an error message:
Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 INFO Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3' requirements for your system 'linux_x86_64'
My code is based on the above:

esphome:
  name: lilygo
  platformio_options:
    # Unless noted otherwise, based on https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/1eb6119fc31fcff7a6bafecb09f4225313859fc5/examples/demo/platformio.ini#L37
    upload_speed: 921600
    monitor_speed: 115200
    board_build.mcu: esp32s3
    board_build.f_cpu: 240000000L
    board_build.arduino.memory_type: qspi_opi
    board_build.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.flash_type: qspi
    board_build.psram_type: opi
    board_build.memory_type: qspi_opi
    board_build.boot_freq: 80m
    build_flags:  # the first three defines are required for the screen library to function.
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_RUNNING_CORE=0"  # TODO: this conflicts with the value from platformio's idedata, spewing a lot of warnings during the build.
      - "-DARDUINO_EVENT_RUNNING_CORE=0"  # and this too
      # In addition to lilygo's settings:
      # To enable reading logs over USB until `hardware_uart: USB_CDC` support
      # is added to `logger:`, as detailed in <https://github.com/esphome/feature-requests/issues/1906>:
      - "-DARDUINO_USB_MODE=1"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"
 esp32:

  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: 2.1.1
    platform_version: 5.1.1

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "maXDU+zyImnTxgTD60TgWY0WUMoNS/ToE97w8WBGVPk="

ota:
  password: "92d1d4c3224f0fc6e118bffe0d4b8834"

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

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

captive_portal:

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

external_components:
  source:
    type: local
    path: components/
  components: ["t547"]

font: 
  - file: "Google_Sans_Bold.ttf"
    id: font_clock
    size: 78
    glyphs: [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: t547
    # rotation: 180
    update_interval: 30s
    lambda: |-
      it.strftime(it.get_width()/2, it.get_height()/2, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(esptime).now());** 

@special-k-uk
Copy link

special-k-uk commented Jul 25, 2023

I managed to get it compiled and flashed with the below. I saved the JSON locally into /.esphome/build/test

esphome:
  name: test
  friendly_name: test
  platformio_options:
    board_dir: boards
    #include https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/platformio/boards/lilygo-t5-47-plus.json as custom board
    board: lilygo-t5-47-plus

esp32:
  variant: esp32s3
  board: lilygo-t5-47-plus

  framework:
    type: arduino
    # version: 2.0.8
    # You don't need to specify version and platform_version

# Enable logging
logger:
  level: VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: "secret"

ota:
  password: "secret"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
    
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: "GGH2cv2rqbUL"

captive_portal:

i2c:
  sda: GPIO18
  scl: GPIO17
  # There is some problems with i2c scan so turn scan off if problem appear on your board
  scan: true
  id: bus_a

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]

touchscreen:
  - platform: lilygo_t5_47
    id: lilygo_touchscreen
    interrupt_pin: GPIO09
    address: 0x5A
    setup_priority: -100
    on_touch:
      then:
        - display.page.show_next: 't5_display'
        - component.update: 't5_display'

@special-k-uk
Copy link

Has anyone managed to get the Touchscreen component working with this board?

I've been using this touch panel on the older v3 boards and I'd like to continue using it on the newer S3 based boards.

Unfortunately the interrupt_pin has changed from GPIO13 on the older v3 to GPIO9 on the newer S3 board, and it looks like the Touchscreen Component is fixed at GPIO13, although it requires you to specify the pin in yaml.

I've logged an bug report here, just wondering if anyone has found a way to use touch?

@htitze
Copy link

htitze commented Aug 16, 2023

Please help me compile for Lilygo 4.7 pro. I am able to program with the arduino ino and Lily works. I am not able to display anything in esphome. I always get an error message: Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 INFO Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3' requirements for your system 'linux_x86_64' My code is based on the above:

esphome:
  name: lilygo
  platformio_options:
    # Unless noted otherwise, based on https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/1eb6119fc31fcff7a6bafecb09f4225313859fc5/examples/demo/platformio.ini#L37
    upload_speed: 921600
    monitor_speed: 115200
    board_build.mcu: esp32s3
    board_build.f_cpu: 240000000L
    board_build.arduino.memory_type: qspi_opi
    board_build.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.flash_type: qspi
    board_build.psram_type: opi
    board_build.memory_type: qspi_opi
    board_build.boot_freq: 80m
    build_flags:  # the first three defines are required for the screen library to function.
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_RUNNING_CORE=0"  # TODO: this conflicts with the value from platformio's idedata, spewing a lot of warnings during the build.
      - "-DARDUINO_EVENT_RUNNING_CORE=0"  # and this too
      # In addition to lilygo's settings:
      # To enable reading logs over USB until `hardware_uart: USB_CDC` support
      # is added to `logger:`, as detailed in <https://github.com/esphome/feature-requests/issues/1906>:
      - "-DARDUINO_USB_MODE=1"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"
 esp32:

  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: 2.1.1
    platform_version: 5.1.1

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "maXDU+zyImnTxgTD60TgWY0WUMoNS/ToE97w8WBGVPk="

ota:
  password: "92d1d4c3224f0fc6e118bffe0d4b8834"

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

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

captive_portal:

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

external_components:
  source:
    type: local
    path: components/
  components: ["t547"]

font: 
  - file: "Google_Sans_Bold.ttf"
    id: font_clock
    size: 78
    glyphs: [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: t547
    # rotation: 180
    update_interval: 30s
    lambda: |-
      it.strftime(it.get_width()/2, it.get_height()/2, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(esptime).now());** 

Same problem for me...

@Fabian-Schmidt
Copy link

Hi,

I got the display working with the following config:
Still having issues with logging and display is not perfect.

esphome:
  name: esp-t5-s3
  friendly_name: "T5 S3"
  platformio_options:
    board_build.f_flash: 80000000L
    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
  on_boot:
    then:
      # read time from external source (connected via I2C)
      - pcf85063.read_time

external_components:  - source: github://Fabian-Schmidt/esphome-lilygo_t5_47_display
    components: ["lilygo_t5_47_s3_display"]
    refresh: 0s
  - source: github://Fabian-Schmidt/esphome@jesserockz-2023-136-Fabian-Schmidt
    components: [ logger ]

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: latest

logger:
  hardware_uart: USB_CDC # USB_CDC # USB_SERIAL_JTAG

i2c:
  sda: 18
  scl: 17
  frequency: 10kHz
  scan: false
  id: i2c_bus_a

time:
  - platform: pcf85063
    id: esptime
    update_interval: never

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21
      inverted: true
    name: "Button 1"
    on_press:
    - lambda:
        // Code here

sensor:
  - platform: internal_temperature
    id: esptemp
    name: "Internal Temperature"
    update_interval: 1s

font:
  - file: Google_Sans_Bold.ttf
    id: font_name
    size: 38

display:
- platform: lilygo_t5_47_s3_display
  update_interval: 10s
  # rotation: 180
  # clear: false
  full_update_every: 6
  # power_off_delay_enabled: false
  lambda: 
    it.printf(100, 100, id(font_name), TextAlign::BASELINE_CENTER, "Hello World");

@petrhod
Copy link

petrhod commented Aug 19, 2023

Hi, for my i ok this ....


esphome:
  name: esp-t5-s3
  friendly_name: "T5 S3"
  platformio_options:
    board_build.f_flash: 80000000L
    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
  on_boot:
    then:
      # read time from external source (connected via I2C)
      # - pcf85063.read_time

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: latest

# Enable Home Assistant API
api:
  encryption:
    key: "2DvwSZRhQbXP3y1jVlTR5wg9FBPCrbMVVmKikLNFcXw="

ota:
  password: "0b4f13991d00618a668dbc3d78fa09ac"

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

#i2c:
#  sda: 18
#  scl: 17
#  frequency: 10kHz
#  scan: false
#  id: i2c_bus_a

#deep_sleep:
#  run_duration: 30s
#  sleep_duration: 1min

time:
  - platform: homeassistant
    id: homeassistant_time

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21
      inverted: true
    name: "Button 1"
    on_press:
    - lambda:
        // Code here

#sensor:
#  - platform: internal_temperature
#    id: esptemp
#    name: "Internal Temperature"
#    update_interval: 1s

font:
  - file: Google_Sans_Bold.ttf
    id: font_1
    size: 45
  - file: Google_Sans_Bold.ttf
    id: font_2
    size: 150

display:
- platform: t547
  update_interval: 60s
  # rotation: 180
  #clear: true
  #full_update_every: 3
  #power_off_delay_enabled: true
  lambda: 
    it.printf(10, 100, id(font_1), " Hello World");
 
  
    ```

@VladimirV01
Copy link

VladimirV01 commented Nov 11, 2023

Hello Guys, I wanted to say thanks to everybody who provided help in this thread.
It was very helpful and helped me get my Lilygo T5 Plus going.

However, no matter how hard I tried, I could not manage to establish the connection with the RTC.
Has anyone succeeded with this task?

@special-k-uk
Copy link

special-k-uk commented Nov 14, 2023

Hello Guys, I wanted to say thanks to everybody who provided help in this thread. It was very helpful and helped me get my Lilygo T5 Plus going.

However, no matter how hard I tried, I could not manage to establish the connection with the RTC. Has anyone succeeded with this task?

Hey @VladimirV01
The PCF8563 is a core component now , although I think the hardware itself might be a bit flakey as it works 90% of the time for me. The other 10% of the time it will throw an error on boot that it's unable to connect.

Here's what I have

esphome:
  name: barn-blind-controller
  friendly_name: barn-blind-controller
  platformio_options:
    board_build.f_flash: 80000000L
    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi 
  on_boot:
    priority: -100
    then:
      - pcf8563.read_time

then

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False
    frequency: 100khz

time:
  - platform: pcf8563
    id: internal_clock
    address: 0x51  
    i2c_id: bus_a
  - platform: homeassistant
    id: external_clock
    on_time_sync:
      then:
        - pcf8563.write_time

I hope that helps?

@VladimirV01
Copy link

Hello Guys, I wanted to say thanks to everybody who provided help in this thread. It was very helpful and helped me get my Lilygo T5 Plus going.
However, no matter how hard I tried, I could not manage to establish the connection with the RTC. Has anyone succeeded with this task?

Hey @VladimirV01 The PCF8563 is a core component now , although I think the hardware itself might be a bit flakey as it works 90% of the time for me. The other 10% of the time it will throw an error on boot that it's unable to connect.

Here's what I have

esphome:
  name: barn-blind-controller
  friendly_name: barn-blind-controller
  platformio_options:
    board_build.f_flash: 80000000L
    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi 
  on_boot:
    priority: -100
    then:
      - pcf8563.read_time

then

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False
    frequency: 100khz

time:
  - platform: pcf8563
    id: internal_clock
    address: 0x51  
    i2c_id: bus_a
  - platform: homeassistant
    id: external_clock
    on_time_sync:
      then:
        - pcf8563.write_time

I hope that helps?

Hello @special-k-uk !

Thank you very much for taking the time to check this issue and write an answer.

I have followed your advice and checked your configuration.
After changing the frequency to 100KHz and setting the address manually to 0x51 as advised by you, I don't see the initialization error on boot of the integrated RTC anymore!

Now I see that it syncs the RTC on time sync with homeassistant, therefore I can be sure it works.

@ex-nerd
Copy link

ex-nerd commented Nov 18, 2023

I managed to piece together a working config for my new board that includes a bunch of the changes, including the display code from @nickolay and battery stuff from @kaeltis (you two should consider merging your work for nickolay/esphome-lilygo-t547plus#3). I also activated the internal temp sensor, and set things to read/write with the internal clock. So far, everything is working great for me with an old LiPo battery I had sitting around (battery sensor is reading 4.5V, which lines up with what it did with the LilyGo firmware).

Anyway, here it is for posterity (along with some notes since I just copy/pasted my yaml file here)

# See: https://github.com/esphome/feature-requests/issues/1960
# See for older hardware: https://github.com/esphome/feature-requests/issues/1109

esphome:
  name: lilygo-t5-eink
  friendly_name: LilyGo T5 eInk
  platformio_options:
    board_build.f_flash: 80000000L
    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
  on_boot:
    priority: -100
    then:
      - pcf8563.read_time

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: latest

# Enable logging
logger:

# Enable Home Assistant API (API password is deprecated in favor of encryption key)
# https://esphome.io/components/api.html
api:
  encryption:
    key: !secret home_assistant_encryption_key

ota:
  password: !secret ota_password

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  reboot_timeout: 15min

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lilygo-T5-Eink Fallback Hotspot"
    password: !secret fallback_ssid_password

captive_portal:

external_components:
  # https://github.com/nickolay/esphome-lilygo-t547plus
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]
  # https://github.com/kaeltis/esphome-lilygo-t547plus
  - source: github://kaeltis/esphome-lilygo-t547plus
    components: ["lilygo_t5_47_battery"]

#deep_sleep:
#  run_duration: 30s
#  sleep_duration: 1min

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    frequency: 100khz
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False

time:
  - platform: pcf8563
    id: internal_clock
    address: 0x51  
    i2c_id: bus_a
  - platform: homeassistant
    id: ha_time
    on_time_sync:
      then:
        - pcf8563.write_time

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

sensor:
  - platform: internal_temperature
    id: esptemp
    name: "Internal Temperature"
    update_interval: 1s

  - platform: lilygo_t5_47_battery
    id: battery_voltage
    voltage:
      name: "Battery Voltage"

  - platform: template
    name: "Battery Percentage"
    id: battery_percentage
    lambda: |-
      // tweak values in mapping for calibration
      // 4.1 = max voltage
      // 3.3 = min voltage
      float y = (id(battery_voltage).voltage->state - 3.3) * 100.0 / (4.1 - 3.3);
      if (y < 100.0) { return y; } else { return 100.0; };

font:
  # https://github.com/hprobotic/Google-Sans-Font/blob/master/
  - file: fonts/GoogleSans-Bold.ttf
    id: font_1
    size: 45
  - file: fonts/GoogleSans-Bold.ttf
    id: font_2
    size: 150
  - file: "fonts/GoogleSans-Bold.ttf"
    id: font_clock
    size: 300
    glyphs: [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

display:
- platform: t547
  update_interval: 60s
  # rotation: 180
  #clear: true
  #full_update_every: 3
  #power_off_delay_enabled: true
  lambda: |-
    it.printf(10, 50, id(font_1), "Battery: %.1f% (%.1fV)", id(battery_percentage).state, id(battery_voltage).voltage->state);
    // https://esphome.io/cookbook/display_time_temp_oled.html 
    it.printf(10, 100, id(font_1), "Internal Temp: %.1f°C", id(esptemp).state);

    it.strftime(it.get_width()/2, it.get_height()/2-150, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(ha_time).now());

@ThierryDi
Copy link

Hello,
Thanks a lot to all this threads' participants for their work which helped me piece together my own config. (I won't post my code as it doesn't bring anything new to the table ;-))
I was wondering if any of you managed to print in grayscale ?
Cheers

@PabloFFF93
Copy link

Has anyone had such a problem

`INFO ESPHome 2023.11.6
INFO Reading configuration /config/esphome/test.yaml...
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
Failed config

esp32: None

Please specify flash_size within esp32 configuration only.
board: esp32-s3-devkitc-1
framework:
version: 2.0.9
source: ~3.20009.0
platform_version: platformio/espressif32@5.4.0
type: arduino
flash_size: 4MB
variant: ESP32S3`

@nickolay
Copy link
Author

Hi, is there a way to refresh partially ? Or to have a less "aggressive" refresh, when it's blinking 3 times ?

Xref: nickolay/esphome-lilygo-t547plus#12 (comment)

@xxLeoxx93
Copy link

xxLeoxx93 commented Oct 16, 2024

Does anyone know where to put the board file in the latest Homeassistant/ESPHome version? The filestruckture seems to be totaly different now. No matter where I place the board json it's not found and the "config" folder is completely missing now :(

@SpuriousGer
Copy link

Has this been added to ESPHome yet? Or which route do you need to go?

@mdot9
Copy link

mdot9 commented Nov 27, 2024

After hours of trying to compile something so that I can display anything apart from the default Lilgo start screen, I managed to compile with this code; however it still doesn't update the screen! Am I making any silly mistakes?

esphome:
  name: epaper
  friendly_name: epaper
  platformio_options:
    board_build.f_flash: 80000000L
    #board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
  on_boot:
    priority: -100
    then:
      - pcf8563.read_time
  libraries:
  - SPI

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: latest

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "R0M45+5FhYvM6e6G7WgSIpWPqDnhmD3K5I7bhlAPnLY="

ota:
  - platform: esphome
    password: "c77ee5d5d1681d721f021a05e017bd82"

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

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

captive_portal:

external_components:
  # https://github.com/nickolay/esphome-lilygo-t547plus
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]
  # https://github.com/kaeltis/esphome-lilygo-t547plus
  - source: github://kaeltis/esphome-lilygo-t547plus
    components: ["lilygo_t5_47_battery"]

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    frequency: 100khz
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False

time:
  - platform: pcf8563
    id: internal_clock
    address: 0x51  
    i2c_id: bus_a
  - platform: homeassistant
    id: ha_time
    on_time_sync:
      then:
        - pcf8563.write_time

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

sensor:
  - platform: internal_temperature
    id: esptemp
    name: "Internal Temperature"
    update_interval: 1s

  - platform: lilygo_t5_47_battery
    id: battery_voltage
    voltage:
      name: "Battery Voltage"

  - platform: template
    name: "Battery Percentage"
    id: battery_percentage
    lambda: |-
      // tweak values in mapping for calibration
      // 4.1 = max voltage
      // 3.3 = min voltage
      float y = (id(battery_voltage).voltage->state - 3.3) * 100.0 / (4.1 - 3.3);
      if (y < 100.0) { return y; } else { return 100.0; };


font:
  # https://github.com/hprobotic/Google-Sans-Font/blob/master/
  - file: fonts/GoogleSans-Bold.ttf
    id: font_1
    size: 45
  - file: fonts/GoogleSans-Bold.ttf
    id: font_2
    size: 150
  - file: "fonts/GoogleSans-Bold.ttf"
    id: font_clock
    size: 300
    glyphs: [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

display:
- platform: t547
  update_interval: 60s
  # rotation: 180
  #clear: true
  #full_update_every: 3
  #power_off_delay_enabled: true
  lambda: |-
    it.printf(10, 50, id(font_1), "Battery: %.1f% (%.1fV)", id(battery_percentage).state, id(battery_voltage).voltage->state);
    // https://esphome.io/cookbook/display_time_temp_oled.html 
    it.printf(10, 100, id(font_1), "Internal Temp: %.1f°C", id(esptemp).state);

    it.strftime(it.get_width()/2, it.get_height()/2-150, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(ha_time).now());

@mdot9
Copy link

mdot9 commented Nov 28, 2024

If this is of any help, this is the start of my code:

substitutions:
  esp_name: lilygo01 #Device Name
  esp_hostname: lilygo01 
  run_time: 60s #can be as long as needed to get data 
  sleep_time: 30min # normal sleep time
  night_sleep_time: 10h # 1st sleep time after midnight

esphome:
  name: ${esp_hostname}
  friendly_name: ${esp_hostname}
  platformio_options:
    board_build.f_flash: 80000000L
#    board_upload.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
  on_boot:
    priority: -100
    then:
      - pcf8563.read_time

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: latest

# Enable logging
# Change to avoid "Components should block for at most 20-30ms" warning messages in the log - an issue since 2023.7.0
# Not really a breaking change - it's an issue I suspect due to the device being slow and this error previously
# simply not being reported
logger:
  level: DEBUG
  logs:
    component: ERROR

api:
  encryption:
    key: !secret esphome_encryption_key

ota:
  password: !secret ota_password
  platform: esphome
  
wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  reboot_timeout: 15min

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lilygo-T5-Eink Fallback Hotspot"
    password: !secret wifi_password

captive_portal:

external_components:
  # https://github.com/nickolay/esphome-lilygo-t547plus
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]
  # https://github.com/kaeltis/esphome-lilygo-t547plus
  - source: github://kaeltis/esphome-lilygo-t547plus
    components: ["lilygo_t5_47_battery"]

deep_sleep:
  run_duration: ${run_time} 
  sleep_duration: ${sleep_time}
  id: deep_sleep_1
#  esp32_ext1_wakeup:
#    pins: GPIO39
#    mode: ALL_LOW

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    frequency: 100khz
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False

time:
  - platform: pcf8563
    id: internal_clock
    address: 0x51  
    i2c_id: bus_a
  - platform: homeassistant
    id: ha_time
    on_time_sync:
      then:
        - pcf8563.write_time

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

Then just need to add in your display info eg:

font:
  # https://github.com/hprobotic/Google-Sans-Font/blob/master/
  - file: fonts/GoogleSans-Bold.ttf
    id: font_1
    size: 45

display:
- platform: t547
  id: t5_display
  update_interval: 60s
  # rotation: 180
  #clear: true
  #full_update_every: 3
  #power_off_delay_enabled: true
  lambda: |-
      it.strftime(it.get_width()/2, 0, id(font_1), TextAlign::TOP_CENTER, "%a %d/%b/%Y", id(internal_clock).now());

I tried this but get this compile error:

Compiling .pioenvs/lilygo01/lib3d2/SensorLib/bosch/bhi3.c.o
In file included from .piolibdeps/lilygo01/SensorLib/src/TouchDrvInterface.hpp:34,
                 from .piolibdeps/lilygo01/SensorLib/src/TouchDrvInterface.cpp:30:
.piolibdeps/lilygo01/SensorLib/src/SensorLib.h:34:10: fatal error: SPI.h: No such file or directory

*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPI.h"
* Web  > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************

 #include <SPI.h>
          ^~~~~~~
compilation terminated.
*** [.pioenvs/lilygo01/lib3d2/SensorLib/TouchDrvInterface.cpp.o] Error 1
In file included from .piolibdeps/lilygo01/SensorLib/src/SensorCommon.tpp:34,
                 from .piolibdeps/lilygo01/SensorLib/src/bosch/BoschParse.h:32,
                 from .piolibdeps/lilygo01/SensorLib/src/bosch/BoschParse.cpp:30:
.piolibdeps/lilygo01/SensorLib/src/SensorLib.h:34:10: fatal error: SPI.h: No such file or directory

*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPI.h"
* Web  > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************

 #include <SPI.h>
          ^~~~~~~
compilation terminated.
*** [.pioenvs/lilygo01/lib3d2/SensorLib/bosch/BoschParse.cpp.o] Error 1
========================= [FAILED] Took 34.57 seconds =========================

Any advice?

@mdot9
Copy link

mdot9 commented Nov 28, 2024

I got it to compile simply by adding the following to esphome section:

  libraries: 
    - SPI

However, it seems the device is stuck in a boot loop after compiling, the logs are being spammed with:

[17:24:18]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
[17:24:18]Saved PC:0x403cd9f6
[17:24:18]SPIWP:0xee
[17:24:18]mode:DIO, clock div:1
[17:24:18]load:0x3fce3808,len:0x44c
[17:24:18]load:0x403c9700,len:0xbe4
[17:24:18]load:0x403cc700,len:0x2a38
[17:24:18]entry 0x403c98d4
[17:24:18]ESP-ROM:esp32s3-20210327
[17:24:18]Build:Mar 27 2021

@bhouseski
Copy link

im in the same boat as mdot9, similar error now with my code

@mdot9
Copy link

mdot9 commented Nov 28, 2024

All these hurdles, they'll add to the satisfaction once this thing is installed and working properly! Gotta stay patient and not put my fist through this epaper ahaha.

@bhouseski
Copy link

its strange because it was working fine before. maybe the latest ESPHome update caused a break.

@bhouseski
Copy link

Does anyone know where to put the board file in the latest Homeassistant/ESPHome version? The filestruckture seems to be totaly different now. No matter where I place the board json it's not found and the "config" folder is completely missing now :(

this. Need to know, otherwise I am unable to get this board working.

@brix29
Copy link

brix29 commented Dec 21, 2024

Does anyone know where to put the board file in the latest Homeassistant/ESPHome version? The filestruckture seems to be totaly different now. No matter where I place the board json it's not found and the "config" folder is completely missing now :(

this. Need to know, otherwise I am unable to get this board working.

Do you have root access? It's necessary. Is has to be placed in: /mnt/data/supervisor/addons/data/{addyour}_esphome/build/{devicename}/boards

Find some further information here:
https://community.home-assistant.io/t/esphome-based-lilygo-t5-plus-informer-for-home-assistant/680775

@SpuriousGer
Copy link

SpuriousGer commented Dec 31, 2024

I am going crazy trying to get this to work. I fail at the SPI part at the moment (simply copied the basic.yaml):

esphome:
  name: lilygo
  platformio_options:
    # Unless noted otherwise, based on https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/1eb6119fc31fcff7a6bafecb09f4225313859fc5/examples/demo/platformio.ini#L37
    upload_speed: 921600
    monitor_speed: 115200
    board_build.mcu: esp32s3
    board_build.f_cpu: 240000000L
    board_build.arduino.memory_type: qspi_opi
    board_build.flash_size: 16MB
    board_build.flash_mode: qio
    board_build.flash_type: qspi
    board_build.psram_type: opi
    board_build.memory_type: qspi_opi
    board_build.boot_freq: 80m
    platform_packages:
      - "toolchain-riscv32-esp @8.4.0+2021r2-patch5"
    build_flags:  # the first three defines are required for the screen library to function.
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_RUNNING_CORE=0"  # TODO: this conflicts with the value from platformio's idedata, spewing a lot of warnings during the build.
      - "-DARDUINO_EVENT_RUNNING_CORE=0"  # and this too
      # In addition to lilygo's settings:
      # To enable reading logs over USB until `hardware_uart: USB_CDC` support
      # is added to `logger:`, as detailed in <https://github.com/esphome/feature-requests/issues/1906>:
      - "-DARDUINO_USB_MODE=1"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"
    libraries: 
      - SPI

esp32:
  variant: esp32s3
  board: esp32-s3-devkitc-1

  framework:
    type: arduino
    # Just like in <https://community.home-assistant.io/t/enable-usb-cdc-to-log-hello-world-to-esp32-s3-dev-board-for-esphome/463164/10>
    # I had problems with newer versions; the following combination happens to work, so using it for now.
    version: 2.0.3
    platform_version: 5.1.1

logger:
  level: VERBOSE
  # hardware_uart: USB_CDC  # see note about <https://github.com/esphome/feature-requests/issues/1906> above

# Enable Home Assistant API
api:  # Set up a key instead: https://community.home-assistant.io/t/2023-2-esphome-deprecated-api-password-how-to-update-to-encryption-key
  password: !secret api_ota_password

ota:
  platform: esphome
  password: !secret api_ota_password

wifi: !include wifi-secrets.yaml

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO21 #was GPIO39 on the previous board
      inverted: true
    name: "Button 1"
    on_press:
      - logger.log: PhysButton Pressed

external_components:
  source:
    type: local
    path: components/
  components: ["t547"]

display:
  - platform: t547
    # rotation: 180
    update_interval: 30s
    lambda: |-
      it.line(0, 0, 960, 540);

Errors:

In file included from .piolibdeps/lilygo/SensorLib/src/TouchDrvInterface.hpp:34,
                 from .piolibdeps/lilygo/SensorLib/src/TouchDrvInterface.cpp:30:
.piolibdeps/lilygo/SensorLib/src/SensorLib.h:34:10: fatal error: SPI.h: No such file or directory

*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPI.h"
* Web  > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************

 #include <SPI.h>
          ^~~~~~~
compilation terminated.
*** [.pioenvs\lilygo\lib9e2\SensorLib\TouchDrvInterface.cpp.o] Error 1
In file included from .piolibdeps/lilygo/SensorLib/src/SensorCommon.tpp:34,
                 from .piolibdeps/lilygo/SensorLib/src/bosch/BoschParse.h:32,
                 from .piolibdeps/lilygo/SensorLib/src/bosch/BoschParse.cpp:30:
.piolibdeps/lilygo/SensorLib/src/SensorLib.h:34:10: fatal error: SPI.h: No such file or directory

@dsanner
Copy link

dsanner commented Jan 20, 2025

moving the libraries on indentation up fixed it for me (so it's under esphome and not platformio_options. esphome/issues#2911

I also had to do this esphome/issues#6241

@jeroenleenarts
Copy link

@dsanner So you are saying you have a working config, without the platform io boards json on your HA install? Would love to get a copy of your config then. :)

@jijijaco
Copy link

jijijaco commented Feb 3, 2025

I managed to make my board working with the following configuration :

esphome:
  name: esp-epaper
  friendly_name: esp-epaper
  platformio_options:
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio
    board_build.psram_type: opi
    board_build.partitions: default_16MB.csv
    board_build.arduino.memory_type: qio_opi
    build_flags:  # the first three defines are required for the screen library to function.
      - "-DBOARD_HAS_PSRAM" #OK
      - "-DARDUINO_USB_MODE=1" #OK
      - "-DARDUINO_USB_CDC_ON_BOOT=1" #OK
  libraries:
    - SPI


esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
  variant: esp32s3
  flash_size: 16MB

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ---

ota:
  - platform: esphome
    password: ---

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

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

captive_portal:

external_components:
  - source: github://nickolay/esphome-lilygo-t547plus
    components: ["t547"]
  - source: github://kaeltis/esphome-lilygo-t547plus
    components: ["lilygo_t5_47_battery"]

display:
- platform: t547
  id: t5_display
  update_interval: 30s
  lambda: ---

sensor:
  - platform: lilygo_t5_47_battery
    id: battery_voltage
    voltage:
      name: "Battery Voltage"
    update_interval: 60s

deep_sleep:
  run_duration: 10s
  sleep_duration: 1min
  id: deep_sleep_1

For reference, with this configuration, I don't need a json file placed in my install.

I do have an issue however, the deep sleep consumption is too high. I measure with a PPK2 around 5.5mA when in deep sleep. Would you have any idea to reduce this ? From what I see, I should get something down in the 100µA.

@brix29
Copy link

brix29 commented Feb 3, 2025

It won't help you very much, but your config looks similar to mine. I have a run time of 1min and sleep time of 120 mins. The display lasts 1 1/2 months with a small battery.

@jeroenleenarts
Copy link

Same here. Voltage drop is logged in home assistant and it is way quicker than I was hoping for.

Here's my working config.

https://github.com/AppForce1/lilygo-t5-47-plus-esphome

@jeroenleenarts
Copy link

This Reddit post is saying something about pin 13.

I plan on trying that soon.
https://www.reddit.com/r/esp32/s/X1DHyxk1v9

@jeroenleenarts
Copy link

Tried setting pin 13 high. But that also has the effect of the blue LED on the back of the board staying on.

@Plawasan
Copy link

Plawasan commented Feb 9, 2025

Same here. Voltage drop is logged in home assistant and it is way quicker than I was hoping for.

Here's my working config.

https://github.com/AppForce1/lilygo-t5-47-plus-esphome

I tried reusing your config to measure get back to working config with battery voltage readout, I get stuck at this error:

/config/esphome/esp-display.yaml: In lambda function:
/config/esphome/esp-display.yaml:680:104: error: 'class esphome::lilygo_t5_47_battery::Lilygot547Battery' has no member named 'state'; did you mean 'update'?

relevant config:

external_components:
  - source: github://kaeltis/esphome-lilygo-t547plus
    components: ["lilygo_t5_47_battery"]

  - source: github://madimadi/esphome-lilygo-t5-47@lilygo-t5-47
    components: ["lilygo_t5_47"]

sensor:
  - platform: template
    name: "Battery Level"
    id: batt
    entity_category: diagnostic
    device_class: battery
    unit_of_measurement: "%"
    lambda: |-
      return id(batt_volt).voltage->state;
    filters:
      - calibrate_linear:
          - 3.0 -> 0.0
          - 4.2 -> 100
      - clamp:
          min_value: 0
          max_value: 100    

Any ideas where I'm going wrong? Thanks!

@jeroenleenarts
Copy link

@Plawasan How is your batt_volt defined?

@Plawasan
Copy link

@Plawasan How is your batt_volt defined?

Should be same as yours..

  - platform: lilygo_t5_47_battery
    id: batt_volt
    update_interval: 60s
    voltage:
          name: "${esp_name} Battery Voltage"

@alainvdu69
Copy link

hi !
i've just received my board : a v2.4
it work with the esphome section in https://github.com/esphome/feature-requests/issues/1960#issuecomment-2631832333

but not the touchscreen and the RTC

@mjmccans
Copy link

but not the touchscreen and the RTC

Not sure if this is helpful, but I recently received a v.2.4 board and it took me a while to get the touchscreen working, but the following did it (you can probably remove the "transform" section as that is unique to my setup):

i2c:
  - id: bus_a
    sda: GPIO18
    scl: GPIO17
    frequency: 100khz
    # There is some problems with i2c scan so turn scan off if problem appear on your board
    scan: False

touchscreen:
  - platform: gt911
    id: lilygo_touchscreen
    interrupt_pin: GPIO47
    address: 0x5D
    i2c_id: bus_a
    setup_priority: -100
    transform:
      mirror_x: true
      mirror_y: false
      swap_xy: true
    on_touch:
      then:
        logger.log:
          format: "Touch: %i, %i"
          args: [ 'touch.x', 'touch.y' ]

@alainvdu69
Copy link

alainvdu69 commented Feb 18, 2025

it doesn't work.
i've tried with scan on 'true' and here is the log
found no i2c devices !
strange, the default code put on the board works well with RTC and touch screen

[16:15:26][C][i2c.arduino:071]: I2C Bus:
[16:15:26][C][i2c.arduino:072]: SDA Pin: GPIO17
[16:15:26][C][i2c.arduino:073]: SCL Pin: GPIO18
[16:15:26][C][i2c.arduino:074]: Frequency: 100000 Hz
[16:15:26][C][i2c.arduino:086]: Recovery: bus successfully recovered
[16:15:26][I][i2c.arduino:096]: Results from i2c bus scan:
[16:15:26][I][i2c.arduino:098]: Found no i2c devices!
[16:15:26][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Button 1'
[16:15:26][C][gpio.binary_sensor:016]: Pin: GPIO21
[16:15:26][C][PCF8563:022]: PCF8563:
[16:15:26][C][PCF8563:023]: Address: 0xA3
[16:15:27][E][PCF8563:025]: Communication with PCF8563 failed!
[16:15:27][C][PCF8563:027]: Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[16:15:27][E][component:082]: Component pcf8563.time is marked FAILED
[16:15:27][C][homeassistant.time:010]: Home Assistant Time:
[16:15:27][C][homeassistant.time:011]: Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[16:15:27][C][t574:053]: T547
[16:15:27][C][t574:053]: Rotations: 0 °
[16:15:27][C][t574:053]: Dimensions: 960px x 540px
[16:15:27][C][t574:054]: Update Interval: 30.0s
[16:15:27][C][captive_portal:089]: Captive Portal:
[16:15:27][C][mdns:116]: mDNS:
[16:15:27][C][mdns:117]: Hostname: meteo-temp-01
[16:15:27][C][esphome.ota:073]: Over-The-Air updates:
[16:15:27][C][esphome.ota:074]: Address: meteo-temp-01.local:3232
[16:15:27][C][esphome.ota:075]: Version: 2
[16:15:27][C][esphome.ota:078]: Password configured
[16:15:27][C][safe_mode:018]: Safe Mode:
[16:15:27][C][safe_mode:020]: Boot considered successful after 60 seconds
[16:15:27][C][safe_mode:021]: Invoke after 10 boot attempts
[16:15:27][C][safe_mode:023]: Remain in safe mode for 300 seconds
[16:15:27][C][api:140]: API Server:
[16:15:27][C][api:141]: Address: meteo-temp-01.local:6053
[16:15:27][C][api:143]: Using noise encryption: YES
[16:15:27][C][gt911.touchscreen:127]: GT911 Touchscreen:
[16:15:27][C][gt911.touchscreen:128]: Address: 0x5D
[16:15:27][C][gt911.touchscreen:129]: Interrupt Pin: GPIO47
[16:15:27][E][component:082]: Component touchscreen is marked FAILED

@alainvdu69
Copy link

ahhh, lol ... what a mistake : i've inverted the SDA and SCL value ..
with the good one, the TouchScreen is good

@alainvdu69
Copy link

alainvdu69 commented Feb 18, 2025

and pcf8563 is good with

`time:

  • platform: pcf8563
    id: pcf_time
    i2c_id: bus_a
    address: 0x51
    update_interval: never`

@alainvdu69
Copy link

I would like to warn of one thing: with the Touch model, we lose pixels on the edges: 3 on the left, 6 at the top, 10 on the right, and 8 at the bottom

@alainvdu69
Copy link

hi all.
the screen refresh make a flickering ...
someone has a trick to avoid this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests