Sainsmart 3.2" TFT LCD with shield

OK so I got this off eBay it is a Sainsmart 3.2" TFT LCD and it came with the shield for the Arduino Mega 2560 which is what I am using. However I can not get anything but a white screen with this thing I have tried running the UTFT examples on it and I have also tried running the ITDB02 examples on it. I don't know what I am doing wrong but I hope someone can help. The pin out on the TFT LCD is as follows

1=GND
2=VCC
3=NC
4=RS
5=WR
6=RD
7=DB8
8=DB9
9=DB10
10=DB11
11=DB12
12=DB13
13=DB14
14=DB15
15=CS
16=F_CS
17=REST
18=NC
19=LED_A
20=NC
21=DB0
22=DB1
23=DB2
24=DB3
25=DB4
26=DB5
27=DB6
28=DB7
29=T_CLK
30=T_CS
31=T_DIN
32=NC
33=T_D0
34=T_IRQ
35=SD_D0
36=SD_CLK
37=SD_DIN
38=SD_CS
39=NC
40=NC

I am having trouble trying to figure what pins I need to put in sketch I have tried the defaults they give to no avail and I have tried the configuration 4,5,6,15

For this group of parts: [Discontinued] SainSmart Mega2560+1602 LCD Keypad Shield Kit For ATMEL – SainSmart.com you should not have to change anything to get the demo to run, you only have to select the correct demo project.

That means for a Mega, with the above mentioned 20-011-919 shield, it should be: UTFT myGLCD(ITDB32S,38,39,40,41);

Please note that the above is only my best guess, based on the information you provided.For future posts, please read the sticky note at the head of this forum section on how to post your question as it lacks everything people would need to help (model numbers, code examples, etc).

OK the sketch I am using is the Henning Karlsen UTFT Demo for the 320x240.

// UTFT_Demo_320x240 (C)2012 Henning Karlsen
// web: Electronics - Henning Karlsen
//
// This program is a demo of how to use most of the functions
// of the library with a supported display modules.
//
// This demo was made for modules with a screen resolution
// of 320x240 pixels.
//
// This program requires the UTFT library.
//

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];

// Uncomment the next line for Arduino 2009/Uno
//UTFT myGLCD(ITDB32S,38,39,40,41); // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
UTFT myGLCD(ELEE32_REVB,38,39,40,41); // Remember to change the model parameter to suit your display module!

void setup()
{
randomSeed(analogRead(0));
//pinMode(A0,OUTPUT);
//digitalWrite(A0,HIGH);
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
}

void loop()
{
int buf[318];
int x, x2;
int y, y2;
int r;

// Clear the screen and draw the frame
myGLCD.clrScr();

myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 319, 13);
myGLCD.setColor(64, 64, 64);
myGLCD.fillRect(0, 226, 319, 239);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1);
myGLCD.setBackColor(64, 64, 64);
myGLCD.setColor(255,255,0);
myGLCD.print("http://electronics.henningkarlsen.com", CENTER, 227);

myGLCD.setColor(0, 0, 255);
myGLCD.drawRect(0, 14, 319, 225);

// Draw crosshairs
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.drawLine(159, 15, 159, 224);
myGLCD.drawLine(1, 119, 318, 119);
for (int i=9; i<310; i+=10)
myGLCD.drawLine(i, 117, i, 121);
for (int i=19; i<220; i+=10)
myGLCD.drawLine(157, i, 161, i);

// Draw sin-, cos- and tan-lines
myGLCD.setColor(0,255,255);
myGLCD.print("Sin", 5, 15);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(sin(((i*1.13)*3.14)/180)*95));
}

myGLCD.setColor(255,0,0);
myGLCD.print("Cos", 5, 27);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(cos(((i*1.13)*3.14)/180)*95));
}

myGLCD.setColor(255,255,0);
myGLCD.print("Tan", 5, 39);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(tan(((i*1.13)*3.14)/180)));
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.drawLine(159, 15, 159, 224);
myGLCD.drawLine(1, 119, 318, 119);

// Draw a moving sinewave
x=1;
for (int i=1; i<(31820); i++)
{
x++;
if (x==319)
x=1;
if (i>319)
{
if ((x==159)||(buf[x-1]==119))
myGLCD.setColor(0,0,255);
else
myGLCD.setColor(0,0,0);
myGLCD.drawPixel(x,buf[x-1]);
}
myGLCD.setColor(0,255,255);
y=119+(sin(((i
1.1)3.14)/180)(90-(i / 100)));
myGLCD.drawPixel(x,y);
buf[x-1]=y;
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some filled rectangles
for (int i=1; i<6; i++)
{
switch (i)
{
case 1:
myGLCD.setColor(255,0,255);
break;
case 2:
myGLCD.setColor(255,0,0);
break;
case 3:
myGLCD.setColor(0,255,0);
break;
case 4:
myGLCD.setColor(0,0,255);
break;
case 5:
myGLCD.setColor(255,255,0);
break;
}
myGLCD.fillRect(70+(i20), 30+(i20), 130+(i20), 90+(i20));
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some filled, rounded rectangles
for (int i=1; i<6; i++)
{
switch (i)
{
case 1:
myGLCD.setColor(255,0,255);
break;
case 2:
myGLCD.setColor(255,0,0);
break;
case 3:
myGLCD.setColor(0,255,0);
break;
case 4:
myGLCD.setColor(0,0,255);
break;
case 5:
myGLCD.setColor(255,255,0);
break;
}
myGLCD.fillRoundRect(190-(i20), 30+(i20), 250-(i20), 90+(i20));
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some filled circles
for (int i=1; i<6; i++)
{
switch (i)
{
case 1:
myGLCD.setColor(255,0,255);
break;
case 2:
myGLCD.setColor(255,0,0);
break;
case 3:
myGLCD.setColor(0,255,0);
break;
case 4:
myGLCD.setColor(0,0,255);
break;
case 5:
myGLCD.setColor(255,255,0);
break;
}
myGLCD.fillCircle(100+(i20),60+(i20), 30);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some lines in a pattern
myGLCD.setColor (255,0,0);
for (int i=15; i<224; i+=5)
{
myGLCD.drawLine(1, i, (i1.44)-10, 224);
}
myGLCD.setColor (255,0,0);
for (int i=224; i>15; i-=5)
{
myGLCD.drawLine(318, i, (i
1.44)-11, 15);
}
myGLCD.setColor (0,255,255);
for (int i=224; i>15; i-=5)
{
myGLCD.drawLine(1, i, 331-(i1.44), 15);
}
myGLCD.setColor (0,255,255);
for (int i=15; i<224; i+=5)
{
myGLCD.drawLine(318, i, 330-(i
1.44), 224);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some random circles
for (int i=0; i<100; i++)
{
myGLCD.setColor(random(255), random(255), random(255));
x=32+random(256);
y=45+random(146);
r=random(30);
myGLCD.drawCircle(x, y, r);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some random rectangles
for (int i=0; i<100; i++)
{
myGLCD.setColor(random(255), random(255), random(255));
x=2+random(316);
y=16+random(207);
x2=2+random(316);
y2=16+random(207);
myGLCD.drawRect(x, y, x2, y2);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

// Draw some random rounded rectangles
for (int i=0; i<100; i++)
{
myGLCD.setColor(random(255), random(255), random(255));
x=2+random(316);
y=16+random(207);
x2=2+random(316);
y2=16+random(207);
myGLCD.drawRoundRect(x, y, x2, y2);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

for (int i=0; i<100; i++)
{
myGLCD.setColor(random(255), random(255), random(255));
x=2+random(316);
y=16+random(209);
x2=2+random(316);
y2=16+random(209);
myGLCD.drawLine(x, y, x2, y2);
}

delay(2000);

myGLCD.setColor(0,0,0);
myGLCD.fillRect(1,15,318,224);

for (int i=0; i<10000; i++)
{
myGLCD.setColor(random(255), random(255), random(255));
myGLCD.drawPixel(2+random(316), 16+random(209));
}

delay(2000);

myGLCD.fillScr(0, 0, 255);
myGLCD.setColor(255, 0, 0);
myGLCD.fillRoundRect(80, 70, 239, 169);

myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("That's it!", CENTER, 93);
myGLCD.print("Restarting in a", CENTER, 119);
myGLCD.print("few seconds...", CENTER, 132);

myGLCD.setColor(0, 255, 0);
myGLCD.setBackColor(0, 0, 255);
myGLCD.print("Runtime: (msecs)", CENTER, 210);
myGLCD.printNumI(millis(), CENTER, 225);

delay (10000);
}

The kit I bought is this one from eBay http://www.ebay.com/itm/151174693069?_trksid=p2059210.m2749.l2649&var=450228571354&ssPageName=STRK%3AMEBIDX%3AIT

I have tried going through all of the different setups that I have found on the internet including changing the model I just can not get this screen to do anything.

There is nothing in the eBay auction that you posted that came from SainSmart. So, I was wasting my time looking up a shield you did not have. Again, I ask that you please read the sticky post on how to ask for help in this forum and learn how to use code tags so you don't pollute the post visually with unnecessary program listings.

You are using the wrong driver. The declaration line should be the one that is commented out:

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

Since there are no jumpers on the Mega, TFT shield or LCD module, you are most likely dealing with a software configuration issue.

So, which version UTFT do you have? Did you download it from Hennings site? What version of the IDE are you running? Windows?

Hello I said I am using the Henning Karlsen library that I got from the Henning site I am using Windows and I am using the 1.5.6 r2 version of the IDE. Also I had the other line uncommented didn't you see that there was code there for the UNO I changed that so that I could remember what it was before I went through the list changing the mega line I went through and used every driver that had 16 bit SSD1289 after it.

I see there are edits within the demo code you posted, beyond changing the driver type line. So, I would delete your current copy of UTFT, download a fresh copy and try the 320x240 demo as-is since it is configured correctly for your shield and lcd type.

Hello avr_fred,

I did try the initial sketch without any kind of edits except for the mega line being uncommented and the UNO line being commented.

EDIT:// So, I finally got it to work I am sorry avr_fred I was wrong in what I said above. I did exactly what you said and re-downloaded a fresh copy of the UTFT library and it works great. Now I am having problems finding the right touch pins for this screen. Is there a way to find these pins using a multimeter?

Ah, I was about to post that I think you have a bad copy of UTFT from parts unknown. Why? Because the code you posted earlier has "copyright 2012" at the top which is not correct for the current library. Further, if you had to change anything at all to run the demo you don't have the same code I'm looking at!

The touchscreen setup is the same as the lcd - the current utouch library defaults to exactly the configuration you have. So, if you just leave the pins declared at 6,5,4,3,2 it should work... Maybe you should go download a fresh image of that as well...

If you really want to drill down to the pin levels, you'll need these references:

The MEGA: http://pighixxx.com/megapdf.pdf

The ElecFreaks TFT Shield:http://elecfreaks.com/store/download/datasheet/shield/TFT_MEGA_V2.0.pdf

The LCD I think you already have but if not, a complete docs package is available for download here: http://www.elecfreaks.com/store/32-tft-lcd-screen-module-tft0132-p-113.html