# Help Arduino Mega 2560 + 3.2" TFT LCD

**URL:** <https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918>\
**Category:** Displays\
**Created:** [May 15, 2014, 2:47pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918 "2014-05-15T14:47:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 15, 2014, 2:47pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/1 "2014-05-15T14:47:13Z")

</div>

I have Arduino Mega 2560 + TFT LCD Mega Shield V2.2 + 3.2" TFT LCD 240\*400  
[![](https://europe1.discourse-cdn.com/arduino/original/4X/b/9/7/b973b531891e6877a572e0556bdcb93bcc5dc540.jpeg)](http://s325.photobucket.com/user/thuaquang292/media/P1070051.jpg.html)

[![](https://europe1.discourse-cdn.com/arduino/original/4X/e/d/8/ed81b66f82dbc67549c2d023f5c6b05608000913.jpeg)](http://s325.photobucket.com/user/thuaquang292/media/P1070054.jpg.html)

[![](https://europe1.discourse-cdn.com/arduino/original/4X/5/3/7/537c7e39ec656af0581482a59fce313424854585.jpeg)](http://s325.photobucket.com/user/thuaquang292/media/P1070053-1.jpg.html)

I test with this code:

#include \<SPI.h\>  
#include \<TFT.h\> // Arduino LCD library

#define cs 7  
#define dc 6  
#define rst 5

TFT screen = TFT(cs, dc, rst);

void setup() {  
// initialize the screen  
screen.begin();

// make the background white  
screen.background(0,0,255);  
}

void loop() {

}

But nothing happen, the screen still be white (see picture)  
[![](https://europe1.discourse-cdn.com/arduino/original/4X/f/2/1/f2164f9acd2ef98d9c07b8796aeb2c57ef5f137c.jpeg)](http://s325.photobucket.com/user/thuaquang292/media/P1070055.jpg.html)

Please help me

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 19, 2014, 3:46am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/2 "2014-05-19T03:46:41Z")

</div>

Help me please =(

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 19, 2014, 9:05am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/3 "2014-05-19T09:05:45Z")

</div>

Hi  
I have faced similar problem with other hardware (mine is SmartGPU2 3.5")  
and I am still not able to boot up the screen but I have made many steps, it might help  
1- make sure the input voltage to your device is correct  
2- make sure you have the right libraries to operate the screen  
3- read the document sheet of your device and connect the wires based on it.

I hope this might help, keep us updated

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 23, 2014, 7:32am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/4 "2014-05-23T07:32:01Z")

</div>

> hamzehhirzallah:  
> Hi  
> I have faced similar problem with other hardware (mine is SmartGPU2 3.5")  
> and I am still not able to boot up the screen but I have made many steps, it might help  
> 1- make sure the input voltage to your device is correct  
> 2- make sure you have the right libraries to operate the screen  
> 3- read the document sheet of your device and connect the wires based on it.
> 
> I hope this might help, keep us updated

Tks for your help  
But my LCD not better, =(

nothing changed

---

<div class="post-metadata">

**Author:** ![tgsuperspec](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@tgsuperspec](https://forum.arduino.cc/u/tgsuperspec)\
**Post date:** [May 23, 2014, 8:23am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/5 "2014-05-23T08:23:33Z")

</div>

Suggest you try the utft librasry more options on the device / screen configurations.

Just google utft.

cheers

---

<div class="post-metadata">

**Author:** ![HazardsMind](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/hazardsmind/32/215209_2.png) [@HazardsMind](https://forum.arduino.cc/u/HazardsMind)\
**Post date:** [May 23, 2014, 10:33am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/6 "2014-05-23T10:33:59Z")

</div>

You need to use the UTFT and UTouch libraries not the regular TFT library.

---

<div class="post-metadata">

**Author:** ![sdbig](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@sdbig](https://forum.arduino.cc/u/sdbig)\
**Post date:** [May 25, 2014, 1:14am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/7 "2014-05-25T01:14:20Z")

</div>

The display was made for the pin-outs of the Uno not the Mega.

Even though the display plugs into the Mega, doesn't mean it will work.  
The Mega moves some of the I/O pins you need to other locations.

I had this same issue. Once I rewired the display to connect to the pins  
on the Mega, it worked great.

There are many topics on this, just search the forum.

---

<div class="post-metadata">

**Author:** ![tgsuperspec](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@tgsuperspec](https://forum.arduino.cc/u/tgsuperspec)\
**Post date:** [May 26, 2014, 1:18pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/8 "2014-05-26T13:18:26Z")

</div>

No need for wiring changes if you use utft.

Work out which pins on Mega are which  
Then the utft constructor accepts these pins..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 27, 2014, 12:15pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/9 "2014-05-27T12:15:31Z")

</div>

Hello, guys.

I'm thinking of buying this screen + shield kit for my Mega 2560 ([3.2" TFT LCD Module Touch Panel+ TFT 3.2" LCD Shield Expansion Board For arduino | eBay](http://www.ebay.com/itm/3-2-TFT-LCD-Module-Touch-Panel-TFT-3-2-LCD-Shield-Expansion-Board-For-arduino-/310796373380?pt=LH_DefaultDomain_0&hash=item485ce84d84))

However, I couldn't find this information: how many available pins will be left in the Mega after plugging the shield?

In my project, I will need a few more pins, because I will still be using other devices (such as sensors and motors).

Thank you!

---

<div class="post-metadata">

**Author:** ![HazardsMind](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/hazardsmind/32/215209_2.png) [@HazardsMind](https://forum.arduino.cc/u/HazardsMind)\
**Post date:** [May 27, 2014, 12:59pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/10 "2014-05-27T12:59:53Z")

</div>

Did you click the link on that page, Data Download?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 27, 2014, 2:36pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/11 "2014-05-27T14:36:45Z")

</div>

> [@](#):
>
> Hello, guys.
> 
> I'm thinking of buying this screen + shield kit for my Mega 2560 ([3.2" TFT LCD Module Touch Panel+ TFT 3.2" LCD Shield Expansion Board For arduino | eBay](http://www.ebay.com/itm/3-2-TFT-LCD-Module-Touch-Panel-TFT-3-2-LCD-Shield-Expansion-Board-For-arduino-/310796373380?pt=LH_DefaultDomain_0&hash=item485ce84d84))
> 
> However, I couldn't find this information: how many available pins will be left in the Mega after plugging the shield?
> 
> In my project, I will need a few more pins, because I will still be using other devices (such as sensors and motors).
> 
> Thank you!

Tks you, But i don't know chinese

> HazardsMind:  
> You need to use the UTFT and UTouch libraries not the regular TFT library.

I think my LCD or Arduino was damaged, I test with Examples of UTFT and UTOUCH library, SD card 128MB, 9V Power Supply, not work =(  
[![](https://europe1.discourse-cdn.com/arduino/original/4X/a/1/0/a10a9a74cbc40d02702775f4664c606da0eff822.png)](http://s325.photobucket.com/user/thuaquang292/media/55b1e6ef-b61e-45a3-b7c3-af416d835d12.png.html)

[![](https://europe1.discourse-cdn.com/arduino/original/4X/d/5/d/d5d543c5d4b15fd76af83d9c15e1de10adf1486b.jpeg)](http://s325.photobucket.com/user/thuaquang292/media/29357433-3537-4d27-ba52-e0e7214d6746.jpg.html)

---

<div class="post-metadata">

**Author:** ![HazardsMind](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/hazardsmind/32/215209_2.png) [@HazardsMind](https://forum.arduino.cc/u/HazardsMind)\
**Post date:** [May 27, 2014, 4:20pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/12 "2014-05-27T16:20:25Z")

</div>

I extracted everything you should need to get it to work.

[TFT\_Libraries.zip](https://forum.arduino.cc/uploads/short-url/cT8ZUL1JYVM0QTmfXLgXirqeGAL.zip) (246 KB)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 27, 2014, 5:17pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/13 "2014-05-27T17:17:09Z")

</div>

> HazardsMind:  
> I extracted everything you should need to get it to work.

How to use TFT\_library?

forgive my clumsy about 😊

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 27, 2014, 11:53pm UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/14 "2014-05-27T23:53:11Z")

</div>

Well, forget the chinese stuff.

Take this as a reference: [http://www.ebay.com/itm/SainSmart-3-2-TFT-TFT-LCD-Shield-for-Arduino-Mega2560-Mega1280-R3-Nano-Robot-/271019836468?pt=LH\_DefaultDomain\_0&hash=item3f1a0a8434](http://www.ebay.com/itm/SainSmart-3-2-TFT-TFT-LCD-Shield-for-Arduino-Mega2560-Mega1280-R3-Nano-Robot-/271019836468?pt=LH_DefaultDomain_0&hash=item3f1a0a8434)

Does anyone here have such shield? How many available pins will there be left after plugging the shield to an arduino mega?

Thanks.

---

<div class="post-metadata">

**Author:** ![tgsuperspec](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@tgsuperspec](https://forum.arduino.cc/u/tgsuperspec)\
**Post date:** [May 28, 2014, 12:18am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/15 "2014-05-28T00:18:35Z")

</div>

The simple anser is none, they don;t fit the exrras, but if you do fit the connectors you have the following,

Alll the communication pins  
Pins 8 to 13  
All the analogs

Its a shame that thereis no other break outs, the dispkay uses all the Digital pins 22 to 53 but in fact some are redundant  
The touch uses 2 to 7

cheers  
Happy coding 8) 8)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 28, 2014, 12:25am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/16 "2014-05-28T00:25:41Z")

</div>

Oh, thanks a lot, that's exactly what I needed.

It's such a pity that it consumes so many pins. I will have to think really carefully about my project before purchasing this display.

Thanks, anyway.

---

<div class="post-metadata">

**Author:** ![tgsuperspec](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@tgsuperspec](https://forum.arduino.cc/u/tgsuperspec)\
**Post date:** [May 28, 2014, 5:35am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/17 "2014-05-28T05:35:59Z")

</div>

BTW Trade Spotting are the ebay arm of SAINSMART and the ebay prices are higher than buying direct !

Have used about 24 screens and shield some times direct but i generally attach screen by ribbon to ensure access to the other pins is simple

Had only 1 failure, UTouch is quite quirky on this display if you email Auther and says Sainsdmart he tells you in no uncertain tone no support your own your own

UTFT works on solution but I have wrappered a class arround it to create in my opinion a nore consistent and defined interface

Cheers 8) 8) 8)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 29, 2014, 7:15am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/18 "2014-05-29T07:15:03Z")

</div>

Tks for all  
My LCD has worked

But i have some problem with Touch  
See this video, you will know

[![]( " - YouTube") ](https://www.youtube.com/watch?v=HvS8_MGsvw0)

X axis was inverted, and some pixel on the left lost (in this video, i can't press the "clear" button)  
what's happen?

---

<div class="post-metadata">

**Author:** ![HazardsMind](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/hazardsmind/32/215209_2.png) [@HazardsMind](https://forum.arduino.cc/u/HazardsMind)\
**Post date:** [May 29, 2014, 10:36am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/19 "2014-05-29T10:36:14Z")

</div>

You can subtract 320 from the getX() value you have now.

---

<div class="post-metadata">

**Author:** ![tgsuperspec](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@tgsuperspec](https://forum.arduino.cc/u/tgsuperspec)\
**Post date:** [June 2, 2014, 7:54am UTC](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918/20 "2014-06-02T07:54:47Z")

</div>

The UTouch lIbrary in my view uses a slightly odd method ..

1. I used a logic analyser to review the Texas Instrument chip used for the screen, this showed the best option seemed to be to attach the IRQ to a pin on arduino as an ege triggered interrupt. rather than use the polll techniues and read while low.

2. The spec on the chip also highlighted that although its 12 bit resolution to ensure next value availability you should clear the buffer register by clocking 16 bits through, from memory the UTouch library only does 12

3. You tend to get a ghosting interrupt generated at removal of touch which if your polling will cause extra invalid readings.

4 I run a moving average on data during a touch event.

Calibration is difficult on smaller displays if you google cailibrartion algorithms for TFT touch, the matrix solution always comes out best but

/// a.. On 3,2 its a bit overkill  
// b. The maths is difficult to program

The UTouch Library solution is fair, but holding the pointer still whilst sampling for a series of locations I find difficult, my customers founmd impossible.

Rewrote the calibration to cycle defined points round screen to acieve am average Y for TOP, BOTTOM and average x for LEFT, RIGHT with that and some simple maths can scale any touch sample read to be position on screen

Currently can specify down to 8 x 8 Icon on screen and with stylas touch detecy position. With finger touch use 16 x 16 Icon

Happy coding

1. 
  1.

[Next page](https://forum.arduino.cc/t/help-arduino-mega-2560-3-2-tft-lcd/233918.md?page=2)
