2.4" XPT2046/IL9341 TouchScreen - Touch not working

Help; After a lot ot try I finally get the display working following this tutorial but the tutorial doesn't use a touchscreen. To make touchscreen work I've tryied il9341_due library on arduino uno but It hasn't worked. I've also tryied other libraries but it hasn't worked.

This is the display: http://www.ebay.it/itm/240x320-2-4-SPI-TFT-LCD-Touch-Panel-Serial-Port-Module-PBC-ILI9341-3-3V-TE280-/321832885954?_trksid=p2141725.m3641.l6368

I've used the example sketch of il9341_due library (others demo of il9341_due worked changing the reset pin). Can someone help me?

Hi, you could try this attached library which I found on the internet and adapted for my needs.

Run the example (Touch_AS_Example) to test the touch screen, the coords are reported via the serial port.

The Touch_AS_Draw example will need to be adapted for your graphics library before it will run.

*** Update, see post #9 for latest version ***

TouchAS4.zip (8.69 KB)

There are lots of us with that particular display, and it works just fine with ILI9341_due. To use the touchscreen you will need UTouch by Henning Karlsen available here :- http://www.rinkydinkelectronics.com/library.php?id=55

Then you will need to run the ILI9341_due uTouchCalibration sketch. Place your calibration results in the utouchcd.h file in the UTouch folder and touch should work fine.

It would be useful to see a clear photo of your wiring. You said you are using an UNO, so did you put 10K resistors on the signal lines?

Try to give us more information than 'it doesn't work', what are the symptoms, what have you tried already?

Regards,

Graham

I tried the link to your Ebay item. Did you really pay 112 EUROS for a module that is located in your own country?

I can see this one http://www.ebay.it/itm/240x320-2-4-SPI-TFT-LCD-Touch-Panel-Serial-Port-Module-PBC-ILI9341-3-3V-TE280-/321832885954?_trksid=p2141725.m3641.l6368 from China for £5.90

or this one http://www.ebay.co.uk/itm/2-4-240x320-SPI-TFT-LCD-Touch-Panel-Serial-Port-Module-with-PBC-ILI9341-5V-3-3V-/201398197882?hash=item2ee4449e7a:g:sJAAAOSw-jhUIAzT from England for £9.99

The next question is: "Does your module match the photograph in the Ebay link?" i.e. "Does it contain a Touch Controller Chip?"

Several of us have this display. I use mine with everything on the same 3.3V SPI bus. I know that others like to waste their GPIO pins to bit-bang the Touch controller. Both approaches work.

David.

Bear in mind that the XPT2046 controller must be operated with 3.3V logic levels and hence level converters will be needed to operate with a UNO (which operates at 5V). So that may be your problem.

That is the exact same display I have, so as GH suggested, you can use the UTouch library. There is also a calibration sketch around here on the arduino forum.

Just look for ILI9341 UTouch Calibration

rowboteer: Bear in mind that the XPT2046 controller must be operated with 3.3V logic levels and hence level converters will be needed to operate with a UNO (which operates at 5V). So that may be your problem.

That is not true. The XPT2046 is 5V tolerant. So are all the other common Touch controllers.

David.

david_prentice: That is not true. The XPT2046 is 5V tolerant. So are all the other common Touch controllers.

David.

Yes, the supply can be 5V but on the display mentioned Vcc is wired to 3.3V and the data sheet specifies Vcc as the maximum for the I/O.

RobVE: Can someone help me?

I've blown the dust off my displays of that type and done some simple tests, sure enough the XPT2046 on that display does not like 5V logic up it's inputs. The current consumption went up 30mA, the 3.3V Vcc rail of the chip got pumped up to 4.2V (mainly by parasitic currents from the chip select line) and the touch coordinate outputs are erratic and unreliable. If the part was "5V tolerant" then these things would NOT happen! The 4.2V then also upsets the ILI9341 display controller too... which is also not 5V tolerant on inputs!

A simple approach is to use 10K series resistors in the signal line inputs to the chip, so if you are using 4 logic lines (not SPI to drive the touch controller) you could for example use:

Arduino pin A0 direct to display pin T_DO (direct since the XPT output can be wired to the Arduino direct) Arduino pin A1 via 10K to display T_DIN Arduino pin A2 via 10K to display T_CS Arduino pin A3 via 10K to display pin T_CLK

You can then use a library of your choice, but if you have trouble then I can update my hacked library for this display.

I have adapted the touch library in post #1 specifically for this 2.4" TFT ILI9341 display with the XPT2046 touch controller. It can be downloaded here:

TFT_Touch library

The library has been tested to operate with the TFT_ILI9341 graphics library here.

The touch library supports all screen orientations.

An example sketch is used to calibrate and test the touch screen. To make things really easy the sketch reports the setup() calibration code to use in your sketch via a serial port message.

A very simple "Paint" program is also included.

TTFN

hello,

this thread has looong been closed but in case someone found an answer...

i have a sainsmart SSD1963 4.3" which has resistive touch screen fit on it, connected on a DUE. it's been working for over 2 months now with the URTOUCH library and i decided to write my own proprietary code for it, which was also working. about a week ago it started to act strange... it worked one day, didn't work on another... when it gets stuck only a power off-on will fix it, if it gets fixed. i changed my adapter and used my own 40pin header with custom wiring (which also worked before) and now i use simple dupont wires to test another wiring. and no matter what i do with the hardware, the behavior remains the same... when it doesn't respond in my code, it doesn't work with urtouch code either. so it's not the wiring, it's not the code...? maybe the XPT2046 could be defective somehow? has anyone else noticed any relative behavior?

thank you... i'm trying to build something commercial... does anyone have something more reliable to suggest? or even a capacitive touch panel instead of resistive would be even better :)

vagos21

If everything is working one day but not the next, most probably one of your components have gone bad, your display/touchscreen, screen adapter shield or Due board.

The library in post #9 has an example called TFT_Touch_Raw that can be used to test the touch screen, it reports via the serial monitor window. Change the pins in the sketch to those used for your display.

Hoping this gets through to "BODMER" I have a UNO R3 and a touch TFT screen TJCTM24028-SPI 2.8" v1.1 and using from GITHUB BODMER/TFT_ILI9341 updated Nov/3/2016 and BODMER/TFT_Touch updated Dec/30/2015

The example TFT_Touch_Raw works fine and gives sensible figures in the serial monitor however TFT_Touch_Calibrate_V2 sends the message to the serial monitor and displays the text and the first red cross on the screen but then it hangs at line 85 ("while(!touch.Pressed());"

The data coming back from "ReadAxis" is always 0 so Pressed always returns false. However if I comment out all the TFT display functions including TFT.init before line 85 then the program goes through the while statement. I am surmising that there is some incompatibility between the Dec 30 2016 SPI interface and the TFT_Touch way of handling the data.

And yes I know there are other libraries but I'm at the "I've started so I will finish" state so any input would be helpful

TIA

Dennis

I am a beginner in Arduino. Last few days I spend on www.mcufreiend.com ' s 2.4" TFT touch display. It shows driver id 0154. But it always show white screen. Pls give me suggestions.

rowboteer: I have adapted the touch library in post #1 specifically for this 2.4" TFT ILI9341 display with the XPT2046 touch controller. It can be downloaded here:

TFT_Touch library

The library has been tested to operate with the TFT_ILI9341 graphics library here.

The touch library supports all screen orientations.

An example sketch is used to calibrate and test the touch screen. To make things really easy the sketch reports the setup() calibration code to use in your sketch via a serial port message.

A very simple "Paint" program is also included.

TTFN

TFT_ILI9341.h: No such file or directory (Correctly installed library!)

Go on. Post a link to the actual display that you have on your desk e.g. Ebay sale.

Both of Bodmer's libraries were written 4 years ago. I am sure that they worked fine then. And will work fine now.

If you have a proper 3.3V Arduino like Zero, Due, ... then you can connect directly to the popular Red Chinese SPI displays.

If you have a 5V Arduino, follow Bodmer's instructable for the wiring.

As always. Run the examples that come with the library. Use the same pin connections if possible.

If you have a problem, post a photo of your schematic or actual wiring. Quote which example sketch has a problem.

David.

Firstly, thanks David and sorry for the big mistake of not having previously installed the TFT_Touch library.

Secondly, I am trying to configure my screen, ILI9341 3.2 SPI Breakout Touch. I’ve used other libraries, such as ILI9341_due> uTouchCalibration, for example, and it reaches the INSTRUCTIONS screen (attached image) and, from there, it doesn’t pass; does not respond to pen touch.

Graphictest, from the same library, works normally.

With TFT_Touch_Calibrate, it only shows a blank screen (backlight) with the same pin settings.

With that, I think the error is not the pin configuration; maybe it’s the touch screen driver?
Or even the faulty touch screen?

The screen was purchased by eBay, as in the link. 3.2" 240*320 TFT LCD Display Module Controller Board Touch Panel & SD Card Cage 848354411307 | eBay

The display in your link shows that U2 is not mounted on the pcb.

Hence you have no XPT2046 Touch Controller. You can buy an XPT2046, ADS7843, ADS7846, TSC2046, ... or compatible chip. Solder it yourself.

The display should work just fine for the TFT and the SD. Run all Bodmer's examples.

David.

p.s. This shows how simply posting a link explains your problem immediately.

Thank you David

You say my screen has no touch controller?

If so, I was fooled by the seller because on the website it says: 3.2" 240*320 TFT LCD Display Module Controller Board Touch Panel & SD Card;

Do you confirm this?