Introduction: 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
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
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
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
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
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
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...
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!
29 Comments
6 weeks ago
https://youtu.be/UVYKT4yXRc8
5 years ago
This is so confusing...
And this is coming from someone with an Electronics & Programming background. I am shocked at the dearth of documentation and multiple libraries with multiple dates for this thing. And to find out that it might start out with a Mirror Image - WOW!
I find that Aidafruit has changed a lot since I was there years ago. It too is confusing and some links referenced there are no longer valid.
I am trying to make a truly Universal Remote Control out of this mess. I just got the Arduino Uno & the Display and put it together and there are NO pins left to operate an IR LED.
And just what is the CON1 on the Display Shield? Possibly a way to connect other devices/sensors...?
One thing I did discover is that this is a LGDP4535 clone. That number is mentioned in the sparse so-called users manual that came with the display.
I have downloaded all kinds of libraries suggested in various posts... again, WOW!
Maybe I won't have to take a hammer to it...
Reply 2 years ago
Can you elaborate on which libraries will work, I've been fighting with this thing since I got it. I need it to play a simple video if possible. I'm trying to help an elderly lady in her 80s be able to watch videos from the SD card. Any help would be greatly appreciated. It's for a very good cause.
Question 2 years ago
Can this 2.8" elegoo display play video at all? I'm trying to make a unit that an older woman, in her 80's can play a video on it, if I set it up correctly? This is for a really good cause, I desperately need help, this is super important. Helping elderly folks with modern technology is tough. But I really need it to be able to play a video off the SD card if possible. Any help would be super highly appreciated.
2 years ago
Getting an error, learning and my coding is still quite the work in process:
C:\Users\utawa\AppData\Local\Temp\arduino_modified_sketch_881200\myTFTScreenSaver.ino: In function 'void loop()':
myTFTScreenSaver:88:3: error: 'TSPoint' was not declared in this scope
TSPoint p = ts.getPoint();
^~~~~~~
C:\Users\utawa\AppData\Local\Temp\arduino_modified_sketch_881200\myTFTScreenSaver.ino:88:3: note: suggested alternative: 'Point'
TSPoint p = ts.getPoint();
^~~~~~~
Point
myTFTScreenSaver:102:7: error: 'p' was not declared in this scope
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
^
exit status 1
'TSPoint' was not declared in this scope
Reply 2 years ago
hey, I am still fairly new to this but doesnt that mean that you did not declare TSPoint as an integer?
4 years ago
Hello,please post our code also ..the screen driver must be known and that info must be known in order to get these things to work correctly..you show your code and then the vid blurs..Someone needs to write a pdf teaching how ,what ,when and why concerning these screens I would gladly pay $10.00 and I am sure others would too.I have 3 different tftlcds only 1 works its for the mega and Bomer has a lib for it,I am really considering use of Nextion units from now on 4 pins easy programming but higher cost...also the small cell phone screens use spi mode and are real easy to set up and use
Reply 4 years ago
You can download the number pad sketch along with all the needed libraries here:
https://github.com/dmainmon/myNumberPad
Reply 3 years ago
Thanks
4 years ago
The program runs and nothing is displayed but a white screen. when I open the COM4 I see that when I hit the screen numbers appear to calibrate the screens position so it is registering but not showing up on the LCD. please help me before I pull all my hair out.
Question 5 years ago on Step 6
Is there any way, with an UNO, to add other I/O, given all the pins are used/covered, and none are brought through? I'd like to interface a 5-pin joystick. Is the only answer "buy a Mega"?
5 years ago
This does not work - won't link:
undefined reference to `TouchScreen::TouchScreen(unsigned char, unsigned char, unsigned char, unsigned char, unsigned int)'
undefined reference to `TouchScreen::getPoint()'
5 years ago
Where's my post?
I'm thinking I need an Arduino Mega to do what I want - a Universal Remote. Because after mounting the display there are NO pins left for anything else.
6 years ago
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.
6 years ago
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.
6 years ago
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
6 years ago
This video will show you how to fix the inverted display on the Mega
Reply 6 years ago
Thank you so much!
Now everything works perfect with my Mega!
6 years ago
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.
7 years ago
Great overview of this great affordable screen. Can you attach your UNO sketches?