ITDB02 TFT LCD module is not sensing touch

Hello guys,
I've purchased Arduino Uno and explored it for quiet a while. Now recently I purchased a ITDB02-2.8 TFT LCD Module from ITED Studio and ITDB02 Arduino shield v2.0 to connect it with my Uno board. I downloaded ITDB02 library and tried all 3 examples. Everything is working fine except the touch function. It seems that it is not detecting touch at all. By the way, I do not have stylus pen so I'm using good old finger! I'm uploading the code I've used.

#include <ITDB02.h>

ITDB02 lcd(0,1,2,3,4,5,6,7,19,18,17,16);

void setup()
{
  lcd.Touchpin(15,10,14,9,8);
  lcd.Initial();
  lcd.CleanLCD();
  lcd.TouchInitial();
}

void loop()
{
   char ASCII[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
   char tp;
   unsigned int lx,ly;
   lcd.Setcolor(0,0xffff);
   lcd.Dispshowstr(5,5,"Touch Test Demo");
   lcd.Dispshowstr(130,300,"iteadstudio.com");
   for(;;)
   {
     if(lcd.TouchIRQ()==0)
   {
     lcd.TouchGetaddress();
     
     lcd.Dispshowchar(3,300,'X');
     lcd.Dispshowchar(10,300,' ');
     tp=ASCII[(lcd.TP_X>>24)&0x0F];
     lcd.Dispshowchar(17,300,tp);
     tp=ASCII[(lcd.TP_X>>16)&0x0F];
     lcd.Dispshowchar(24,300,tp);
     tp=ASCII[(lcd.TP_X>>8)&0x0F];
     lcd.Dispshowchar(31,300,tp);
     tp=ASCII[(lcd.TP_X&0x0F)];
     lcd.Dispshowchar(37,300,tp);
     
     lcd.Dispshowchar(53,300,'Y');
     lcd.Dispshowchar(60,300,' ');
     tp=ASCII[(lcd.TP_Y>>24)&0x0F];
     lcd.Dispshowchar(67,300,tp);
     tp=ASCII[(lcd.TP_Y>>16)&0x0F];
     lcd.Dispshowchar(74,300,tp);
     tp=ASCII[(lcd.TP_Y>>8)&0x0F];
     lcd.Dispshowchar(81,300,tp);
     tp=ASCII[(lcd.TP_Y&0x0F)];
     lcd.Dispshowchar(88,300,tp);
     
     lx=lcd.TouchGetX();
     ly=lcd.TouchGetY();
     lcd.Drawdot(lx,ly);
   } 
    
   }
}

All the texts are displayed fine and the x and y co-ordinate values are showing all zeroes even if I touch the screen anywhere!!! Is the code wrong or is there any kind of initialization issues I'm missing since I'm using the shield to connect it with my Uno? Thanks in advance.

Hello and welcome :),

Try with the UTFT and UTouch libraries:

http://www.henningkarlsen.com/electronics/library.php?id=51
http://www.henningkarlsen.com/electronics/library.php?id=55

You display model for UTFT will be ITDB28

Thanks for the prompt response.
But, I'm sorry to say that I tried the following example code provided with UTouch library with no success... =(
No matter where I touch the screen it draws nothing, It supposed to be drawing pixels at the place it gets touched, right?
Also, touching with fingers should be no prob, right?

#include <UTFT.h>
#include <UTouch.h>

// Uncomment the next two lines for the Arduino 2009/UNO
UTFT        myGLCD(ITDB28,19,18,17,16);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch(15,10,14,9,8);

// Uncomment the next two lines for the Arduino Mega
//UTFT        myGLCD(ITDB32S, 38,39,40,41);   // Remember to change the model parameter to suit your display module!
//UTouch      myTouch(6,5,4,3,2);

void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
}

void loop()
{
  long x, y;
  
  while (myTouch.dataAvailable() == true)
  {
    myTouch.read();
    x = myTouch.getX();
    y = myTouch.getY();
    if ((x!=-1) and (y!=-1))
    {
      myGLCD.drawPixel (x, y);
    }
  }
}

I see your problem...sorry to tell you that, but you can't use the touch feature with the "ITDB02 Arduino shield v2.0" :

There is not enough pins on the Arduino UNO to enable both SD card reader and Touchscreen...

You should have purchased an Arduino Mega and the Mega shield :frowning:

currently im having a about same setup on a personal project

i started with
http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411001.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417008.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

The touch/screen worked fine and had run an SD read/test seeing the sd card fine
i was using something like

UTFT myGLCD(ITDB28,19,18,17,16); //UTFT(Model, RS, WR, CS, RST);
ITDB02_Touch myTouch(15,10,14,9,8); // ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);

then moved due to lack of pins to further evolve my project to
http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411002.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

Touch didnt work either for me in this setup.
only after a PORT redirection hack i managed to get touch+screen working but
this might have had an impact to my other pins (still investigating that)
the port involved putting the ITBD02 uno sheild on the mega
as my mega shield is either broken or im missing something to get it work
as supposed to be.

http://www.mathias-wilhelm.de/arduino/shields/itead-2-4-tft-lcd-touch/

in this setup i initialized with
//UTFT myGLCD(ILI9325D_8,A5,A4,A3,A2); //Screen initialization
//UTouch myTouch(A1,8,A0,9,10); //Touch initialization

due to the hack library.

Touch and screen work flawlessly but having trouble putting
all my extra to continue (LDP8806 and skm53 gps)

Hello!

I had the same problem and just realized it was simple as change the order or the pins.
Where you have:

"lcd.Touchpin(15,10,14,9,8)"

you should replace the 9 for the 8 as,

"lcd.Touchpin(15,10,14,8,9)"

Hope it works like this! Let me know if that has solved your problem :slight_smile: