St7789v esp32

Hello,
I have Esphome add on installed on home assistant.
I am trying to use a 240X320 TFT Display st7789v on a nodemcu-32s (v1.2)

While i am trying the most simple “hello world” example and it compliles succesfully the screen displays a partial black window and garbage outside of it.

I believe i need to use a different library that supports the specific screen.

The problem is that i dont know how i can install this specific library since i do not have access to perform the needed actions as described here:
https://docs.platformio.org/en/latest/core/userguide/lib/cmd_install.html

Could you please assist?

Any help on the above would be appreciated :smiley:

You can add all platformio libraries using the libraries option in your yaml file see: ESPHome Core Configuration — ESPHome

The problem: That will not solve the problemby itself. IF this library is needed ESPHome will not magically start using it just because you added it to the project. You need to write a Component that uses the library. (it seems that the library is faster because it uses DMA on the ESP32.)

I would rather investigate why the display it not working with the existing component. From the source it seems that the st7789v display component is hardcoded for 240x320 that should be fine.

Can you post your yaml and your log?

1 Like

Hello again,
Please find bellow the logs:

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from esp_tdisplay.local using esphome API
INFO Connecting to esp_tdisplay.local:6053 (192.168.1.74)
INFO Successfully connected to esp_tdisplay.local
[23:48:43][I][app:105]: ESPHome version 1.16.2 compiled on Apr 14 2021, 23:46:54
[23:48:44][C][wifi:443]: WiFi:
[23:48:44][C][wifi:303]:   SSID: [redacted]
[23:48:44][C][wifi:304]:   IP Address: 192.168.1.74
[23:48:44][C][wifi:306]:   BSSID: [redacted]
[23:48:44][C][wifi:307]:   Hostname: 'esp_tdisplay'
[23:48:44][C][wifi:311]:   Signal strength: -44 dB ▂▄▆█
[23:48:44][C][wifi:315]:   Channel: 11
[23:48:44][C][wifi:316]:   Subnet: 255.255.255.0
[23:48:44][C][wifi:317]:   Gateway: 192.168.1.254
[23:48:44][C][wifi:318]:   DNS1: 192.168.1.254
[23:48:44][C][wifi:319]:   DNS2: 0.0.0.0
[23:48:44][C][spi:081]: SPI bus:
[23:48:44][C][spi:082]:   CLK Pin: GPIO18 (Mode: OUTPUT)
[23:48:44][C][spi:084]:   MOSI Pin: GPIO19 (Mode: OUTPUT)
[23:48:44][C][spi:085]:   Using HW SPI: YES
[23:48:44][C][logger:185]: Logger:
[23:48:44][C][logger:186]:   Level: DEBUG
[23:48:44][C][logger:187]:   Log Baud Rate: 115200
[23:48:44][C][logger:188]:   Hardware UART: UART0
[23:48:44][C][st7789v:242]: SPI ST7789V
[23:48:44][C][st7789v:242]:   Rotations: 0 °
**[23:48:44][C][st7789v:242]:   Dimensions: 135px x 240px**
[23:48:44][C][st7789v:243]:   CS Pin: GPIO5 (Mode: OUTPUT)
[23:48:44][C][st7789v:244]:   DC Pin: GPIO16 (Mode: OUTPUT)
[23:48:44][C][st7789v:245]:   Reset Pin: GPIO23 (Mode: OUTPUT)
[23:48:44][C][st7789v:246]:   B/L Pin: GPIO4 (Mode: OUTPUT)
[23:48:44][C][st7789v:247]:   Update Interval: 1.0s
[23:48:44][C][captive_portal:169]: Captive Portal:
[23:48:46][C][web_server:132]: Web Server:
[23:48:46][C][web_server:133]:   Address: esp_tdisplay.local:80
[23:48:46][C][ota:029]: Over-The-Air Updates:
[23:48:46][C][ota:030]:   Address: esp_tdisplay.local:3232
[23:48:46][C][ota:032]:   Using Password.
[23:48:46][C][api:095]: API Server:
[23:48:46][C][api:096]:   Address: esp_tdisplay.local:6053

And bellow my actual code which is extremely simple hello world

api:
  password: "some_api_password"

ota:
  password: "some_ota_password"
font:
  - file: "Helvetica.ttf"
    id: helvetica_48
    size: 48
  - file: "Helvetica.ttf"
    id: helvetica_24
    size: 24
  - file: "Helvetica.ttf"
    id: font1
    size: 12

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO19

display:
  - platform: st7789v
    bl_pin: GPIO4
    cs_pin: GPIO5
    dc_pin: GPIO16
    reset_pin: GPIO23
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");

This is the result. And i am 100% sure my connections are correct as the above configuration.
The logs show that screen is utilized as:
[23:48:44][C][st7789v:242]: Dimensions: 135px x 240px instead of 320X240

Hey @johnny-f, did you ever find a solution?, I am facing the same issue, the display is being rendered as 135 x 240, instead of 240 x 320.

The following shows the display area.

        lambda: |-
          it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));

image
image

[06:49:45][C][st7789v:119]: SPI ST7789V
[06:49:45][C][st7789v:119]:   Rotations: 180 °
[06:49:45][C][st7789v:119]:   Dimensions: 135px x 240px
[06:49:45][C][st7789v:120]:   CS Pin: GPIO5
[06:49:45][C][st7789v:121]:   DC Pin: GPIO16
[06:49:45][C][st7789v:122]:   Reset Pin: GPIO23
[06:49:45][C][st7789v:123]:   B/L Pin: GPIO4

Looks like we all missed the current limitation on the ST7789V… see note from ESPHome site

Looks like it’s not far off though - Extend ST7789V component to support additional displays by kbx81 · Pull Request #3651 · esphome/esphome (github.com)

1 Like

Looks like it has landed now :slight_smile:

image

Hi Everyone. I’m running ESPHome 2022.8.1 with one of these 240x320 displays. I do have it working but only has to the known limitation of resolution up to 135x240.

This is the exact display I;m using (I hope it’s ok to post this link)

https://www.aliexpress.com/item/1005004237117445.html?spm=a2g0o.order_detail.0.0.6474f19cMBIUrD

Should the higher resolution work now in this version of ESP Home?

I see conflicting answers when I search.

hello,

you have to wait a little, the work as been done in Esphome but not yet implemented, i read that on Github…

I try a year ago and succeed but not entire screen, and wait for an update too.

If i well remembered i used a custom_component.st7789 but its not perfect, not all screen was used.

Perhaps this month we will see a new version of esphome where st7789 that work out of the box in 320x240 pixels…i hope so…

these screens are cheap and have a nice contrast, better than ili9341…so… :wink: