Introduction: TFT - Touch Panel

About: Electrónics gadgets

A Very easy way to spend sometimes learning with TFT Displays.

Wikipedia:Touch-screen devices using resistive technology, a two-dimensional membrane potentiometer provides x and y coordinates. The top layer is thin glass spaced close to a neighboring inner layer. The underside of the top layer has a transparent conductive coating; the surface of the layer beneath it has a transparent resistive coating. A finger or stylus deforms the glass to contact the underlying layer. Edges of the resistive layer have conductive contacts. Locating the contact point is done by applying a voltage to opposite edges, leaving the other two edges temporarily unconnected. The voltage of the top layer provides one coordinate. Disconnecting those two edges, and applying voltage to the other two, formerly unconnected, provides the other coordinate. Alternating rapidly between pairs of edges provides frequent position updates. An analog-to digital converter provides output data.

First we need to detect if there is a touch. So we connect both wires of one layer/membrane, e.g. X to ground (LOW from ardiuno pins set as output) and one wire from layer Y to pull-up resistor (setting corresponding arduino pin as INPUT_PULLUP). Reading the second wire of Y layer we get HIGH if there is no touch (because of pull-up) and LOW if there is a touch (because of contact with grounded X layer).

Then we need to read a position of a touch. So we set one of the X wires to HIGH (which one depends on on which side of touch screen we want to read min/max value; see variant A/B in the code) and we read analog value on Y. The value should be in the range 0-1023, but touchscreen I tested returns 110-910 (So it need to be calibrated - run ILI9341_7.ino). Then we apply LOW-HIGH on Y layer and read analog value on X.

Touchscreen I tested sometimes wrongly detects a touch, outside of the touched point. To prevent this I added some delays and the X and Y analog value is read repeatedly and touch is approved only if values do not differ (a lot).

Step 1: Bill of Materials ( Hardware )

  1. Arduino Uno - R3
  2. TFT Display Shield for Arduino ( ILI - 9341 ) ( No SPI ).
  3. A battery 5 v
  4. A UsB Cable

Step 2: Sketch - Using Arduino 1.8.10 IDE. ( Libraries Adafruit Included).

Programing the the "Chip" with this sketch is just the Start up to Future Challengers !!( ... Viewing Images from a SD Card , a Panel to Indentify Fingerprints , A lot of " Arcades Games " ...) possibilities are many !!!

This Set ( ILI 9341 - no SPI ) facilitate a lot due no need ( the wires & and Pull down resistors, to down the voltage for 3,3 v needed for this kind of Display, acc Datasheets ) , there is a regulator included into and ( Plug & Play config.- for Uno R3 ), but you can use many more " Arduinos" ( with pin addptations ...easily), refferences are inclueded into " Sketch ".

Download Libraries & exemples over here :

Tks Twente

There are the others examples into Libraries to download . ( open source )...Calculator , SD card Viewer, Touch Screen Point Calibrator and TFt touch Panel.

1 - There´s another " Fine Tune " ( optional ) included, for a better pressure precision, we need to know the resistance// between X+ and X- ( Axis ) To o this you will need any multimeter to read it !

For me I´m using, 350 ohms across the ( X+ )& ( X -) plate ( you will see into Sketch ) , and may differ yours, none the less it ( Software ) will run anyway !!

2 - If the " pen Point touched in the screen " make a "Shadow " ( far from the point touched ) ... You must to set up the ( coordinates ) at lines : ( example)

#define TS_MINX 145

#define TS_MINY 110

#define TS_MAXX 880

#define TS_MAXY 915

... be Pattient ( uncomplaining ) sometimes you will need change this ( numbers) many ...many times to close at " Perfection ".

...there are your tools do it !!!

Good Luck & mainly have Fun !!!

Be Safe !!! If Possible Stay at Home !!!

Step 3:

Arduino Contest 2020

Participated in the
Arduino Contest 2020