DHT11 & DHT22 Sensors Temperature and Humidity Tutorial using Arduino

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello danadoxique here from howtomechatronics.com in this arduino tutorial we will learn how to use the dht11 and dht22 sensors for measuring temperature and humidity with the arduino board these sensors are very popular for electronic hobbies because they're very cheap but still providing great performance here are the main specifications and differences between these two sensors the dht22 is the more expensive version which obviously has better specifications its temperature measuring range is from -40 to plus 125 degrees celsius with 0.5 degrees accuracy while the dht 11 temperature range is from 0 to 50 degrees celsius with 2 degrees accuracy also the dht22 sensor has better humidity measuring range from zero to one hundred percent with two to five percent accuracy while the dht 11 humidity ranges from 20 to 80 percent with five percent accuracy there are two specifications where the dht11 is better than the dht22 that's the sampling rate which for the dht11 is one hertz or one reading every second while the dht22 sampling rate is 0.5 hertz or one reading every two seconds and also the dht 11 has smaller body size the operating voltage of both sensors is from 3 to 5 volts while the maximum current used when measuring is 2.5 milliamps okay now let's see how these sensors actually work they consist of a humidity sensing component a ntc temperature sensor or thermistor and an ic on the back side of the sensor for measuring humidity they use the humidity sensing component which has two electrodes with moisture holding substrate between them so as the humidity changes the conductivity of the substrate changes or the resistance between the two electrodes changes this change in resistance is measured and processed by the ic which also makes it ready to be read by a microcontroller on the other hand for measuring temperature these sensors use a ntc temperature sensor or a thermistor a thermistor is actually a variable resistor that changes its resistance with the change of the temperature these sensors are made by sintering of semiconductive materials such as ceramics or polymers in order to provide larger changes in the resistance with just small changes in the temperature the term ntc means negative temperature coefficient which means that the resistance decreases with the increase of the temperature okay now let's connect the dht22 sensor to the arduino board the sensor has four pins vcc ground data pin and a not connected pin which has no use a pull up resistor from 5k to 10k ohms is required to keep the data line high in order to enable the communication between the sensor and the arduino board there are some versions of these sensors that come with breakout boards with built-in pull-up resistors and they have just three pins the dht sensors have their own single wire protocol used for transferring data this protocol requires precise timing and timing diagrams for getting the data from the sensors can be found from the data sheets of the sensors however we don't have to worry much about these timing diagrams because we will use the dht library which takes care of everything here's the arduino source code after we have included the library which can be found from the arduino official website we need to define the pin number to which our sensor is connected and create the dht object in the setup section we need to initiate the serial communication because we will use the stereo monitor to print the results using the read 22 function we will read the data from the sensor and put the values of the temperature and the humidity into the tnh variables if you use the dht11 sensor you will need to use the read11 function at the end we will print the temperature and the humidity values on the serial monitor here is the result that we will get after we will upload this code and run the serial monitor i also made an example where i displayed the results on a lcd you can find the source code of that example on my official website thanks for watching and for more tutorials and projects visit my official website howtomechatronics.com
Info
Channel: How To Mechatronics
Views: 308,414
Rating: undefined out of 5
Keywords: Arduino, Tutorial, DHT11, DHT22, Temperature Sensor, Humidity Sensor
Id: nssXWNYdGT8
Channel Id: undefined
Length: 4min 50sec (290 seconds)
Published: Wed Jan 13 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.