Tutorial: How to use 2.4 TFT Display in Arduino | SPFD5408 | ILI9341

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
display modules is used to show text draw images and shapes to show necessary information there are many types of displays available in the market today in this video we will focus to learn on how to use a tft or a thin film transistor display which is just another kind of liquid crystal display or lcd i have here a 2.4 inch tft display shield for arduino uno and arduino mega and if you can wire it properly you can use this to most development platforms it has a resolution of 240 by 320 rgb pixels which is fairly enough for most common usage it has a resistive touch screen this is useful if you want to provide some user interface functionalities or menus to interact with the user it has a slot for microsd card at the back you can use it for external storage for data logging you may also access the sd card for displaying images in bitmap format for the pin outs or pin assignments at the top side of the shield is a 2.4 tft display and it has a small push button for resetting the arduino board and also the tft driver at the bottom side underneath are the pins which fits nicely to my arduino uno are the pins used by the micro sd and it is shared with lcd when using the lcd in spi mode so the pins are sd underscore sck or spi s clock pin is the serial clock which is connected to arduino uno digital pin 13. sd underscore do or spi miso pin is the spi master input slave output which is connected to digital pin 12. next is the sd underscore di or spi moti pin is the spi master output slave input which is connected to digital pin 11. next is the sd underscore ss or spi chip select which is connected to arduino digital pin 10. next are the parallel data pins of the lcd notice that the lcd d0 and d1 is here d0 then d1 and lcd d2 d3 d4 d5 d6 d7 on the other sides are the lcd control signals this one which use the a02a port the a pipe is written app underscore cs but i don't know what's the use of this this could be a backlight control but i'm not sure this tft shield occupies most or all of the pins of the arduino uno so others choose to use an arduino mega the problem in using the arduino mega with the shield is that the spi pins is not located in digital pins 13 12 11. it is digital pin 50 51 and 52 so the hobby is created libraries that can work around this limitation that is to create a software spi in digital pin 13 12 and 11 or bit banging to mimic or copy the native spi capabilities it works but with slower refresh rates when rendering the display and more resources is used that is using the arduino mega another problem is you will not be able to access the micro sd card because you already know sd card access use spi theoretically it will work using another software spi now let me plug it fit to my arduino uno and let's see the software side to connect this to our arduino uno just spit it nicely making sure that all the pins are incorrect position then just press like that it's beautiful by the way i added some hot glue to make the connection intact let me connect it to my computer connecting the usb and let's go to my desktop there are many libraries available for tft display but the library of joe lopez works for me while having problem with other libraries after you downloaded the libraries we can try something from the examples my life the libraries and this is the one i am using spfd5408 not the copy from idapro the other pro library is not working for me so this one is from joao lopez so let's load the graphics test and let's load this okay uploading let's just wait so my display is working now let us try something more useful i prepared here some arduino sketch for the tutorial so let's load it speedy up learning hello world this is an example for displaying text messages or text let's upload this for us to see how it works done uploading so it will reset and it displays hello from tech to tinker 2.4 tft display the source code is it starts with including the necessary libraries and this one is for the definition of the touch screen which is we are not using and here are the initializations for the lcd and it begins the initialization of tft it always begins with the tft that reset then we use tft.begin 0x9341 or ili 93.1 because even though this one is using spfd 5.08 lcd driver i think it's similar to ili 9341 lcd driver because it's working with this after that we set the rotation to two so that the top is here because this is zero this side this is zero this is one this is two and this is three next pft fill screen block so it basically set the background to black next we set the text color to white so as you can see this hello from text tinker is white we set the text size to 1 so it's very small and we set the cursor or the location of the text in pixel 10 this is x and this is y so this is 10 and 10 and we set the text to be displayed next we change the text color to red we set the text size to 2 and we set the cursor to be displayed at 10 and 30 and we display the 2.4 tft display now let's load the next example it's graphics or some shapes in here we draw a circle with center in 120 this is the center point this is x and this is y this is the center and this is the reduce and this is the color let's upload first next we fill the circle we make a circle filled with color so it's same location but with different radius in green color as you can see this one this is the green color and next we draw the triangle in location this is the first point this is the next point and this is the third and using a cyan color next sketch that's green so here we will test the touch screen so let's load it first upload disperse so it's the same we just need to use this this is for the initialization of the touch screen in here we are checking the touch points so basically this ts point gets the x and y coordinates of the that's of the touch point and it gets also the pressure so here we get the pressure so if it's inside the limits of minimum and maximum pressure it means that the certain point is stats then we get the x and y coordinates this one if the green area is starts we will set the touch variable to one if the touch point is in the red color or red area we set the touch variable to 2 then here if the touch variable is 1 we can turn on an led here we display where the location so if we touch the green one led on it will print number one as you can see here it prints one using the empty.print and we set the touch variable again to zero delay for some time this is for the bouncing we check the touch variable again if it's two it means that the led up is being pressed then we print zero that's that's it like that as you can see next let's load the port example microsd so this is loading a pile from microsd card so it's the same but it's just using sd libraries so these are pre-loaded so you don't need to download this one and let's upload this where is the code this one so it writes this one to the microsd then it will read the whole test.text so as you can see this there are many texts i set it very small so let's try if we can put it bigger text size to 2 let's upload it again and let's see if we can see the results no there's so much i cannot show you because it's more than already because anyway it's working next let's upload this explorer let's upload this one this is the last example so this loads different bitmaps or bmp piles to the lcd so it basically draw different bmps yeah this one is first youtube next is my is the logo of tecto tinker next is the subscribe next is another logo tecto tinker and yes like comment share and subscribe so that's all for now if you enjoyed this video please give me thumbs up and share this to your friends it will motivate me to create more videos like this if you happen to have some questions or suggestions be sure to write it in the comment section and i will be happy to answer it you may also visit my blogs of this video attack to tinker that blogspot.com and if you are not yet subscribed to this channel subscribe now thank you and have a blessed days ahead see you in the next video bye foreign
Info
Channel: TechToTinker
Views: 70,464
Rating: undefined out of 5
Keywords:
Id: D3lv0eySz8A
Channel Id: undefined
Length: 17min 5sec (1025 seconds)
Published: Tue Aug 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.