[tutorial] How to use DHT-22 sensor

Introduction

humidity sensor

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!

About the DHT-22 sensor

pinout

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

What you will need

parts

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • DHT-22

The Circuit

fritzing

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

The Code

output

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.

Well done!

breadboard

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