Chinese TFT SPI 2.8'' display as touchscreen

Hello Has anyone managed to have this kind of low cost Chinese display work as touchscreen?

I have a 2.8 inches one, the reference is the same except it finishes with 8.

I had it display texts and curves but couldn't find any instruction about how to wire it and how to use it as a touchscreen. Can anyone help please?

Thank you

Go on. The XPT2046 Touch controller is not mounted. Empty footprint for U1.

I suspect that the Touch panel is not mounted either. Look at the screen side. Is there a 4-way printed connection and associated ribbon?

The other clue is in the price. I bet it was cheaper than the display modules with Touch.

David.

Thanks for your answer. Yes, the ribbon connection is present

But what do you mean with :

The XPT2046 Touch controller is not mounted.   Empty footprint for U1.

And how should I wire it ?

The 2.8" version has a similar pcb layout to the 2.4" pcb in your photo. Your photo has no chip in position U1.

It is always wise to post an accurate photo that matches the item on your desk. Simple enough from an Ebay 2.8" sale.

Buy XPT2046 chips from Ebay. Or ADS7843 or ADS7846 from US / European distributor.

Solder it to the pcb. The notch on the pcb legend shows which way round.

David.

Here are some pictures from the aliexpress site :

|500x500 |500x500 |500x500

Can you see that famous chip ?

Yes. Of course I can. Those photos show an integrated circuit U1 soldered on the pcb. Your photo in the Original Post showed an empty footprint.

What does the pcb on your desk look like? Does it have U1 mounted or not?

If there is an i.c. the Touch function will all work. I have the 2.4" Touch version. It works fine.

If there is no i.c. you will have no Touch.

David.

Thanks David, the last pictures are the display that I have. So the touch should work. How did you make it work ? What wiring and what libraries ? I use a nano, if this can help.

I am gobsmacked by the desire to use 5V targets.

Personally, I put TFT, SD, XPT2046 all on a 3.3V SPI bus. With 3.3V TFT_CS, TFT_DC, TFT_RST, SD_CS, XPT_CS signals. i.e. seven 3.3V outputs and one 3.3V input (MISO) There is no need for any level shifting because I always use 3.3V Arduinos e.g. Seeeduino, Zero, Due, STM32, Teensy3.2

Yes, you can use resistors, potential dividers or special purpose chips to achieve the level shifting.

What is the attraction of a Nano? It is cheap. So is a STM32 BluePill or MapleMini. I prefer to use target with Arduino headers. So I can swap hardware with ease.

David.

Edit. What is really interesting: how did an inaccurate photo get posted in #0 ?

What was unclear about my reply in #1 ?

The answer lies in the comparison between your number of posts and mine. I'm quite new at using these devices, but I like to learn and improve...

So I chose nano as it's smaller and I use voltage dividers when required. I'm not good in C programming, too old to learn that correctly.

Just wanting to test this touchscreen and have fun with it once I'll have it work correctly.

I can understand someone being good or bad at programming.

I can't understand one photo without i.c. and another photo with an i.c.

Use voltage dividers. I suggest that you post your schematic. Pencil drawing is fine.

There are many libraries: e.g. Adafruit_ILI9341.h, SD.h, XPT2046_Touchscreen.h

David.

I have exactly the same 2.8" SPI touch screen (as in your later picture) with XPT2046 touch controller chip. I used this to get started. If you have the tft part wired and working, the touch panel requires only one more Arduino pin for the chip select (T_CS). In the mean time I have gone on to develop my own calibration code using only 2 points to match accurately the coordinates of the touch screen with the tft display.

@David : I actually didn't check that the picture was the same as my display, sorry.

@6v6gt : Thanks, I tried that. I wired as in the ino code :

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

//XPT2046_Touchscreen ts(CS_PIN);
#define TIRQ_PIN  2

But all I get on the console is : "Pressure = 4095, x = 0, y = 0"

Did I miss anything?

I ran the example on my Seeeduino board. (3.3V Uno ) It works fine.

Obviously my SCK, MOSI, MISO are on 13, 11, 12. Same as a Nano. But I don't have to worry about level shifting.

Note that any unused SPI devices must be unselected. e.g. external pullup or specific digitalWrite() from your program. You can only select one SPI device at any one time.

David.

You're lucky, I really don't understand why it's not working for me. I double checked and saw that I had the interrrupt wired on D3, do I changed to D2 but it's still the same : infinite loop saying "Pressure = 4095, x = 0, y = 0"... even if I don't touch it

When I use it just for display, I use this :

#define _sclk 13
#define _miso 12 // Needed for SD card, but does not need to be connected to TFT
#define _mosi 11 // Master Out Slave In to send commands/data to TFT and SD card

// TFT chip select and data/command line
#define _cs 10
#define _dc 9

// SD card chip select
#define _sdcs 8

// TFT reset line, can be connected to Arduino reset
#define _rst 7

Now, should I do something to those unused pins (7, 9 and 10), and what?

Since the TFT_CS is on D10, it will probably be unselected by the regular SPI.begin()

Post a drawing of your wiring. Or prefeably a clear photo of the actual wires.

Here are the pictures. I hope it helps.
The wiring is the same as in the ino file, all data lines use voltage divider bridges with 1.2k and 1.8kOhms resistors. The supply af the display and the LCD pin are on the 3.3V pin of the nano. Same for the ground.

Thanks again for your help.

[edit] I don’t know what’s happening, I can’t post a second picture even in a separate post…

I presume that the TFT will be plugged into row c of the breadboard.

Surely you would implement a voltage divider by dividing the voltage. You are simply providing a 1k8 load to the Nano 5V logic. And a 1k2 resistor in series to the TFT.

This would probably work but is not ideal. (A series resistor limits the current going to the TFT substrate diodes)

You should connect the Touch SCK, MOSI, MISO lines to the bus.

No, I do not understand why the module does not link all the SPI bus signals on the pcb. It would save 6 external pins. On the other hand, libraries like UTFT and URTouch have no concept of hardware SPI or bus.

To make a voltage divider: move the 1k8 resistors to row a and GND.

David.

david_prentice: I presume that the TFT will be plugged into row c of the breadboard.

Yes, b or c

Surely you would implement a voltage divider by dividing the voltage. You are simply providing a 1k8 load to the Nano 5V logic. And a 1k2 resistor in series to the TFT.

This would probably work but is not ideal. (A series resistor limits the current going to the TFT substrate diodes)

Yes, you're right: I switched the TFT and 5V nano pins! :confused:

You should connect the Touch SCK, MOSI, MISO lines to the bus.

What do you mean 'to the bus'?

To make a voltage divider: move the 1k8 resistors to row a and GND.

David.

I'll do this when I'm back home. Thanks again for your help.

One more question: should I use the CS pin form the touch (labeled T_CS) or the CS from the display (label CS)? Now, I'm using the latter, and just aiming at testing the touch with the code provided by 6v6gt.

The Touch SPI pins are separate from the TFT SPI pins. Which are separate from the (unmounted) SD pins.

So you can just connect the XPT2046 to your Nano via the voltage dividers. The XPT2046 ChipSelect is labeled T_CS. And not worry about the TFT (or SD)

Personally, I would link all the devices to the same bus. After all, you a Touch is not much good without the TFT (or SD). However, this means you MUST ensure that the unused SPI devices have their CS pins high (unselected).

David.

And If I solder 4 new pins to the SD empty holes in the PCB, will the SD card work?