Introduction: UNO R3 2.8 TFT Touch Screen With SD Card Socket for Arduino Board Module

Picture of UNO R3 2.8 TFT Touch Screen With SD Card Socket for Arduino Board Module

Trying to get this touch screen display working has caused some people frustration. The unit came in an anti-static bag as shown in the pictures with a stylus and NO documentation. After searching around I found some libraries and arduino code that worked with this module. After some modifications I was able to execute a simple paint program, number pad, bitmap display (from SD), and a simple screen saver / calibration helper sketch that shows raw data; good for troubleshooting. Read the next steps to find out more information and view the source code examples.

Step 1: Get Connected

Picture of Get Connected

Connect your touchscreen shield to the arduino uno board as show in the pictures. There will be two pin slots open on each side.

You can download the number pad sketch along with all the needed libraries here:

https://github.com/dmainmon/myNumberPad

You need to unzip and extract the download then copy the contents of the libraries folder into the Arduino libaries folder: on windows usually it is in \documents\Arduino\libraries

Step 2: Screen Saver and Calibration Helper Sketch

Picture of Screen Saver and Calibration Helper Sketch

Copy the code example in the demonstration video and upload the sample sketch to an Arduino Uno. This sketch allows you to touch the screen and get raw x, y and transposed x, y coordinates. The raw data is necessary to properly calibrate the touch screen. The sketch also demonstrates shifting states based on touching one of the onscreen buttons. Depending on the state, the program will display a different shape at the location of the touch. The program will also go into a screen saver mode that displays the current state shape.

Step 3: Bitmap Display for UNO R3 2.8 TFT Touch Screen

Picture of Bitmap Display for UNO R3 2.8 TFT Touch Screen

This sketch demonstrates the standard bitmap display from the SD Micro card inserted into the touch screen. The bitmap files first needed to be copied to the root folder of the SD card. You can do this using a computer. The files need to be named the same as those in the sketch, or you can change the sketch to reflect different file names. Watch the video to view the demonstration and source code.

Step 4: Paint Sample for UNO R3 2.8 TFT

Picture of Paint Sample for UNO R3 2.8 TFT

This video demonstrates the standard AdaFruit paint program modified to work with UNO R3 2.8 TFT Touch Screen module.

Step 5: Touch Screen Numeric Pad Example

Picture of Touch Screen Numeric Pad Example

This video demonstrates a number pad sketch for the UNO R3 2.8 TFT Touch Screen Module. The original sketch had issues on this module. The numbers when touched were reversed on one axis; touching "1" would produce "3" and "4" would produce "6" and middle numbers like "2" and "5" were correct. This sketch fixes this problem by accurately transposing the raw x, y coordinates.

Step 6: Fix for Mirror Display Bug

Picture of Fix for Mirror Display Bug

I connected this module to my Arduino Mega 2560 and uploaded the sketch. When the number pad displayed, all the numbers were in the correct place but everything was mirrored! I uploaded my screen saver sketch and everything worked as expected, no mirroring. I uploaded the paint sketch and that worked as expected as well. So I examined the code and noticed the only difference with the number pad sketch was that the rotation was not set. The number pad uses the default rotation and this value was not set. So I added this to the setup function and everything looked normal.

So if you are using the Arduino Mega 2560, make sure you add the following line to the setup function: tft.setRotation(0);

Step 7: Moving Forward...

Picture of Moving Forward...

Moving forward with this display I decided to do another project graphing analog signals. The project uses two analog signals: one from a photo resistor and one from a mic / amp module.

If you are interested, take a look a the instructable https://www.instructables.com/id/Arduino-Analog-Sig...

Thanks!

Comments

srivera18 (author)2017-03-19

There are no ino's for TFT and Aidafruits in the libraries. I'm a newbie to arduino, what am I missing? BTW, I did get the number pad to work.

Nellson made it! (author)2017-01-23

Got the display in the Mail today and immediately hooked it up. Got a big white nothing. Tried all sorts of libraries but when I tried the button code in this instructable, it just worked.

The resistive touch is a little off, and when I load the paint example my Y axis (short axis) is reversed.

But very happy!

dmainmon (author)Nellson2017-02-21

Try setting the rotation to zero in the setup function. This might solve the reversed axis issue.

mderton (author)Nellson2017-01-23

same problem with Y-axis. could use help

mderton (author)2017-01-23

Thank you for the instructable. I'v been trying to build a DIY smartphone but couldn't get the code or libraries for the touch screen. Now i can finally build it. Thanks.

mkeschmann (author)2017-01-02

I'm having issues getting this display to work on my Arduino 101 board with the libraries that are suggested - errors in compiling seem to indicate that the board type isn't supported in the Adafruit_TFTLCD library. Here's a representative error:

" ...\Arduino\libraries\Adafruit_TFTLCD\pin_magic.h:350:3: error: #error "Board type unsupported / not recognized"

#error "Board type unsupported / not recognized" "

I'm expecting that I need to update pin_magic.h to include definitions that support the 101 board to to set the polarity of the data/control lines, but

feedback would be greatly appreciated. And if anyone has the updated file then gaining access to it would also be great!

Thanks, Mike

dmainmon (author)2016-12-16

This video will show you how to fix the inverted display on the Mega

ChanghanJ (author)dmainmon2016-12-19

Thank you so much!

Now everything works perfect with my Mega!

gymhack made it! (author)2016-06-10

I do everything in this tutorial but my LCD doesn't work, it just stay the same. What can be wrong?

dmainmon (author)gymhack2016-12-15

I posted the code including the libraries. Usually this type of issue is due to the incorrect libraries. https://github.com/dmainmon/myNumberPad

ChanghanJ (author)dmainmon2016-12-15

Thanks for the libraries

Now LCD works well with my mega2560

But the display looks inverted. How do I solve this issue??

ZackH5 (author)gymhack2016-12-05

Already solved it? Same problem here.

gymhack (author)gymhack2016-06-11

Also I got this with the graphicstest

dmainmon (author)gymhack2016-11-23

Try these libraries:

https://github.com/dmainmon/myNumberPad

KamalK54 (author)gymhack2016-09-11

Hi ,

I am also finding the same problem with my LCD. Did you find a solution to this?

dmainmon (author)KamalK542016-11-23

Try the libraries in this download:

https://github.com/dmainmon/myNumberPad

dmainmon (author)gymhack2016-11-23

Try using the libraries in this download:

https://github.com/dmainmon/myNumberPad

Eric Brouwer (author)2016-11-28

Thank you SO MUCH for posting this.

After 3 days of searching the internet, I was still unable to get the resistive touchscreen to work.

I finally got the touchscreen to work correct using your links to the libraries. Found out that this specific TFT display module uses pin 6 & 7 for touch sensor, instead of the standard 4 & 5.

siliconghost (author)2016-02-04

Great overview of this great affordable screen. Can you attach your UNO sketches?

I never received a response on this, so went through the painful process of copying code from the video. It can be found here for others that might need it. Not that this has some minor changes, but is fully functional and I will continue to refine: https://github.com/siliconghost/Arduino_2.8in_TFT_wSD

Railes (author)siliconghost2016-02-26

To get your code working I needed to use these Libriaries i found in MCUfriend.com

http://forum.arduino.cc/index.php?topic=292777.0

dmainmon (author)Railes2016-11-23

You can download the libraries used in this here:

https://github.com/dmainmon/myNumberPad

grantwc (author)Railes2016-08-06

Same here. These are the only libraries that worked for me. Currently going through the changes so i can understand what had to be done to make this display work.

Thanks for the link. It is a relief to see the display finally working!

NicA8 (author)2016-09-27

i have two questions:

- There is a sketch for sleeping display (on/off or sleep mode)?

- How can i connect this display with Arduno Nano ?

Wesley R Tech (author)2016-04-03

How do I plug it into the Mega?

dmainmon (author)Wesley R Tech2016-04-16

This instructable uses this TFT with a Mega. https://www.instructables.com/id/Arduino-Analog-Sig...

You should be able to adapt the code. The main thing to pay attention to are the initialization variables at the top before the setup and loop functions.

BramS3 (author)2016-03-31

Do I need to include all three libraries, all I am doing is displaying sensor values on the screen, no touch button interaction?

2illickans (author)2016-02-03

awesome project

About This Instructable

82,472views

198favorites

License:

Bio: Will write code for food. :) If you need help with any of your embedded Arduino applications please send me a message.
More by dmainmon:ArduCAM Mini ESP8266 Web CameraESP8266-12E DHT ThermostatESP8266 OLED Clock IoT Using AJAX
Add instructable to: