 In the last couple of videos, we went over different layers of a watering system that we're building. We used water pumps, electrical valves, pressure sensors, flow sensors, motor drivers, relays, and more. But every time we had to show some data, we did it on a computer in the console, which in real life, it's not efficient or realistic. When you go to use a microwave or an oven or any type of electronic, you don't plug your laptop into it, put in how much time you want, and then use your laptop screen to see how much time's left. Everything's built in to that thing. So microwave has a screen built in, with keys built in, everything is all in one. So I want our projects to be the same. And to do that, you're going to need something like this display right here. This is the new 1.9-inch WaveShare TFT display. In previous videos, we've done OLED and TFT displays, but nothing as big or as nice as this. Here's for reference, a difference between an OLED 0.9-inch screen versus a 1.9-inch screen. It's crazy how much bigger this thing is. And the nice thing with a TFT display like this is it's 170 x 320 resolution, so things will look pretty good, comparative to how big it is or how small it is. And the pixels can put up to 250,000 different colors, which is a lot for something this small. It's impressive because something like this has everything built in on the back to connect it directly to an Arduino. With basic code, you can get things on the screen. It even comes with a wiring harness to make connections super simple. You just plug that in the back there, connect these wires to your Arduino, and then everything's done. We're gonna be using this to display things like the pressure sensor information, the water flow levels, how much water we put out in total, is the pump on, is the pump off, everything I want to be on this screen, all kind of important information to be shown on here. Let's get started with connecting this up with wiring to the Arduino, and then we can write the code right after that. For our specific demo, all you're gonna need is our TFT display, a digital temperature and humidity sensor, any Arduino or microcontroller. Let's get started with the display first. We're gonna connect up the wiring harness to the display so we can connect the wiring harness to the Arduino. In our case, our wiring harness comes with female connectors and not male connectors, so we can't directly plug these in to the Arduino. So we're gonna need some middleman wires to change that. So then you can lay down your display and kind of sprout your wires and see what everything is. It's written really small on your board, so I'm gonna put a picture up on the screen so you can follow my wiring diagram yourself. But in our case, our bottom one is VCC, and then above that is ground. And we're gonna take those two. I'm gonna grab two cables, one for power, one for ground. And then we're gonna plug power into 5V on the Arduino and ground into the ground port right under it. After that, we have DIN and CLK. According to the picture, DIN plugs into D11. So we're gonna take that and plug it into 11 on the digital side of the Arduino. Make sure your connections are nice and good. Then our next cable is CLK. CLK, the picture says it plugs into D13. So I'm gonna take that, plug it into D13. Then after that, we have DC. And DC is going to plug into D7 on the board. After DC, it looks like we missed one, CS. CS is just going to plug into D10. Then after DC and CS, we have RST and BL. So first I'm gonna start off with RST, which goes into number nine. So RST goes into D8, and then BL goes into number nine. So one more time, I'm gonna put the picture up on the screen. Just take a minute, pause it, make sure your wiring's all good. And then we can get started with connecting our temperature sensor. For the temperature sensor, it's pretty simple. It's got a three pin here. Some of them have four pins. Some of them are white. Some of them are blue. So if yours is not exactly like mine, just check quickly the specs for that. But these are called DHT sensors. Mine has three pins. The first pin is signal. The second pin is positive, and the last pin is ground. Signal will be going into digital two. Positive will be going into 3.3 volts, because five is being used by the display. And then ground will be going to ground. So now we have our screen and our temperature sensor all plugged in. Now plug your Arduino into the computer, open a new file, and let's get started with the code. And I'm just gonna take the display and find a way to kind of set it up. For the code, we're gonna be starting with an empty file, but there's one thing we have to do that we haven't done in a while, which is include libraries. The reason for this is because the people who built the temperature sensor and the display did a bunch of work and put a bunch of electronics to make our lives really easy. And they wrote the code for us to simplify it so that we can use their devices without any headaches. Like I showed you before, on the back of the display there's a bunch of electronics, resistors, a logic board, everything, so that when you plug it into the Arduino, it's good to go. You don't have to build any of that yourself. Same thing for the temperature sensor. Now, when you run this on the Arduino without any code here, just including the files, you're gonna get an error. That's because you don't have these libraries installed to your computer. So you gotta go left over here or to sketch, include library, and manage libraries. And then you gotta go and install each one of these libraries one by one. So Adafruit GFX, then you gotta install Adafruit ST7789 for this specific screen if using a different one you need the program for that. SPI and DHT. One thing to note, I was having a hard time finding DHT. It's actually DHT Sensor Library and it's made by Adafruit. Once you have all that installed, you're good to go with the code. Just make sure you can run it and then you're not getting any errors and then you're good to go. Then we're gonna do what we always do which is declare the pins for what we're using. So in our case, we're using a DHT Sensor on pin number two. And then here we're saying what kind of sensor it is. I think mine is 11 because it's blue. Yours might be 22 if it's white. Just check that out and then set that here to whatever it is. Then we're gonna have to declare our library and turn it into a variable called DHT using our information that we filled out here. Next step is to do the same thing for our display. So we connected CS to 10, RST to eight and DC to seven. Using that, we can go down here and we can set those variables and make one called TFT which is what we're gonna use for our display. In our setup, we're gonna have to set everything up. So serial.begin, this is our console to put out errors or any information we wanna do. This is what we've been doing the whole time. The next step is to declare our display. We use TFT init and TFT fill screen and black to clear the screen, whoops, to clear the screen to all black to make sure that we're starting with a fresh new screen whenever we run the code. Since this is gonna run as the first thing every time you restart Arduino. One thing you should note is if you do 320 times 170, sometimes you will get issues I did when I was using this. So I usually do 170 and then 320 after. And then the last thing we need to do is tell our temperature sensor to start collecting information, which is DHT.begin. Then in our loop, we're gonna have to do a couple different things. To put information on the screen, we're gonna first have to read it from the sensor. So we're gonna put this right here. This is going to read humidity and temperature from our DHT sensor and store it as two floats. Then we don't need this. This is just for testing. And then this is just for testing as well. After that, we're gonna put a little if statement that is just, then we're just gonna put an if statement to check for errors. This is just good practice. We're gonna say if humidity or temperature isn't a number, let the person know in the console that it failed to read a number from the sensor. And then return is just saying exit the program. If we made it past this, we know we can go on to the next part, which is starting to put things on the screen. When you're putting information on the screen, it's kind of similar to how you print things to the console, serial dot print line. Here we're doing TFT and then we're gonna do print for whatever we're printing. So we're just gonna start off clearing the screen all black just to make sure that there's nothing on it already. Then we're gonna set our cursor. All this means is we're picking two pixels out of the 170 times 320 where we wanna start writing or showing something on the screen. So in our case, two by two, it's two pixels up and two pixels left. So it's a tiny little starting point down here. After that, we're going to set text color to white. And since our background is black, white is gonna show very well. You can put this to other colors. Then we're gonna put our text size, which I put the two, you can put it to whatever you want. I'm probably gonna put it a little bit too big just so you can see on the screen what I'm trying to show you. After that, I'm going to print temperature first on the screen. So first I put temperature, then I put the actual number and then I put C for Celsius. After that, I'm gonna repeat the same thing but for humidity. So humidity, the actual number, and then percent. And then as always, at the end, end, end, we're gonna put a little delay of two seconds to update everything over. So every two seconds, we should be getting a new reading on our sensor. Now we can upload that to the board. You should see the board flicker a little bit, which is normal. And then you can see we're starting to get something on the screen. I'm gonna try my best here to focus the camera on the screen. So you can see temperature is 23.1 degrees and humidity is 24%. This is pretty accurate to what it actually is in this room. One thing I wanted to try was if we took the screen and we put it down, see if that's even possible. Okay, we'll just do that for now. I wanted to see if I took a lighter and I started blowing the lighter in the direction of the sensor, can I get the numbers to change? So let me just focus this here. You can see slowly the temperature is climbing. I'm guessing the sensor is not super sensitive to make sure it doesn't go up and down like crazy. But we got it up a degree, almost a degree and a half. Humidity is staying the same. Oh, humidity is starting to go up. Humidity at 40%, temperature at 27 degrees. And when I touch your sensor, it doesn't feel too hot, so that makes sense. Now we'll put the sensor or the flame on it just for a second here. Look at that, humidity 95% and temperature 34 degrees and I can smell the plastic is burning. So we know it definitely works and it updates super quick. We can also go in the code just to try it out and let's say change tech size to four. So twice as big as what it currently is. The board is frozen. That's gonna update and then boom, look at the size of that now. Obviously this is really hard to read. So what you would do is change the orientation of the screen so that it writes it across or you make some kind of scroll wheel or shortened the names to just T and H because we know what those are. But that's how you use a TFD display to display your information from whatever project you're using. This is gonna be great in the water project where we can display all kinds of information we're getting from the sensors, the motors, the motor driver, the relays, everything we're using we're gonna be displaying on the screen or on a type of screen so that we can see it from there. If you enjoy content like this or if you wanna see a dedicated video on this TFT display how to draw things, how to use colors, how to make graphs, maybe put pictures, let me know in the comments. If you like these kind of videos subscribe to the channel because that supports me in making more of these. I think about 98% of people who watch these videos don't get notified on the next one because they aren't subscribed. So when you subscribe, it lets you know and that helps me out a lot. If you have any questions, concerns, comments let me know in the comment section and if not, I'll see you in the next one.