ESPHome & ILI9341 touchscreen

Hi all,

has anyone implemented any ESPHome project using an ILI9341, including touch control? I’m able to use the display aspect of the touchscreen, what I’m missing is the touch control.

Thanks

According to what I have read, it has this touch controller

PS openhasp also supports it

https://haswitchplate.github.io/openHASP-docs/0.6/displays/ILI9341_IPS/

I am using a 2.8 "ILI9341 display and trying to calibrate the touch screen.
I used code from the ESPhome documentation.
The result is the same value of 0 in each corner of the screen that does not change. What am I doing wrong?

spi:
 clk_pin: 18
 mosi_pin: 23
 miso_pin: 19
 
xpt2046:
  id: touchscreen
  cs_pin: 17
  irq_pin: 16
  dimension_x: 240
  dimension_y: 320
  on_state:
    - lambda: |-
        if (touched)
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%d",
              id(touchscreen).x,
              id(touchscreen).y,
              id(touchscreen).x_raw,
              id(touchscreen).y_raw
              );
display:
  - platform: ili9341
    model: TFT 2.4
    cs_pin: 13
    dc_pin: 27
    led_pin: 32
    reset_pin: 33
    rotation: 90
    id: tft_ha

tft

did you manage to activate touch on this screen?

Yes, he did. I had the CLK pin badly connected.
Everything works fine, including virtual buttons.
I followed the documentation ESPhome.

1 Like

I have the same problem,
where did you connect the CLK pin?
and how did you set up esphome?

You must have all pins of the touch layer connected.
CLK, DIN, DO pins are shared. Connect them to the TFT(SPI) pins in the correct order.

Very good, now it is working like a charm
thank you very much