In this tutorial we are going to see how to interface DHT22 and DHT11 with Arduino uno. First of all we need to know in detail about the components. So let's start !!!
DHT22 and DHT11 are very basic temperature and humidity sensors. They both uses a thermistor and capacitive humidity sensor to measure the surrounding air. A capacitive humidity sensor is used to measure relative humidity with a range of 5 to 95 % RELHum. A thermistor is a resistance thermometer whose resistance is dependent on temperature. We can measure the resistance of a thermistor using an ohmmeter. Both sensors are pretty slow working, but they do have advantages like low power consumption and long term stability. DHT22 is much more accurate and better than DHT11. DHT11 has humidity range of 5 to 95% RH with a ±5% and also a temperature range of -20 to 60℃ with a ±2%, while DHT22 has humidity sensor of 0 to 99.9 %RH with ±2% accuracy while the temperature sensor ranges from -40 to 80℃ with ±0.5℃ accuracy.
Pinout of DHT11 and DHT22 The both sensors have a very similar pinout. They has four pins namely Gnd, Vcc, Analog and Data. Gnd needs to be connected to the ground of Arduino or the circuit. Vcc can be either connected to 3.3V or 5.V of Arduino. Data pin outputs both temperature and humidity through serial data and needs to be connected to one of the digital pins of Arduino as per the code.
Arduino uno Arduino uno is a micro-controller based on Chip ATmega328p. It has 14 digital pins, six analog pins, 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It can be powered using tablet, laptop, mobile through USB cable or using an external battery. Arduino uno is programmed using the software Arduino IDE.
Now let's start making the circuit. The connections are as follows:
Gnd (-) pin of DHT22/DHT11 to Gnd of Arduino uno Data/Out pin of DHT22/DHT11 to digital pin 9 pin of Arduino Uno Vcc (+) pin of DHT22/DHT11 to 5.V of Arduino uno Pls note that the below circuit diagram is given below is interfacing of DHT22 with Arduino uno. The same connections can be followed to interface DHT11 with Arduino.
The code for the project is given below. If you want to interface Arduino uno with DHT11 just simply change the DHT type from DHT22 to DHT11 in the code, at line number three. Before uploading the code to the microcontroller, make sure you have downloaded the libraries of the sensors. These are the steps you need to follow for downloading the libraries: Go to the tools section in the IDE software. In the tools section there is a option called "Manage libraries". After clicking on manage libraries there is search section. There you can find the libraries for both DHT11 and DHT22. You can download the library by Adafruit which works for both sensors.
Comments
Please log in or sign up to comment.