loading

The DHT-22 (also named as AM2302) is a digital-output relative humidity and temperature sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin.

In this tutorial you will learn how to use this sensor with Arduino uno. The room temperature & humidity will be printed to serial monitor.

So, let's get started!

Step 1: About the DHT-22 Sensor

The DHT22 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed).

Connections are simple, the first pin on the left to 3-5V power, the second pin to your data input pin and the right most pin to ground.

Technical details:

  • Power: 3-5V
  • Max Current: 2.5mA
  • Humidity: 0-100%, 2-5% accuracy
  • Temperature: -40 to 80°C, ±0.5°C accuracy

Step 2: What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • DHT-22

Step 3: The Circuit

The connections are pretty easy, see the image above with the breadboard circuit schematic.

Step 4: The Code

Here's the code, embedded using codebender!

Try downloading the codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. Below you will also find codebender serial monitor, press connect button to start receiving data from sensor.


Step 5: Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use the DHT-22 sensor.

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!

<p>Can we use an analog pin to connect the data pin of the sensor ?</p>
<p>Can this project be used in conjunction with a WeMo switch to turn on/off a furnace based on the humidity of that space? </p>
<p>Very thorough! Just want to mention that the DC is actually between 3.3v - 6v considering the datasheet provided by Sparkfun. If you don't know what sensor to use in your project you can see here a <a href="http://www.geekstips.com/arduino/arduino-temperature-sensor-tutorial-dht22-vs-ds18b20" rel="nofollow">comparison between DHT22 and DS18B20</a></p>
<p>&Mu;&pi;ό&mu;&pi;&alpha;! Thanks!</p>
<p>The 10k resistor seems to be missing here!</p>
<p>NICE</p>
<p>&Mu;&pi;ό&mu;&pi;&alpha;!</p>
<p>Thanks for this, real help for the beginners.</p><p>One prob though, my humidity shows around 8% and i know that is deffinitely not right, it's winter here, any ideas??</p><p>thanks in advance.</p>
<p>Thanks for this, real help for the beginners.</p><p>One prob though, my humidity shows around 8% and i know that is deffinitely not right, it's winter here, any ideas??</p><p>thanks in advance.</p>
<p>For those having problems with the DHT library...</p><p>Download the library from <a href="https://github.com/adafruit/DHT-sensor-library" rel="nofollow">https://github.com/adafruit/DHT-sensor-library </a> (download zip).</p><p>In the Arduino development environment, use the menus: Sketch -&gt; Import Library -&gt; Add Library</p><p>Find the zip you downloaded and open it.</p><p>Compile your program.</p>
<p>Hi!, I am Jay and want to ask about the problem which i faced. I connected everything perfectly, codes were also perfect but then i uploaded the code onto the Intel Galileo Gen2 board and found out that no humidity and temperature is measured perfectly through serial monitor. it says &quot; Humidity = 0% Temperature = 0.00C&quot;. Please help me out.</p>
<p>Thanks! This helped!</p>
<p>Very nice and easy tutorial!</p>
<p>Very nice and easy tutorial!</p>
<p>Don't you need a 10k resistor in there?</p>
<p>Downloaded the Codebender and followed all of the steps however when I click on &quot;Run on Arduino&quot; all I get is error in compiling...not sure what to do. Tried uploading through the IDE but that failed do to the following errors.</p><p>sketch_nov27a:10: error: 'dht' does not name a type</p><p>sketch_nov27a.ino: In function 'void loop()':</p><p>sketch_nov27a:25: error: 'DHT' was not declared in this scope</p><p> If you could help me resolve either it would be much appreciated.</p>
<p>Good and easy instructable. I just have a question about the dht library, what did you use? I found one but it gives me errors on the variables.</p>
<p>Hi! Thank you for your comment. Just connect the Arduino with pc and click on &quot;Run on Arduino&quot; button to program your Arduino board with this sketch.</p><p>No need to run Arduino IDE or install additional library ;)</p><p>Try it! </p>
Your series of arduino tutorials are really helpful!
<p>I'm glad that they're helpful. Thank you</p>

About This Instructable

122,901views

62favorites

License:

Bio: Arduino Tutorials by Codebender.cc Team
More by codebender_cc:How to use a magnetic door switch / sensor with Arduino How to Measure LUX With Arduino How to Control an RGB LED Strip - Arduino Tutorial 
Add instructable to: