 So this is a temperature humidity sensor sometimes called DHT sensors there's like a bunch of different models blue white whatever they all have different accuracies and all that but what they do is they look for temperature and humidity and give you with those numbers when we went over water sensors in this recent video I want to take my sensor and slowly insert it into the water as I'm putting it into the water you can see it going between medium low high just jumping around we saw that when water was touching the sensor and when air was touching the sensor it would go between those so let's say 20% was water and other 80% was air it would give us a reading that would be able to tell the water height and how much water was in that water bowl on that sensor when air was touching it it was saying that there was no water in this case we're trying to sense for water in the air so we have to go with something a lot more sensitive and inside this blue piece are here stick with me for a second it's a bit of a weird analogy but pretty much have a burger you have two buns and then you have a big piece of meat inside the way the humidity sensor works is very similar it has two electrodes that put out electricity and in between them to have this like absorbent material that isn't too resistant to electricity on its own and when there's water in the air it gets soaked into this very sensitive very absorbent tiny tiny tiny little fabric and through that and seeing how much electricity is flowing through and how resistant or how not resistant it is it's able to give us a value that we can turn to a percentage for humidity in the air one thing to note is if you're ever getting zero or a hundred percent something's probably wrong unless you're underwater or you're in space the temperature of sensing part is called a therm resistor which stands for a thermally sensitive resistor and it's actually super sensitive what i think what i found with this one is when i was testing it let's say here on the desk and then i would take it like to an ac and put it right in front of the ac with cold air coming out it took a bit of time to adjust to that cold air it's almost like it was hot and it took time to cool down like i started at 23 celsius and every second it would drop about 0.1 0.2 and then about a minute or two later it would get to the actual temperature that was coming out at the ac the humidity though was accurate the whole time what you're going to need for this project is your sensor you're going to need a couple cables here i have three of them since mine's a three pin if you have a four pin or a different model maybe it's white not blue just look for an example on how to wire it up if you don't have a board on yours and it's just a blue piece most likely you're going to have to build the board yourself like put a resistor and do all that i'll put a picture up on the screen what that looks like and if you have one of those i can always give you a link to a good example that can teach you how to do that uh you don't need to have one but i'm going to use a breadboard just for simplicity instead of sticking the cables straight into the sensor i'm going to stick the sensor in the board and then from the board wire the cables to the arduino which we have right here we're going to be using the same one as always in arduino uno and then just a power cable to go to the pc you got three cables we're going to be using blue for ground red for power and brown for signal look at our sensor let me focus it we have an s here on the left so that means the first cable is going to be signal and then usually it's followed by power and ground if you're using a sensor always check which one's which because it would be really bad if you put power into ground and ground it to power so we're going to plug in our signal cable into the first port take our red power cable into the second one and then grab the blue one and put it into the last now that we've done this we have our cables set up we're going to plug in the blue into ground on the board there's two ports here we're going to plug in the red into the five volt and then we're going to plug in the signal into digital two you can use analog but for this example and the kind of code we're going to write we're going to use digital once you get all that just plug it into your computer open up your arduino editor and then we could write some code all right now that you have your editor open you're going to have to do a couple different things first make sure you're on the right board i have an arduino uno so i chose that one make sure you're on the right port so when you plug in your arduino and you check your port usually you'll tell you which one arduino is plugged into and then you're going to have to go to manage libraries and download the dht library so you just type in dht all capitals and this is the one we're installing right here it's by adafruit dht sensor library i'm using 1.3.10 doesn't really matter which ones you use but you have to make sure it's this specific one or else the commands we're using are not going to be accurate once you install that you're ready to go now we have to just declare a couple things so first we're going to include the library that we just installed and that's dht.h make sure you wrap this in quotes then you're going to have to define a couple things we're going to define the pin we plugged in our sensor to so we'll call it dht pin and we plugged it into port number two and then let's define the type of dht sensor we're using this is important for some reason i'm guessing just on how it reads data so if they go dht type and that's going to be dht 11 according to the library it has to be written like that with capitals and all that next we're going to actually activate the library so we're going to tell it dht again dht and then in here we can put the information that we have so the first thing would be the dht pin next thing will be the dht type you don't actually have to declare the variables you could just put it straight into here but it's good practice in case you ever need to grab those numbers again it's also easier then in our setup we're going to have to do like always serial dot begin this activates our console and then we tell it to run on this frequency or this band dht dot begin dht dot begin is going to activate the sensor or at least the code that's going to be checking the sensor and then in here we could just say started to look for temperature let's say now we can start our loop first thing we're going to do is add a delay so that every time it loops it has to wait let's make it two seconds there's actually a rated delay for these sensors that says you should be waiting over two seconds two seconds is like the lowest you should be going some people do five seconds but for the demonstration i don't want to wait five seconds every time i see a number so we'll put it at two then we got to capture a couple floats if you don't know the difference between a float and an integer floats are decimals if you still don't understand i'd recommend maybe looking at data structures a bit we're going to read humidity then we can go and capture the temperature in celsius since we're in canada but for you americans we'll go and capture in fahrenheit as well so all we have to do is call read temperature and if you put true or you put nothing that's what tells you if you want celsius or fahrenheit then all you got to do is just print all this stuff out it's a good practice to check and make sure that you're not receiving something that isn't a number and all that so we'll do that quickly so this is best practice but what we're doing here is just checking that these are actually numbers and we're not receiving something broken because if we are receiving something broken we want to tell the computer that or at least tell ourselves that so we're just going to print here a message letting us know and then we can say else and here we can actually print out our temperatures all right so what i wrote here is print h then make it equal to humidity and then we add a percentage sign at the end then we do a bunch of spaces to separate the temperature which we check for celsius and for fahrenheit and we split those up again with a couple spaces just to make it all nice on one line then all you got to do is compile it and upload it to your arduino and then we should be able to just open up looks like we made an error here just fix that looks like we made another error here my god all we got to do compile that and upload it all right now that it's uploaded you can go to your tools serial monitor or control shift m and there we go we have our temperatures being printed out on the screen i'll turn on the ac and i'll take this to the ac i can't show you guys on the camera but just pay attention on the screen and look at the values and how they change see how it's dropping every couple seconds and but very slowly that's what i was talking about earlier how it takes a couple steps to drop in temperature it's almost like it's hot right now and it needs to cool down over time so that's how a temperature humidity sensor works if you have any questions any concerns anything you'd like to see in the future please do comment below if this video helped you out you enjoyed it anything like that or you just want to help me support the channel give it a like and maybe subscribe to the channel if there's anything you'd like to see in the future thank you so much everyone for being here and i'll see you in the next one