Arduino Tutorial: 1.8" TFT Color Display ST7735 128x160

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I've tried several displays to use with Arduino and one of my favorite is the 1.8 inch TFT color display with the SD 7735 driver if you're interested on getting this display working I'm going to go over a few things you should know and give you a few example sketches that I use as templates for my projects I found a few different modules for this display but these two are the easiest to connect because they support 5 volts and it can be connected directly to Arduino but this one has an uneven backlight making the text look brighter on the bottom so I prefer this one the third module also doesn't have this issue but it only supports 3.3 volts logics so you need to add a bunch of resistors to the i/o pins plus a 50 ohm resistor for the backlight to 5 volts I try all the libraries I could find for this display and I think the ucg library is the best for most situations although it's kind of slow the other four library is much faster but only if you use the basic font that looks pixelated depending on the requirements of your project you can choose which library to use one of the issues when searching for a good library for our display is to have a way to refresh the text we then include a background to clear the previous stacks automatically if you try doing it manually by drawing a box before printing the text is going to flicker the adafruit support this background only when using the basic font so I usually prefer the ucg library first I will go through the code for the ucg library and later I will show how to use the Edit fool the links for the libraries and my sketches are on the description the display uses the SPI protocol so we have to connect by IO pins plus the power and the back line we are going to use the hardware spi so two pins connect in different places depending on your poor anyway we first include the library and then create the display the finding the pins I always create a variable to show an increasing number in the setup you can change the type of the background for the text I recommend you use solid background or it's going to look like this this clears the display set orientation and text orientation here are listed my favorite fonts and I choose this one for this project printing things on the display takes time so it's better to print on the set up the things that don't change to avoid printing them all the time that way the loop is going to run faster on the loop we increase the variable and convert it into a string to have the right alignment here you put the amount of digits and here the amount of decimals we first print the variable without modifications so it's going to align to the left but the issue is that when it goes from 150 to zero the other two digits are going to remain because we are not longer printing a background over them so the solution is to print a space when the available is under 10 and do the same if the vert falls under 100 now to print the verbal with the right alignment as much as here because it writes the background for all the teaches all the time so there's no need to add empty spaces and that's it for this library but as I mentioned the refresh rate is not that great for that reason I sometimes use the Adafruit library when I have to print a lot of dynamic things and one a higher refresh rate to use the other full library you also need to download the GFX library we include the libraries and declare the pins in here I add a custom font which is included on the Adafruit Library this is optional because by the photo library uses the standard font but I wanted to show an example of using both type of fonts so you can see the difference there are a few fonts that you can choose from that are listed in here in the setup section we initialize the display fill to a black set orientation and disable text wrap to prevent the text from going to the next line when they go offer the limits of the screen you can remove this slab if that's what you want now we print everything on the display that's not going to change which is practically everything except the numbers we set the color which we have a few ways to specify one way is to write here one of the basic colors on this list but if you want another specific color you can go to a website like this one and select the color you want and copy the 16-bit code we set the size of the text so far we are using the standard font so this will scale up the same font that's why it looks pixelated and finally we print the actual text in here start using the custom font I mentioned before so the text looks modern we print this text and go back using the standard font a bunch of shapes as with the other sketch we increase the variable and convert it into string to have the right alignment we're going to print the variable but this time we set a background color so it overrides the previous text without a background this is how it will look like but when we go from three digits to one the last two digits will remain showing so you need to check how many digits are and when there's less than 10 we print up black box on the second digit if it's less than 900 print another black box in the third digit this is basically the same thing we did with the ucg library but this time we use black boxes instead of spaces bring this string to have the right alignment just like we did with the other library now I'm going to print the variable on the bottom using a custom font the problem is that it doesn't support the background color so we need to draw a black box over the alt text before printing the new one that's why flickers you can choose any other three ways to print values but I recommend this one with the right alignment does it for now and let me know what kind of projects are you going to build with the display good luck and bye bye
Info
Channel: InterlinkKnight
Views: 155,251
Rating: undefined out of 5
Keywords: 1.8, Display, lcd, tft, color, ST7735, ST7735S, ST7735R, 128x160, SPI, library, arduino, tutorial, ucglib, adafruit, InterlinkKnight
Id: NAyt5kQcn-A
Channel Id: undefined
Length: 6min 39sec (399 seconds)
Published: Fri Jan 19 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.