Problem working with 4.3" Touchscreen LCD (SSD1963) on Mega2560

I bought a 4.3" (480*272) touchscreen LCD to work alongside ARDUINO Mega2560. The controller model is SSD1963. Additionally, I'm using a "TFT LCD Mega Shield" as the interface in order to avoid wiring 40 pins!!

I'm using UTFT library (from Rinky Dink) for Read/Write purposes and it perfectly works. However, I haven't been able to initialize "Touch" yet. There is a URTouch library (again from Rinky Dink), but it apparently does not support this model. As I upload any of the library examples onto the board, it only displays random colored pixels, and does not respond to any touch input.

Does anyone know how to work with touch? or is there a library to take advantage of?

Post a link to your screen. e.g. Ebay sale
Post a link to your Adapter.

Thank you for your reply. The adapter and the LCD are packed together. Here is a link to the exact touchscreen LCD I have:

and the link to TFT LCD Mega Shield:

http://qqtrading.com.my/tft-lcd-mega-shield-v2-arduino

The TFT link does not give any details of the 32-way ribbon pinout.

You need a ribbon to mate with the ribbon connector.
You need a ribbon break out adapter board for the signals.
You need to wire the signals to the Adapter shield.

This is difficult for a hobbyist.
Much easier to buy a SSD1963 display with 40-pin header that mates directly with your Adapter Shield.

Of course it is cheaper to use bare modules with a custom pcb if you intend to manufacture and sell 1000s of finished items. A one-off prototype is easier to do with ready-made boards.

David.

Sorry if I was not clear enough. The LCD and the touch as well as the SSD1963 driver are all assembled together in the package I bought. The output is a number of 40 pins which I have directly connected to the "TFT LCD Mega Shield v2.0" which is connected to Mega2560. So far I have printed on the LCD itself, using "UTFT" library from Rinky Dink. The only problem I have, is running touch. Is there any library to activate touch?

Connect the Touch pins to the "TFT LCD Mega Shield v2.0"
Run the URTouch library examples.

It is much easier to buy a display with 40-pin header. Then plug it into the 40-pin Adapter Shield.

David.

That is exactly what I did. I downloaded "URTouch" library and uploaded all of its examples (including "URTouch_Calibration" and "URTouch_ButtonTest") onto the board but it always displays random colored dots (like the image attached). It's notable that SSD1963 is not listed in the compatible Devices PDF (provided in Rinky Dink website). However I don't think that this model is not supported by the library.

Do you have any idea why this happens and any way to resolve the problem?

Of course UTFT supports SSD1963. For 480x272 as well as 800x480.
From UTFT.h

#define ITDB43			12	// SSD1963	(16bit) 480x272
#define TFT01_43		12	// SSD1963	(16bit) 480x272
#define ITDB50			13	// SSD1963	(16bit) 800x480
#define TFT01_50		13	// SSD1963	(16bit) 800x480
#define CTE50			13	// SSD1963	(16bit) 800x480
#define EHOUSE50		13	// SSD1963	(16bit) 800x480
...
#define TFT01_70		20	// SSD1963	(16bit) 800x480 Alternative Init
#define CTE70			20	// SSD1963	(16bit) 800x480 Alternative Init
#define EHOUSE70		20	// SSD1963	(16bit) 800x480 Alternative Init

Buy a regular 40-pin SSD1963 display and a regular 40-pin Adapter shield.

You will find that URTouch expects the Touch pins in a standard place on the Adapter shield.

Read my reply in #3
You need to wire the 32 way ribbon to the corresponding places on the 40-way socket of the Adapter shield.

There is no point in worrying about the Touch until you have UTFT examples working i.e. showing on the TFT display.

It is very difficult to wire up the 32 way ribbon. Especially if you do not know the pinout.

When you have shown the TFT working, we can help you with the Touch.
After all, when you have diagnosed the 25 TFT wires, it only needs you to guess the Touch wires from the remaining 7 ribbon wires.

David.

Thank you for your replies. As I previously mentioned (in #1), I have already used "UTFT" library, and it works flawlessly. So there is no problem with display itself. However, I cannot initiate touch input using "URTouch" library. Additionally, for more clarification, I also attached an image of my touchscreen + TFT Shield + Mega board (all connected together)

My apologies. Your link in #2 shows:


i.e. ribbon connectors. There are no 40-pin header pins

your photo in #8 shows a regular 40-pin display with 40-pin Adapter Shield plugged into a regular MEGA2560. The mounting holes don't even match the Alibaba photo

Please copy-paste your UTFT constructor statement.
Please copy-paste your URTouch constructor statement.

Then we can help.

Which country do you live in?

David.

I'm sorry. You're right, I posted the link to a wrong product. My touchscreen LCD does have 40pin connector on the driver board.
Since I'm a rookie in working with graphical LCDs and also Arduino in general, I'm not sure what constructor statement is! Would you please clarify? if you mean the pin configuration in the "URTouch" library example sketch, I used the following (as mentioned in the comments above the code in example):

UTFT myGLCD(ITDB43,38,39,40,41);

URTouch  myTouch( 6, 5, 4, 3, 2);

by the way, I live in Turkey!

Yes, your constructors look correct.
Your Adapter uses those Touch pins.
I assume that your SSD1963 has got a Touch Paned and has a Touch Controller chip mounted on the pcb.

Please post an accurate link to your screen.
Or a photo of the actual pcb on your desk.

Install the URTouch library.
Run the URTouch_Calibration example with your constructors.

Make notes on paper.
e.g. what do you see on the screen?

You can add some debug information to the example:
e.g. Serial.begin(9600);
e.g. add Serial.print() calls to waitForTouch() and calibrate() functions

David.

This is the exact model that I've got:

I also attached a close shot image of the back of the LCD driver PCB.

As I upload the "Calibration" example onto the board, the LCD begins to display a number of fixed colored dots (like the image attached). It also flashes once a few seconds.

There seems to be a problem with waitForTouch() and calibrate() functions. I added the serial debugging (Serial.print ("OK")) at the end of these functions to check whether they work properly. Nothing shows up in the Serial Monitor. These are the functions' declerations:

void calibrate(int x, int y, int i)
{
  myGLCD.setColor(255, 255, 255);
  drawCrossHair(x,y);
  myGLCD.setBackColor(255, 0, 0);
  readCoordinates();
  myGLCD.setColor(255, 255, 255);
  myGLCD.print("* RELEASE *", CENTER, text_y_center);
  myGLCD.setColor(80, 80, 80);
  drawCrossHair(x,y);
  rx[i]=cx;
  ry[i]=cy;
  while (myTouch.dataAvailable() == true) {}
  Serial.println("calibrate function OK");
}

void waitForTouch()
{
  while (myTouch.dataAvailable() == true) {}
  while (myTouch.dataAvailable() == false) {}
  while (myTouch.dataAvailable() == true) {}
  Serial.println("WaitForTouch OK");
}

I would be much happier if you showed a screenshot of a working UTFT example.
Or if you listed all the UTFT examples that you have tried. (just quote example by name)

Your display pcb looks as if it has the standard 40-pin pinout.
If the TFT works the TFT pins must be ok.
I would expect the Touch pins to go to 2-7 on the MEGA2560

Please run this sketch. It only needs the Serial Terminal.

URTouch_raw.ino

#include <URTouch.h>

URTouch  myTouch( 6, 5, 4, 3, 2);

void setup()
{
    Serial.begin(9600);
    Serial.println("Hello URTouch_raw");
    myTouch.InitTouch();
    myTouch.setPrecision(PREC_HI);
}

void loop()
{
    long x, y;

    while (myTouch.dataAvailable() == true)
    {
        myTouch.read();
        x = myTouch.TP_X;  //use raw value
        y = myTouch.TP_Y;  //use raw value
        Serial.println("TP_X=" + String(x) + " TP_Y=" + String(y));
        delay(100);
    }
}

Please report back.

David.

Sorry I've been away for a couple of days. I attached a screenshot of the working UTFT library example (UTFT_Demo_480*272 under "Arduino (AVR)") that I modified for my needs. It works seamlessly. Actually, this is the ONLY example of this library that works on my display. All of the others (when uploaded to the board) display random colored dots (quite similar to image attached in #12).

I uploaded your code to the board and opened serial monitor. It works! I can read X and Y values of the touched area. I still don't understand my problem with URTouch library. However, I assume I can use your code and add "if" statements (for X and Y) wherever necessary to emulate pressing a button on the screen. Although using library would help a lot to reduce the complexity of the sketch.

Apparently, the only functions I need to initiate Touch are as follows:

URTouch  myTouch( 6, 5, 4, 3, 2);
myTouch.InitTouch();
myTouch.setPrecision(PREC_HI);

Thank you very much dear david_prentice

Saeed_Ghafouri:
I attached a screenshot of the working UTFT library example (UTFT_Demo_480*272 under "Arduino (AVR)") that I modified for my needs. It works seamlessly. Actually, this is the ONLY example of this library that works on my display. All of the others (when uploaded to the board) display random colored dots (quite similar to image attached in #12).

I do not believe you.

UTFT_Demo_480x272 should display a moving sine wave, coloured shapes, lines, ...

All UTFT library installations come with the same examples.

Just run the standard example. Edit the constructor statement. Just quote example "name.ino" and paste your constructor statement. Attach a photo of the sketch running.

Every UTFT example should work with your screen.
Quote the example name (and constructor statement) of each sketch that gives a problem.

e.g. I ran "UTFT_viewfont.ino" with this constructor:

UTFT myGLCD(ITDB43,38,39,40,41);

result: Failed. random pixels.

David.

Please don't get me wrong. As I mentioned, I had modified the library example "UTFT_Demo_480*272" for my needs. The original example also works great (please see the attachment).

I figured out the source of my problem. I should have changed the default "Model" in the constructor (which is ITDB32S), other than the numeric pin arguments. i.e. the correct constructor for my lcd is:

UTFT myGLCD(SSD1963_480, 38, 39, 40, 41);

A complete list of the supported LCD modules with their "Model for UTFT" is available (attached).

By doing so, all the examples of both libraries ("UTFT" and"URTouch") now work perfectly fine on my LCD. However the strange thing here is why "UTFT_Demo_480*272" example worked before without modifying the "Model" argument in constructor, while all the other examples failed.

UTFT_Supported_display_modules_&_controllers.pdf (101 KB)

Look at the examples. Most are written for 320x240 display e.g.

UTFT myGLCD(ITDB32S, 38, 39, 40, 41);

But the UTFT_Demo_WxH examples are written for specific size displays e.g.

UTFT_Demo_220x172 is 220 x 172 
UTFT_Demo_320x240 is 320 x 240  ITDB32S
UTFT_Demo_400x240 is 400 x 240 
UTFT_Demo_480x272 is 480 x 272  ITDB43 
UTFT_Demo_480x320 is 480 x 320 
UTFT_Demo_800x480 is 800 x 480

Personally, I find the gobbledygook names like ITDB32S or ITDB43 confusing.
It is clearer to say SSD1289 or SSD1963_480

Does your Touch Calibration work now?

David.

Yes, touch calibration also works perfetly. All I need to do (after calibration) is to add "LANDSCAPE" keyword to both functions' argument "myGLCD.InitLCD()" and "myTouch.InitTouch()". After that everything works as expected (for examle "URTouch_ButtonTest"). Here is the code:

myGLCD.InitLCD(LANDSCAPE);
myTouch.InitTouch(LANDSCAPE);

Thank you david_prentice. My problem is entirely solved now ...