How to Set Up the DHT11 Humidity and Temperature Sensor on an Arduino
Вставка
- Опубліковано 8 вер 2024
- How to Set Up the DHT11 Humidity and Temperature Sensor on an Arduino
This video will show you how to set up the DHT11 humidity and temperature sensor on your Arduino. I talk a little about how the humidity sensor works, and how to set it up to output readings to the Arduino serial monitor or a 16x2 LCD display. Then I show you how to modify the program to output Celsius or Fahrenheit. Leave a comment if you need help!
Get a DHT11 here: www.amazon.com...
The example code and more details about this project can be found in the article at: www.circuitbas...
Check out the Circuit Basics blog for articles and tutorials on the Raspberry Pi, Arduino and other DIY electronic projects! www.circuitbas...
Facebook: / circuitbasic
Twitter: / circuitbasics
Instagram: / circuitbasics
Finally a tutorial that works. You would not believe how many I have gone through.
@BaconMasterT_YT you should check out BV3D, they have great tutorials, too. :)
I've went through at least 10 different ones
While using the LCD, you should use I2C module so that the connection becomes simple because we only need 4 pins (including VCC and GND)
watch any video on on youtube for more convenience
this is literally the only video on youtube that has the download to the needed library, liked :D
worked! I had a problem as it was my first project. asked me to change port and I randomly picked a wrong one. So once I changed it its working normally! thank you. easy for a first project ;)
Great video to get the basics of the sensor down. Especially with the info on your blog page. Thanks!
Using mine to control the environment in my snake enclosures via a mister and small computer fan.
I got it working. I am not sure why arduino IDE wouldn't accept the library but anyhow it did in the end. I am happy now.
how did you fix the problem
How do u fixe it ??
how did u fix it tho
Thanks by thousand dewde... I was stuck on the step to display the temp and the humidity on lcd and finally succeed retrying all the plugs now it works !!!!!!
You deserve a thumb up :)
Some DHT11 has signal pin in middle and ground on left and VCC on right.
I have that too.
Thank you so much from Italy! My thesis can now progress. Your help is greatly appreciated.
In case anyone is wondering how to convert this to fahrenheit, you just change this line---- lcd.print(DHT.temperature * 1.8 + 32, 0);
why would anyone possibly want to convert it to none sense
Hi, I have selected the serial. When I see the serial output, I am getting the display as given below:
emperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
Temperature = -999.00
Humidity = -999.00
What went wrong ? Can you please help?
pari20099 Hi, you put the delay which is 1000 to 2000 then it will work
i have also tried that but this isn't working i am getting the same response as-999.0
@@shadahmed7310 he mean 1000to 2000 but not included 1000 and 2000
let's try 1500. or maybe the cable s damaged
@@CauseImYourFat I know bro I tried it but later on I found out that there was an issue with my DHT11 Sensor . btw thanks for help.
Your code is wrong
Putting the delay to 2000 fixed this for me thank you
works fine for me using Uno with serial monitor. However, have yet to try out the LCD version. Bravo.
For anyone working on this. If you set it up with the LCD like in this video, I used a 2k ohm resistor at pin 3. I tried to follow his tutorial with the potentiometer, but mine was broken.
Bro to set up an LCD it is a little pain and patience, if you have JHD 162A. This quick tip can work flawlessly.
After connecting all pins successfully, and make sure you soldered it right and your LCD is still alive; test it by powering it's last two 15,16 pins or first two 1,2 with 5v.
Now if the lights but shows nothing on screen then we can began because pin 3 is alone responsible for displaying anything over it, until then your project will look useless though program must be running just fine. So, here what you do in the code
create an integer value after including the LCD library and the Sensor's Library.
eg.
int Contrast=20; // keep it this much for good visibility, the more you increase this value your text will go more blurry.
NOW!
in the void setup() {
analogWrite(6, Contrast); // here you used the pin 6 of Arduino board as a digital potentiometer.
}
* So what actually you did, you used the reverse technology. Instead of limiting the voltage via a potentiometer you are actually giving a controlled voltage via PWM pins of uC board.
as you know PWM is a digital mimicry of natural Sin Wave. So we created an integer and set it's value later we analog write it and it works quite well. Make sure your connections are correct and you might need to reset the controller quite some time everytime the wired connections are loose. Hope it helps! Later!
and yeah connect the PIN 3 of LCD to PIN 6 of Arduino. *MOST IMPORTANT STEP* my bad i forget to tell you this :D
If you get the -999 error make sure you've connected the pins of the DHT11 right, some sensors have the + - and signal placed differently than the sensor used in the video.
or you can change the delay to 2000... I was having this issue but when I changed the delay to 2000 it stopped showing -999
@@yasinr9233 OMG, thank you so much
Dude...thank you so much!!!! I followed your instructions to the T and everything went well!
I just had the same issue if the delay time is too low it will blink 999 on the values. I set it to 1500 and its working
That library version is not working well for me, insted i used version 1.2! :)
Thanks for the useful video! May I ask you, why between correct readings I receive this reading? 12:43:40.127 -> Temperature = -999.00
12:43:40.161 -> Humidity = -999.00
you should just put the delay to 1500 and everything should be fine :D
@@Gargamilk I receive the same error , I've put delay to 1500 and still the same thing
Same :(
delay(2000) works for me.
if it is not working try checking if it is in pin 7 or if it is on 9200 on the serial monitor and if it does work, but it has 999 in the middle then put the delay to 2000
Thank you so much bro! i couldn't find my mistake and you helped me good video!!
connected it correctly but prints -999 and my DHT11 melted,any solutions?
If you change the delay timing to 1500 or more it will allow the display to update less frequently. Not sure about the DHT11 melting, although my first time assembling it I thought "I" had it right but no display appeared. Turns out I had one of the "pot" wires in an empty hole. Moving it over it worked perfectly. I'm guessing you have the wires reversed for the DHT11 power connections.
i changed it to 5000 delay and it wont work
@@lexumi5161 Setting the delay to 1500 helped me with my -999 issue.
Thank you for this demo
Hi! finally something I can understand! Sorry I'm a super beginner on electronics.
I followed the steps but the "Serial Monitor" only shows "-999" value on both Temperature and Humidity. Do you know why?
Sounds like something may not be connected properly... Are you using the same pins I used in the video?
+Mónica Rojas Restrepo You've prob done it now but yes you've got your dht wires wrong way round. Been playing myself and same thing - until I swapped the + and - around (it sure got hot at one point!)
+Mike Mo yes, it was that. thanks
We all are beginners in the beginning. Live and learn! (i gotta get that tattooed on me someday)
how was the -999 problem solved...?
Why does the temperature only display in 1 degree increments, can you make it display a more accurate reading like 26.48?
Have joined your channel as I found your tutorial easy to follow and very helpful thank you Bob
Hi I have a problem about the humidity it shows me like this
Temperature = 32
Humidity = 9.00
Temperature =32
Humidity =9.00
Temperature = 32
Humidity = 9.00
Temperature = 32
Humidity =9.00
Can you tell me please what i should do
I have the same exact build, same code, and good readings. However, I am having trouble trying to convert Celsius to Fahrenheit. I know the formula for conversion is ((C*1.8)+32), but I having difficulty where in my code I need to place this. Any help would be appreciated.
my board its uno when i put to upload the program on my arduino i get error compiling for arduino uno genuino .so pls where is the problem thanks
check that the code is exactly the same as the one showed in this video, and also that the zip library uploaded is also the one that is being used in this video. Regards!
yesss. this is exactly what i needed. but i will measure insidse a fridge so i need to go lower than 0 celcius degrees. as far as i can see dht11 supports only between 0-50. so i guess i'll be using dht22 right? will the code be the same for dht22? also the goal of my homework is to transfer the data to my computer wirelessly from the sensor. how can i do that? thank you.
my sensor just prints -999.00 for both temp and humidity. send help.
mine also
Make sure you use the right code should be under "DISPLAY HUMIDITY AND TEMPERATURE ON AN LCD"
give more delay. 2000 will be good. give more time gap to access the sensor.
check ur connections
+ go for 5v and -ve go to ground and the left one go to pin
change delay from 1000 to 2000 , it will solve your problem
Can I use arduino nano instead of uno
Yes
Values of the resistors?
Really great, thank you very much
thank you very much this worked perfect for me!
Great video!.... do you have videos were you take it a few steps further? The Arduino reads the sensors values. A threshold is programmed to initiate a Digital out pin to energize a relay, in turn opening a water valve, and driving an actuator that opens a damper/ turning on a fan.?
Nice video and article,
Thank you..
thank you sir . it was helpful
Yes it is
Nice Tutorial
Hi Guys, you have to change the delay, just put it in 2000ms. it will work!
Does anyone know of a way to port all the recorded information into an excel sheet or anything like that?
Hey thanks for this great video!!
I’ve added a second relay and if and else statements and an additional output pin for a total of 2 commands but can’t get the second output pin to energize the second relay. Any suggestions?
Nice Video Sir!, btw hows the arduino Sir? is it still working ? Iam confused whether i should choose arduino or plc for controlling air temperature in farm and turn on the spray or other stuffs if it is too hot
Dude really helpful thank you 👍🙂
very useful.
your tutorials are fantastic.
thanks for the codes on you website.
how about if temperature above 100 degree celcius ?
hello, sir why connecting the dht11 signal wire to the digital pin instead of the analog pin?
i know that the digital pin gives just two values 1 and 0.
I am a bit confused, you seemed to have changed your web page (2.30 mins into the video) for this project as there is no library file to download from your link - it only goes to the Arduino Playground page with no obvious way forward or to download the .zip file
How much long the wires could be between DHT11 and the arduino (max possible length of wire for accurate readings)??
what resistors were used ?
Absolutely brilliant, thank you
Quick question, whats with the chk variable in the code? Ive been digging it AND the library and i dont see it referenced again anywhere
Hello brother this circuit make with volt and current meter means volt amp Watt and temperature show on one display for 5v
Please make a More video
I'm using the exact same program with the exact same library having connected the 4-pin sensor exactly the way it's connected in your site.For some reason both the temp and humid readings are -999.Can you tell me why?
I have to a potentiometer to it
How to connect that this
Hi
I would like to know if the humidity sensor would be able to withstand a very humid airflow (95%) for at least 1 hrs ??
it will, just make sure it does not get soaked
Hi it read 33 degree celsius. but supposedly the real temperature of my room when i check using room thermometer is 30 degree celsius. How do I adjust it?
Why do we connect the sensor to a digital pin? Dont we have an analog signal from the sensor? Im confused
Hi, I have tried to run this example with the similar setup as given in the video. But I am getting this error message. Arduino: 1.8.7 (Windows Store 1.8.15.0) (Windows 10), Board: "Arduino/Genuino Uno"
Sketch uses 4300 bytes (13%) of program storage space. Maximum is 32256 bytes.
Global variables use 239 bytes (11%) of dynamic memory, leaving 1809 bytes for local variables. Maximum is 2048 bytes.
Please select a Port before Upload
Can you please help?
Tools > Port > choose whatever board you have
When I try to go to your website it says there is an error connecting to the database, I'm not sure if thats a problem on your end or mine but when I looked it up most things point to the service provider or owner of the website. Just thought I'd let you know. Thanks for the tutorial.
Hey there, thanks for the video.
I have some problems, when I copy the code and run my dht11 is overheated pretty quickly and on the serial monitor it only show -999 for both temperature and humidity.
your dht11 might be backwards happened to me first time too, as for the -999 issue, try setting the delay to 2000 instead of 1ooo.
hope this helped,
ben
datasheet said it provides a 40bit data with decimal on Humidity and Temperature, how come the sensor only ever displays whole number?
if i want to use the output of the dht11 to turn on a 5v fan, what is the wiring? i had it working with a mosfet and a 12v, but i want to eliminate any extra components. just on and off based on humidity, don't need speed control.
Thanks man
Hi sir!
How will I set temperature and humidity by using push button? Please help me.
Thanks in advance.
Question....The dhtt22 working great so somewhat...they are about 10 to 20ft away and I tested voltage. the voltage on the far one is 4.9v. one problem I am having is that sometimes the the temp drop from 70 degrees to 51.1 degrees. is there a way to correct this problem?
how can send the collected datas to my mobile or bluetooth device or any I2C module interface something like that?!
i keep getting an error where i get -999 and dont know how to fix it
same
Same
Not same u baka
how many programs can you upload to the Ardiuno Uno card? if many, can you flip between two programs with a switch?
mine still says -999 for all. tried everything. PLEASE HELP!!!
sensor not working replace ut
just tried it, it would have the accurate reading then switch to -999 after one second, to fix this change the delay at the bottom to 5000, incase you didnt know 1000= 1 second.
@@yiannikir9674 Many thanks brother, that fixed it for me, but id like to know why does that work?
@@crimsonhero6683 The sensor probably cant read the temp/ humidity in 1 second, so if you put it at 5000(5 seconds) it probably gives it time to do its thing. If his sensor worked, its probably an expensive one.
Hello . Thank you for your wonderful explanation.
I have a question:
Are the sensors like LM35 and DH11-22 accurate and reliable?
Are it need to calibrate?
thank you
Hello..
I got a task from my advisor to make a relation grafik temperature and voltage and a relation grafik relative Humidity and voltage use DHT11 sensor of arduino, but I don’t know the way.
How to show temperature, relative humidity and voltage simultaneously. It’s can be shown simultaneously?
DGT 11,how to save data in Microsoft Office Excel Worksheet? plz help me
what if i want to power it by a battery what changes will be added to the board
Excellent
We're getting zero for both values...what to do??
My connections are as per the video, properly given.but I don't y it is showing 999 for humidity and temperature...
my lcd display is flickering and idk what to do please help
good job
still using this vid in 2021! lol!
Can i ask where`s the potentiometer from the LCD video guide?
Hi,is it ok to use the SDA and SCL pins in the lcd?
I want to put a better delay like 200 or 400 but i keep getting this -999.0 is that because the sensor is too cheap ? I that because de arduino cant calculate this fast ?
Hello. I need a block diagram of this project. Can you help me?
having a problem it says that Arduino: 1.8.6 (Windows 7), Board: "Arduino/Genuino Uno"
sketch_aug11a:1:17: error: dht.h: No such file or directory
compilation terminated.
exit status 1
dht.h: No such file or directory
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
please help
how can i output the average readings from DHT11 using Arduino uno
bro i got some problem when its read second time its like 999
and then its back to normal
so its like
temperatur 32
humidity 70
temperatur 999
humidity 999
temperatur 32
humidity 70
the readings are backwards...the DHT11 is only able to read humidity above 20% so it cant go below that but temp goes from 0 - 50 deg C thats why the humidity(really temp) is moving so much not because of wet paper towel but the heat from your finger and if you hold your finger there long enough the humidity(temp) reading will go all the way to bout 49 deg C before stopping because thats the temp reading really
Is there ANYONE who could tell me to do this exact thing with the bmp180?
can you tell me the name of things that i require to first buy and then build it
THANK YOU SOOO....MUCH
Anytime I try to verify the code,it just gives me an error code on the first line: “compilation terminated
dht.h no such file or directory
I love the website you build, it is helpful. But, when I put in the code, it says there is an error. So, I had to type it down. :(
mine is not working its showing -999 for humidity and lcd display
not compiling.
exit status 1
Error compiling for board Arduino Due (Programming Port).
Go to Tools --> Port then check it is on your port
gracias
Can I plug in multiple temperature sensors?
yes..
i am facing some problem during upload. previous program was blink example( in that board )
" Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 8.1), Board: "Arduino/Genuino Uno"
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xd9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xd9
Problem uploading to board. See www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions. ''
please help me
Out of Sync Issue is because your Arduino is corrupt.
Please visit the link and follow my tutorial to get your Arduino working.
ua-cam.com/video/xx-tAMY4qxs/v-deo.html
Hi, how do you modify the code to use two DH11 sensors? I am working on a greenhouse project that involves using two sensors. thanks
Define as Dh11_1
Dh11_2