Project tutorial
Interfacing and Fixing Touch Problem on TFT LCD 2.4″ Shield

Interfacing and Fixing Touch Problem on TFT LCD 2.4″ Shield © CC BY-SA

Interfacing the shield with Arduino UNO board and fixing the touch detection and inversion problem.

  • 1,274 views
  • 4 comments
  • 14 respects

Components and supplies

About this project

Video tutorial if needed

         Hello, in this tutorial I planned to test different functions of the TFT LCD shield but I encountered few problems and decided to show you some solutions first, so the usual tutorial about this shield will follow up later.

This is the shield I’m using it’s 2.4″ screen, it can work with Arduino Uno, Leonardo, Duemilanove, Mega… and has a slot for SD card you can use it to store BMP pictures and display them.

Wiring:

You just plug it on the top of the board :D. (don’t forget the insulation tape around the usb port so it doesn’t make contact with the screen board)

Libraries and codes:

            So this is where the problems began for me, first you should check for the library that will work for you, to know if a library works or not, download it and open the “graphictest” example, it should show you the different colors and shapes just like in the tutorial video, if you have a white screen you may want to change the library.

This is the one that worked for me: Download here

Unfortunately I don’t own any other version of the shield to test with a different library.

           If it works okay, you can now try the “tftpaint” example to try your touch functions, if it works correctly congratulations, but since you came here, you probably have the touch screen problem, and it’s due to manufacturers keep changing the pins locations.

For this open the “tftpaint” example and do some modification in the line shown bellow:

Original

#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin

New

#define YP A3 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 9 // can be a digital pin
#define XP 8 // can be a digital pin

After this re-upload the code of the paint to your board, and I hope the touch screen is now detected, if it works okay then congratulations otherwise continue the tutorial.

If one of your axis is inverted go to the touch screen library and open it with a proper editor.

And go to the line 159 and uncomment it

Save the library modifications and re-upload the code, if the touch function now is completely inverted do some other modifications like shown below:

First start with

return TSPoint(1023-x, 1023-y, z);

Then do your adjustement until the point get drawn where you touched it and in the picture, those are the values that worked fine for me.

Remember if one of the directions is still inverted just make it (x) or (1023-x), I hope this works for you if you have the problem.

Code

Github
https://github.com/JoaoLopesF/SPFD5408

Schematics

TFT Shield
Well..it's a shield
Sans titre1 wsmrzo7bxr

Comments

Similar projects you might like

DFRobot's 2.8" TFT Touch Shield for Arduino

by Techmirtz

  • 2,889 views
  • 1 comment
  • 22 respects

OSEPP LCD and keypad shield

Project tutorial by Joe

  • 38,392 views
  • 26 comments
  • 48 respects

touch sensor

Project tutorial by user253146

  • 8,179 views
  • 3 comments
  • 4 respects

HSVClock

Project tutorial by Mark Wilson

  • 2,779 views
  • 6 comments
  • 8 respects
Add projectSign up / Login