3.5 inch tft lcd display touch screen uno r3 made in china
Display looks nice, installs neatly on top of Mega board, but blocks the rest of the pins. With right-angle pins, you should be able to get around that if necessary, or use cables to connect it instead.
Note: There is a film on the LCD, if there is scratch on the film when you receive the item, pls try to remove the film with your finger nail from the corner of the LCD, thanks.
In this Arduino touch screen tutorial we will learn how to use TFT LCD Touch Screen with Arduino. You can watch the following video or read the written tutorial below.
For this tutorial I composed three examples. The first example is distance measurement using ultrasonic sensor. The output from the sensor, or the distance is printed on the screen and using the touch screen we can select the units, either centimeters or inches.
The third example is a game. Actually it’s a replica of the popular Flappy Bird game for smartphones. We can play the game using the push button or even using the touch screen itself.
As an example I am using a 3.2” TFT Touch Screen in a combination with a TFT LCD Arduino Mega Shield. We need a shield because the TFT Touch screen works at 3.3V and the Arduino Mega outputs are 5 V. For the first example I have the HC-SR04 ultrasonic sensor, then for the second example an RGB LED with three resistors and a push button for the game example. Also I had to make a custom made pin header like this, by soldering pin headers and bend on of them so I could insert them in between the Arduino Board and the TFT Shield.
Here’s the circuit schematic. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number 14. As the 5V pins are already used by the TFT Screen I will use the pin number 13 as VCC, by setting it right away high in the setup section of code.
I will use the UTFT and URTouch libraries made by Henning Karlsen. Here I would like to say thanks to him for the incredible work he has done. The libraries enable really easy use of the TFT Screens, and they work with many different TFT screens sizes, shields and controllers. You can download these libraries from his website, RinkyDinkElectronics.com and also find a lot of demo examples and detailed documentation of how to use them.
After we include the libraries we need to create UTFT and URTouch objects. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries.
Next we need to define the fonts that are coming with the libraries and also define some variables needed for the program. In the setup section we need to initiate the screen and the touch, define the pin modes for the connected sensor, the led and the button, and initially call the drawHomeSreen() custom function, which will draw the home screen of the program.
So now I will explain how we can make the home screen of the program. With the setBackColor() function we need to set the background color of the text, black one in our case. Then we need to set the color to white, set the big font and using the print() function, we will print the string “Arduino TFT Tutorial” at the center of the screen and 10 pixels down the Y – Axis of the screen. Next we will set the color to red and draw the red line below the text. After that we need to set the color back to white, and print the two other strings, “by HowToMechatronics.com” using the small font and “Select Example” using the big font.
Now we need to make the buttons functional so that when we press them they would send us to the appropriate example. In the setup section we set the character ‘0’ to the currentPage variable, which will indicate that we are at the home screen. So if that’s true, and if we press on the screen this if statement would become true and using these lines here we will get the X and Y coordinates where the screen has been pressed. If that’s the area that covers the first button we will call the drawDistanceSensor() custom function which will activate the distance sensor example. Also we will set the character ‘1’ to the variable currentPage which will indicate that we are at the first example. The drawFrame() custom function is used for highlighting the button when it’s pressed. The same procedure goes for the two other buttons.
So the drawDistanceSensor() custom function needs to be called only once when the button is pressed in order to draw all the graphics of this example in similar way as we described for the home screen. However, the getDistance() custom function needs to be called repeatedly in order to print the latest results of the distance measured by the sensor.
Here’s that function which uses the ultrasonic sensor to calculate the distance and print the values with SevenSegNum font in green color, either in centimeters or inches. If you need more details how the ultrasonic sensor works you can check my particular tutorialfor that. Back in the loop section we can see what happens when we press the select unit buttons as well as the back button.
Ok next is the RGB LED Control example. If we press the second button, the drawLedControl() custom function will be called only once for drawing the graphic of that example and the setLedColor() custom function will be repeatedly called. In this function we use the touch screen to set the values of the 3 sliders from 0 to 255. With the if statements we confine the area of each slider and get the X value of the slider. So the values of the X coordinate of each slider are from 38 to 310 pixels and we need to map these values into values from 0 to 255 which will be used as a PWM signal for lighting up the LED. If you need more details how the RGB LED works you can check my particular tutorialfor that. The rest of the code in this custom function is for drawing the sliders. Back in the loop section we only have the back button which also turns off the LED when pressed.
I haven"t had a chance to get this thing connected and tested yet, mostly because there"s no real documentation on it. The official libraries must be manually copied to the libraries folder because they aren"t formatted to install from a Zip file. The official libraries must also be edited per some instructions in a README file to make them work for the particular board. And the libraries and examples are specific to Arduino, so it will take some work to make them work with ESP32. Also, while most 3.5" screens have a resolution of 480x320, the resolution on this one is only 400x240. Being an 8-bit parallel board instead of ordinary 3 or 4 line SPI, it will take some experimentation to get this up and going on an ESP32.
Finally, the price on this was 3x what I saw it for on other websites. This is a "value screen". It is lower resolution than comparable screens, yet priced the same, even higher than some. I bought this for about $18. Since then it has gone up in price about $1. But a simple search for "open-smart 3.5" turns up multiple sites where I can get it for under $7 + reasonable shipping, about $12 if you just buy 1. And the per-item shipping goes down the more you order.
Overall, it looks interesting as a "value screen", but as a direct competitor to higher resolution screens at a similar price, or if you"re not willing to put in a lot of work figuring it out yourself, then you should probably give this a pass.
This TFT LCD Screen Module , not just a LCD break but include the Touch , SD card and Flash design. So it"s a powerful extension module for your project.
Kuongshun Electronic, one of the international well-known manufacturers and suppliers of 3.5 inch tft touch screen module for mega 2560 r3 which is situated in China, now has quality products for sale. We are equipped with a group of professional and experienced workers, as well as advanced equipment. You can rest assured to buy discount and low price 3.5 inch tft touch screen module for mega 2560 r3 made in China from us and check the pricelist with us.
To make my projects with Arduino even more interesting bought this display of 3.5 inches. I thought I had bought a version with touch screen, but then I discovered that the version with support for touch screen sells in this other link.
It is a shield, IE, is to be plugged directly into the Arduino. My complaint is that does not extend any PIN and practically uses all, IE, You can"t do much on the Arduino UNO but play with the display. Detail to support the SD card to upload images.
Look at the game with different fonts and colors. To make something appear you must install some. I installed from this link, the version 1.1. The libraries are the Adafruit_GFX and Adafruit_TFTLCD. The touchscreen version also needs a library that can be downloaded on the same link, switching to the version 2.0.
Take a look at the video I made showing a program that generates circles, rectangles and triangles with random colors, In addition to the display pattern that comes with the library. I used the Arduino UNO:
I found the display quite slow. Not to make a watch, for example, because the display is blinking a lot when updated second by second. Maybe we can make a graph of the analog input A5, that doesn"t appear to be used to control, but to do so would have to weld or fit any wires directly into the board, because this shield does not extend any of the pins. Who knows in the Arduino Mega works best? I leave below link to the version with touchscreen and without touchscreen:
This module is a 3.5-inch TFT LCD module with “320X480” resolution and 65K color display. It is suitable for Arduino Uno and Mega2560 development boards, and also supports SD card expansion function. It uses 8-bit parallel port communication, and the driver IC is ILI9486.
The 3.5-inch display is a ready-made shield for Arduino Uno, which can also be placed on the Arduino Mega. The pins of this shield are designed to be easily installed on the Arduino. The bad point about these modules is that they use all Arduino Uno pins.
my_lcd.Fill_Triangle(x_spec+i*side_len-1,y_spec+(i+1)*h_len-1,x_spec+side_len/2+i*side_len-1,y_spec+i*h_len-1,x_spec+(i+1)*side_len-1,y_spec+(i+1)*h_len-1);
my_lcd.Fill_Triangle(x_spec+i*side_len-1,y_spec+(5-i)*h_len-1,x_spec+side_len/2+i*side_len-1,y_spec+(4-i)*h_len-1,x_spec+(i+1)*side_len-1,y_spec+(5-i)*h_len-1);
my_lcd.Draw_Line(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Draw_Rectangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Draw_Round_Rectangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),5);
my_lcd.Draw_Triangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Fill_Round_Rectangle(my_lcd.Get_Display_Width()/2-1-120+1, my_lcd.Get_Display_Height()/2-1-60+1, my_lcd.Get_Display_Width()/2-1+120-1, my_lcd.Get_Display_Height()/2-1+60-1,5);