a

DHT11 Temperature & Humidity sensor with Arduino - Tutorial

hi Ivan here from brainy bits calm today

I'm going to show you how to connect a

dht11 temperature and humidity sensor to

an Arduino what we have here we have an

you know but you could use a mini a

micro whatever you have on hand so let's

make the connections I'm going to use a

breadboard so you can see the

connections a little bit better so I'm

going to put my sensor right here as so

and we're going to start by making the

ground connection from our Arduino to

the negative pin of the sensor right

there and then I'll do my single pin to

analog zero or a zero on the uno to the

center pin of the sensor like that and

last it's going to be the voltage so

five volt to the plus pin on the sensor

like that and that's it that's all the

connections we need to make so we're

going to go to the computer screen to

look at the code and then we'll upload

the code to our uno and start receiving

data from our little sensor here that we

can monitor and the serial monitor so

we'll be right back okay so where we are

this is the old code right here to get

the information from our dht11 as you

can see here at the top we have an

include library and you need to download

that if you're on youtube find the link

below and if you're on a website you

should see the link so basically we put

that library in our app where we install

arduino in the libraries folder so

arduino libraries and it's a folder so

DHT and inside you'll find two files

which has the information to actually

access our

humidity and temperature sensor so after

that we're going to go ahead and define

an analog pin we connect it to a zero so

we're going to say a zero here but you

could change that to any pin you you

connected to the middle sensor pin to so

that doesn't you can change that to

whatever you want as long as it's an

analog pin and here we have the set up

to basically output and prepare for the

serial monitor so we're going to say sir

you'll begin 9600 so that's our speed

we're going to give it a delay of five

hundred so five hundred milliseconds to

you know let the system boot up and then

we're going to put we're going to print

a title to our serial monitor

you know the HT one humidity and

temperature sensor so that will be the

title that will appear when we open our

s serial monitor

then another delight just wait another

like a second just before accessing the

sensor and we'll n set up here now this

is the main part of the program right

here from void loop and it's very simple

since we're using a library everything

that all the prior all the program is

basically in the library so we don't

have to put it in here so it's a lot

it's a lot easier so we're going to read

the we're going to say DHT read dll it's

a pin so that's our a 0 up there then

we're going to do a serial print current

humidity which is a title equals to

serial.print DHT humidity so that

information is going to be from the

sensor itself and we put a percentage

sign after that because it's a

percentage humidity and then serial

print the temperature equals to DHT

temperatures temperature sorry and

Celsius now you can always change the

Celsius to

tonight by doing the calculation to

actually convert from Celsius so you

change for an F here and you put that x

or divided by something the delay after

we did all this so we put a delay of

five seconds so we wait five seconds

before accessing the sensor again

because the sensor I think get the

fastest you should accessing is every

two seconds since it so there you go

that's all you need to do to integrate

one of these little sensors into your

future projects so once again thanks for

watching my name is Ivan and I hope this

helps someone and I'll see you next time