Looking for a ESP32 TouchScreen Library

ats3788
Posts: 27
Joined: Thu Feb 01, 2018 10:12 am

Looking for a ESP32 TouchScreen Library

Postby ats3788 » Mon Feb 05, 2018 1:10 pm

Hello friends of the ESP32
This is working for the ESP32, but I could not find a Lib to use the Touchscreen.
https://github.com/MartyMacGyver/ESP32_Adafruit_ILI9341
Does someone know a Library working Touchscreen Lib for the ESP32.

Cellie
Posts: 45
Joined: Sat Feb 27, 2016 9:47 pm

Re: Looking for a ESP32 TouchScreen Library

Postby Cellie » Tue Feb 06, 2018 3:13 pm

If it is a XPT2046 then this one should work:

https://github.com/PaulStoffregen/XPT2046_Touchscreen

ats3788
Posts: 27
Joined: Thu Feb 01, 2018 10:12 am

Re: Looking for a ESP32 TouchScreen Library

Postby ats3788 » Thu Feb 08, 2018 7:01 pm

#include <XPT2046_Touchscreen.h>
#include <SPI.h>

#define CS_PIN 8
// MOSI=11, MISO=12, SCK=13

//XPT2046_Touchscreen ts(CS_PIN);
#define TIRQ_PIN 2
//XPT2046_Touchscreen ts(CS_PIN); // Param 2 - NULL - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, 255); // Param 2 - 255 - No interrupts
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN); // Param 2 - Touch IRQ Pin - interrupt enabled polling

void setup() {
Serial.begin(38400);
ts.begin();
ts.setRotation(1);
while (!Serial && (millis() <= 1000));
}

void loop() {
if (ts.touched()) {
TS_Point p = ts.getPoint();
Serial.print("Pressure = ");
Serial.print(p.z);
Serial.print(", x = ");
Serial.print(p.x);
Serial.print(", y = ");
Serial.print(p.y);
delay(30);
Serial.println();
}
}
Thank you
I can compile this but I don't knew yet, if is working, I write this down later.

ats3788
Posts: 27
Joined: Thu Feb 01, 2018 10:12 am

Re: Looking for a ESP32 TouchScreen Library

Postby ats3788 » Fri Feb 09, 2018 5:45 pm

What a pitty it does not work :cry:

Duhjoker
Posts: 85
Joined: Mon Mar 20, 2017 8:09 am

Re: Looking for a ESP32 TouchScreen Library

Postby Duhjoker » Fri Feb 09, 2018 7:37 pm

Fear is the mind killer.......

GameR the DIY iot gaming device that does more......
https://github.com/Duhjoker/GameR-Iot_ESP

lesept
Posts: 38
Joined: Wed Jun 27, 2018 10:30 pm

Re: Looking for a ESP32 TouchScreen Library

Postby lesept » Wed Jun 27, 2018 10:33 pm

I have the same question: how to get the touchscreen work with my ESP32? I read the above link but I don't understand how to connect the touchscreen. Can anyone help me? Thank you

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Looking for a ESP32 TouchScreen Library

Postby Deouss » Fri Jun 29, 2018 12:21 am

I noticed on some boards there is an empty space with traces going to touchpad pins.
F.ex. this one: 2.4" 240x320 SPI TFT LCD

I wonder if I could just buy a touchscreen IC and just solder it there because seems like it is just missing to reduce the costs.
Anyone tried that maybe?

lesept
Posts: 38
Joined: Wed Jun 27, 2018 10:30 pm

Re: Looking for a ESP32 TouchScreen Library

Postby lesept » Sat Jun 30, 2018 9:26 am

I found a solution that works. I use the TFT_eSPI library for the display and XPT2046_Touchscreenfor the touch.
TFT_eSPI defines the pins in a setup file, here is what I used:

Code: Select all

// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS    5  // Chip select control pin (15)
#define TFT_DC    2  // Data Command control pin
#define TFT_RST   4  // Reset pin (could connect to RST pin)
and

Code: Select all

#define SPI_FREQUENCY  40000000 // Maximum to use SPIFFS

// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
#define SPI_TOUCH_FREQUENCY  2500000

deepakt
Posts: 24
Joined: Tue Feb 26, 2019 12:23 pm

Re: Looking for a ESP32 TouchScreen Library

Postby deepakt » Fri May 17, 2019 5:47 pm

Hi,

Has anyone got this working lately? Also, based on the pins, I suppose that the CLK, MISO, MOSI pins would remain common for both LCD and Touch while the CS/SS will be different and independent for LCD and Touch? Would be great if someone can share a correct and tested pinout?

I'm working with a 2.8" LCD with touch screen (ILI9341 chipset) and having a little trouble integrating it, hence call for help.

Regards,
Deepak

deepakt
Posts: 24
Joined: Tue Feb 26, 2019 12:23 pm

Re: Looking for a ESP32 TouchScreen Library

Postby deepakt » Sat May 18, 2019 6:57 am

Looks like the TFT_eSPI library is now updated and supports ESP32 as well for use of touch.

https://forum.arduino.cc/index.php?topic=616515.0

https://github.com/Bodmer/TFT_eSPI

Regards,
Deepak

Who is online

Users browsing this forum: No registered users and 68 guests