Arduino Tutorial 50: How to Connect and Use the DHT11 Temperature and Humidity Sensor

Arduino Tutorial 50: How to Connect and Use the DHT11 Temperature and Humidity Sensor

Paul McWhorter

4 года назад

156,661 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@jjasonvoorhees545
@jjasonvoorhees545 - 15.07.2024 08:39

Hey there! I'm confused on where would you go to check about how to use the libary.. like for the HT.readTemperature, how did you know to put true in order to get Farenheit?

Ответить
@steveholt8991
@steveholt8991 - 06.07.2024 12:42

Homework done ok.
😀
Funny story. I'm using the Sunfounder Elite Explorer kit for Paul's series on the R4 Wifi. I'm ok with programming but a beginner in electronics. When it came to the LCD the one I have has a piece of electronics on the back that prevented me from plugging the LCD in to the breadboard. Should I pull it off then maybe I can plug the rest in?. Fortunately, I did some research instead and found it was an I2C module. What is I2C? So I did some more research and found how to use it and found some libraries to drive it. It works fine and is a lot better than connecting all those wires to the Arduino. So Paul, not only am I learning from you, I'm learning by doing my own research and trying things for myself. Great lectures and I can't wait for the R4 Wifi series to advance.

Ответить
@carlkoplinmd6776
@carlkoplinmd6776 - 05.07.2024 03:10

I have followed and enjoyed all of your videos in this series so far. I followed your explanation on installing the DHT library and I received an error message "file not found". After some research, I had to also download the ADAfruit_Unified_Sensor zip file as well. Now all is working.

Ответить
@chiyankwan611
@chiyankwan611 - 06.06.2024 16:25

What is code for 1.8.6

Ответить
@billbell745
@billbell745 - 27.05.2024 23:25

Although my compiler can see the library (had to use "" BTW) on the line DHT HT(sensePin,Type); I keep getting the error C:\Users\SUPERU~1\AppData\Local\Temp\cc4srKzq.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_Arduino50.ino.cpp.o.1730':
<artificial>:(.text.startup+0x62): undefined reference to `DHT::DHT(unsigned char, unsigned char, unsigned char)'
C:\Users\SUPERU~1\AppData\Local\Temp\cc4srKzq.ltrans0.ltrans.o: In function `setup':
C:\Users\Superuser\Documents\Arduino\Arduino50/Arduino50.ino:15: undefined reference to `DHT::begin(unsigned char)'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Thoughts

Ответить
@vinodsolanki8413
@vinodsolanki8413 - 15.05.2024 08:53

I am getting Adafruit_sensors.h error
While including DHT library
Please help

Ответить
@TechLab-495
@TechLab-495 - 04.05.2024 13:45

can you do this series in linux

Ответить
@ryandyc
@ryandyc - 24.04.2024 09:02

Hi, I am trying to learn the serial communications better. How would you read this without the libraries installed? Can you do it on Arduino where you will read DHT11 bit, byte, and the 5 bit field with the checksum?

Ответить
@bilbo593
@bilbo593 - 20.04.2024 10:12

Hi Paul , I now have it all working, I updated ide 1.8.9 to ide 1.8.18 and now it all works. I had alot of problems getting the nano card to work but the update fixed that as well.

Ответить
@brankostrbac5931
@brankostrbac5931 - 31.03.2024 16:41

Help, i can't include library, although I put zip file in same directory?

Ответить
@user-tc3dp3ik6x
@user-tc3dp3ik6x - 10.03.2024 04:54

Hey Paul! I just wanted to say your videos are truly amazing. You actually explain how these things work. Thanks for all your time and effort you put in them.

Ответить
@johnhechtlinger9465
@johnhechtlinger9465 - 02.03.2024 16:27

I give up. My humidity and temperature readings are way too low. I wonder if I need a new dht11. Also, installing the library was onerous. I had to install an adafruit library in addition to the dht11, whatever the heck that is. It did work however....

Ответить
@i1dann
@i1dann - 22.02.2024 07:08

For anyone having errors or trouble with libraries try this, it worked for me after getting frustrated.

Go to "Tools" top left
Manage Libraries...
A new window should pop up after a second, after type in the top right search bar "DHT sensor library"
Click "Install" on "DHT sensor library" by Adafruit (You may have to scroll down to find it)
Then click "Install all"

It should work now without even restarting Ardunio

Hopefully this worked for you 👍

Ответить
@JohnStanleyWilkins
@JohnStanleyWilkins - 11.01.2024 05:00

THIS IS AWESOME. I started learning C++ and just wanted to do something other than web development. I'm so excited about how you have made this subject accessible for anyone to understand. I'm so excited to start working on IoT things.

Ответить
@user-pd2ph6ws5r
@user-pd2ph6ws5r - 21.12.2023 07:45

Nm Paul, I read other options and it’s working. Thank you guys. 😊

Ответить
@user-pd2ph6ws5r
@user-pd2ph6ws5r - 21.12.2023 07:24

Hi Paul, I’m having problems getting my DHT file to work in tutorial 50. I did everything you did by the book but my Arduino program can’t find that file. Is there another way to add that file so it will work?

Ответить
@robertschuldenfrei2402
@robertschuldenfrei2402 - 13.12.2023 19:03

Great lesson, as usual. After this tutorial was made it became NECESSARY to include <Adafruit_Sensor.h>. All the recent comments report this. I have a highly accurate chemical thermometer. It seems my DHT11 is reading 3°F high. So, I display dTemp which is tempF-3.0.

Ответить
@simontopley4771
@simontopley4771 - 11.12.2023 21:22

Oh wow, did I ever have some problems with the libraries. I don't know for sure exactly which step cured, it, I got so frustrated at one point, i just added everything that looked right, for some reason it kept asking for an adafruit library, well I still don't know which one exactly, but we got there in the end, it was all very reminiscent of pre Win95, trying to find libraries....
I thought i'd be clever and output it to the LCD which i so tidily added to my breadboard, and it seems like I've done the next lesson already. Feeling like I have accomplished something.
It's funny, i had more issues connecting this silly sensor than the LCD display. mad eh?

Ответить
@user-ys6bc7yh7z
@user-ys6bc7yh7z - 08.12.2023 16:36

Assignment is completed!
Did it with the recommended wires and bigger breadboard, and it feels and works so much better!
Waiting for my Arduino nano!
Thank you very much for your amazing tutorials!

Ответить
@tafkishat2636
@tafkishat2636 - 06.12.2023 13:27

if show error when run arduino after install library `DHT sensor` you should install `Adafruit Unified Sensor` with that

Ответить
@frang342
@frang342 - 14.10.2023 03:07

Hi Paul,
I've started from lession 1 and now I'm on lession 50. I've learned a lot along the way, especially on coding. You are very easy to follow as a beginner. I plan on finishing these lessons and then jumping over to the raspberry pi pico w. Thanks for taking the time to do what you do. You always wonder if people watch the whole video and do your homework. Well I do watch all the way through and do the homework,however I wonder if you go back and read these comments on these lessons that you posted 3years ago. Today is 10/13/23.

Ответить
@lXCcouldnotfindnottakenone
@lXCcouldnotfindnottakenone - 21.09.2023 20:13

what is
expected primary-expression before ')' token i get this every time

Ответить
@chrisb7250
@chrisb7250 - 13.09.2023 12:57

When I saw that the Nano had bluetooth capability, I got really excited for the projects that lay ahead. Thank you for all you do Paul! these projects have really opened my eyes to some of the systems i have been using all my life... eg. the automatic door at the grocery store, the thermostat on the wall, fans... Almost every time I do a project, I can see it's application in the real world. This has been very enjoyable. I plan to keep doing the lessons!

Ответить
@esaef91
@esaef91 - 10.09.2023 13:45

I also needed to install the adafruit unified sensor library for th DHT library to work.

Ответить
@remotaurog
@remotaurog - 28.08.2023 19:44

Great I got it working ,thanks for helping us out another one ticked .

Ответить
@Thejbelow
@Thejbelow - 02.08.2023 11:10

Loving these videos Paul, Thanks again

Ответить
@AdolfZcoder
@AdolfZcoder - 29.07.2023 11:10

it keeps sayin nan...



Humidity: nan% Temperature nan C nan F

Ответить
@OnMartis
@OnMartis - 07.07.2023 16:19

what made you confused

Ответить
@micahhoffman7818
@micahhoffman7818 - 06.06.2023 06:20

I accidentally cooked my sensor by plugging it in wrong 😔

Ответить
@426F6F
@426F6F - 29.05.2023 08:16

If you guys have issues with your Arduino IDE not including the DHT11 sensor libraries after installing, it could be that your initial preference location is preventing Arduino from accessing your libraries. My libraries for Arduino are under a folder called 'Arduino 15', which when I manually search for it in my file explorer, I can't find the path. I'm using Windows, and what I had to do was go in and manually set my preference directory path to /Arduino15/libraries.

- First, go to Arduino's Preferences, press 'BROWSE', and then look in the top bar that shows your folder (directory) path.

- Press the 'Local' folder location, and once in there, select 'Arduino 15', and then 'libraries'.

- Now drag and drop your unzipped DHT sensor library into that 'libraries' folder where the rest of the Adafruit sensor libraries should already be.

If you struggle with this or can't find the libraries, make sure to press 'Cancel' at the bottom before exiting the Sketchbook file explorer so that you don't drop your DHT libraries into the wrong folder and set your preference to another location that doesn't contain the libraries.

- FINALLY, under the 'Library manager' tab at the side, search for 'DHT sensor library' by Adafruit, and install it. This process was crazy for me, but I figured it out eventually!

Ответить
@firedragonnatsu5949
@firedragonnatsu5949 - 23.05.2023 21:41

Does anybody have the sample code, for the code used in video ?

Ответить
@VegasGuy89183
@VegasGuy89183 - 04.05.2023 21:44

I could not get it to compile, no matter what. Tried different versions of DHT library. Uninstalled. Reinstalled. Nothing worked. It wasn't until I did a Google search of the error message, "Adafruit_Sensor.h: No such file or directory," that I discovered I needed to also install the Adafruit Unified Sensor library. Then it compiled without any further complaints. Very frustrating.

Ответить
@wayneandrews1738
@wayneandrews1738 - 12.04.2023 23:35

Homework Done!
Here's the LCD output:
Humidity: 51.00% (first row)
Temp: 73.94F (Second row)
I will try to use the character map to print the degree symbol that looks like a small circle. But this is fine.
Wayne

Ответить
@wayneandrews1738
@wayneandrews1738 - 11.04.2023 23:04

Paul, I use the Tools -> Library Manager and type in DHT11 in the Search box. The Manager will put the folder in libraries folder.
I installed the MCP4725 library for the DAC chip from adafruit.

Ответить
@idkwhatiamdoing2389
@idkwhatiamdoing2389 - 06.03.2023 19:03

I am so angry and sad at first because the LCD does not have both female wires extension, it only has this chip on its back and you need to download a new library for it, so I couldn't print anything and know this HDT11 the library worked but it is saying an error (compiling from Arduino Uno) so I could not work with it either and seeing how you're going with it you will teach next the water sense which I was looking forward for it to make an automatic watering system for my high school know I fear that you will need a library for the sound sense and the other chips that will help you make a balancing RC car and line tracking RC car. I lost today's battle but I will not give up and work as hard as I can so to win the war.

Ответить
@williamwachter3279
@williamwachter3279 - 26.02.2023 18:45

I can’t tell you how much I appreciate your walking through the actual process and the comments that provide further info to orient me!

Ответить
@gustavoapasquel9715
@gustavoapasquel9715 - 20.02.2023 19:12

Still had my lcd screen so instead of printing to the monitor i printed the sensor results to the lcd works awesome thanks for your videos they are great.

Ответить
@okann_hasan
@okann_hasan - 12.02.2023 00:14

kinda wasting ram and effort for those delay time variables that are used once

Ответить
@nevilled
@nevilled - 11.02.2023 17:09

Nice job Mr. McWhorter

Ответить
@vishnuvaradhan1468
@vishnuvaradhan1468 - 27.01.2023 18:57

For the DHT11 sensor if u have 4 pins try connecting the left pin to VCC ,the next pin to DIGITAL PIN 2 and right most pin to GND.

Ответить
@matthewcollins1858
@matthewcollins1858 - 10.01.2023 19:02

Oh, and unfortunately, I'll have to wait to get the nano for a bit, but I did order the bigger board and the wire connecters. I do plan on getting it and any of the products you endorse, and if I ever need more, I intend to utilize the links that you provided.

Ответить
@matthewcollins1858
@matthewcollins1858 - 10.01.2023 18:56

Present. I really do appreciate all of the work and explanations you do. I feel like I've grown allot watching your videos.

Ответить
@alaingirard4150
@alaingirard4150 - 07.01.2023 04:35

needs to create librairies first

Ответить
@blackbox330
@blackbox330 - 14.12.2022 21:16

Sir, Great video. Just an update. I had got nan output. Trapped output in long variable. Got -2147483648 as output. Finally loaded Files>Examples >DHT sensor library. Uncommented DHT11. Commented DHT22. Compiled & loaded. Got correct output.
Thanks for great videos. Your explanations are excellent. When ever possible, please tell us about arduino board. There are so many videos on internet, but your style is second best to none.

Ответить