How to Hookup DHT22 Temperature Sensor to Arduino Board
The DHT-22 is a low cost device for measuring humidity and temperature. The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor. The device requires a 3 to 5V power supply. It uses a single data wire to communicate back to the Arduino. It has a fairly slow update rate and should only be sampled every 2 seconds.
- Arduino Board
- DHT-22 Sensor or DHT-22 on Breakout Board
- 10K Pullup Resistor if using DHT-22 Sensor without Breakout Board
- Breadboard hookup wires
- USB Cable to suite Arduino
Wiring Diagram for connecting the DHT-22 to a Arduino Board
The wiring of the sensor to the Arduino depends on how the sensor was purchased. If the sensor was supplied mounted on a breakout board then it means we do not require the pull up resistor as its already pre installed on the board.
Breadboard Diagram for connecting the DHT-22 to a Arduino Board
To test this sensor we can use sample sketch shown below. You can download the sketch file and the cactus.iolibrary to communicate with the sensor. It reads the DHT22 every 2 seconds and prints the results to the console on the computer connected to the USB port on the Arduino.
We are using digital pin 2 to connect to the data pin on the sensor. If you are using a different digital pin then you will need to change the pin number defined on line 6 in the sketch code.