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
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
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.
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
So…
Does it work with touch or not?
Can you click on the screen and call a script or something in HA?
The documentations of ILI9341 TFT LCD — ESPHome does not mention that it has XPT2046, only at one place in the XPT2046 documentation does it mention ILI9341 and that is in a code block at the end.
I believe the documentations should at least link to each other.
That could sort out a lot of confusion.
Thanks.
Yes, it works well. I tried to turn on the Sonoff switch in HA using the ILI9341 virtual button.
The screen display and the touch interface are separate devices as far as esphome is concerned. I cannot remember where I read that the ili9341 was paired with the xpt2046, probably here ILI9341 IPS - openHASP
I certainly suggest giving openhasp a try.
For future folks need a jump on the screen pins.
SCK to the TCLK
MOSI to the TDO
MISO to the TDIN
So is this right?
SCK to the T_CLK
MOSI to the T_DO
MISO to the T_DIN
CS to the T_CS
Pin 16 to the T_IRQ?
Where the first four pins are shared and the IRQ one is just connected to pin 16 on the esp32?
Not getting any luck with the pins above can someone confirm if they are correct? Just get a blank screen and this (without touching the screen at all)
[10:16:31][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:33][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:43][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:44][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:45][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:45][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:16:45][I][cal:082]: x=0, y=240, x_raw=0, y_raw=0
[10:29:44][I][cal:083]: x=320, y=0, x_raw=8191, y_raw=8191
[10:29:44][I][cal:083]: x=320, y=0, x_raw=8191, y_raw=8191
[10:29:44][I][cal:083]: x=320, y=0, x_raw=8191, y_raw=8191
yaml:
spi:
clk_pin: GPIO18 # (Pin on display - SCK/T_CLK)
mosi_pin: GPIO23 # (Pin on display - SDI(MOSI)/T_DIN)
miso_pin: GPIO19 # (Pin on display - SDO(MISO)/T_DO)
touchscreen:
platform: xpt2046
id: my_touchscreen
cs_pin: GPIO14
interrupt_pin: GPIO16
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
id(my_touchscreen).x,
id(my_touchscreen).y,
id(my_touchscreen).x_raw,
id(my_touchscreen).y_raw
);
display:
- platform: ili9341
model: TFT 2.4
rotation: 90
cs_pin: GPIO14 # (Pin on display - CS)
dc_pin: GPIO27 # (Pin on display - DC)
led_pin: GPIO32 # (Pin on display - LED)
reset_pin: GPIO33 # (Pin on display - RESET)
update_interval: 3s
id: my_display
I have all the pins on ili9341 connected
I have the same problem, first it doesn’t spam the calibration message at all but after touching the screen once, it starts just spamming with all zeros. My configuration looks pretty much the same and I have connected clock, miso and mosi to both the lcd and touch
I was having the same issue with the touch aspect calibration. I followed the wiring in this video ILI9341 TFT LCD to ESP32 - Full HOW TO for display, SD card and Touch. Using TFT_eSPI driver - YouTube which had the MOSI jumped to T_DIN, the MISO jumped to T_DO and left the T_IRQ unused. It now works exactly as it should.
Is it possible you could share the exact connection and the esp home config?
Look here. At the bottom of the page