RHT03 (DHT22) Humidity and Temperature Sensor Hookup Guide

Pages
Contributors: bboyho
Favorited Favorite 0

Introduction

Measure relative humidity and temperature with the RHT03 (a.k.a DHT22) low cost sensor on a single wire digital interface connected to an Arduino!

Humidity and Temperature Sensor - RHT03

Humidity and Temperature Sensor - RHT03

SEN-10167
$9.95
29

Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

Suggested Reading

If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing.

Installing an Arduino Library

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we will also go over manually installing an Arduino library.

What is an Arduino?

What is this 'Arduino' thing anyway?

Installing Arduino IDE

A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.

How to Install FTDI Drivers

How to install drivers for the FTDI Basic on Windows, Mac OS X, and Linux.

Hardware Overview

Pinout

The pins of the RHT03 (DHT22) are labeled in the image below.

Annotated RHT03

Pin RHT03 (DHT22) Notes
1 VCC Input Voltage between 3.3-6V DC
2 DAT Data Output
3 N/C Not Connected
4 GND Ground

Hardware Hookup

Connect the RHT03 to your Arduino as shown below. Since we are using a 5V Arduino, we will be using 5V to power the sensor. If you are using a 3.3V Arduino, you will need to connect it to a 3.3V pin for your respective development board.

Fritzing Diagram of Circuit

Library Installation

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

We’ve written an Arduino library to make reading the RHT03 a breeze. You will need to manually install the RHT03 Arduino library from the GitHub repository by downloading a *.zip. Once downloaded, click Sketch > Include Library > Add .ZIP Library... to have the Arduino IDE unzip the library into it's respective folder.

Arduino Example

After installing the library, open the example from the Arduino IDE by clicking File > Examples > SparkFun RHT03 Arduino Library > RHT03-Example-Serial. Select the board that you are using (if you are using the RedBoard with the ATmega328P, select Arduino/Genuino Uno) and COM port that the board enumerated on and hit upload.

Arduino IDE with Upload Button Highlighted

Open the serial monitor at 9600 baud to view the output. You should see the relative humidity and temperature in °F and °C. Try blowing some air at the sensor. The sensor should react to the water vapor contained in the exhaled air.

Example Output Relative Humidity and Temeprature

More Examples

Looking for more examples? Check out the following tutorials to read the sensor with other development boards!

ESP8266

If you are using the ESP8266 with the RHT03 (DHT22), try checking out experiment 1 of the Internet of Things Experiment Guide to capture temperature and humidity data from a sensor and post it to our ThingSpeak channel.

ESP8266 Thing Example
ESP8266 Example

Particle Photon

If you are using the Particle Photon with the RHT03 (DHT22), try checking out experiment 6 of the SparkFun Inventor's Kit for Photon Experiment Guide to read the serial data with a photocell.

Particle Photon Example
Particle Photon Example

Resources & Going Further

Now that you've successfully got your RHT03 up and running, it's time to incorporate it into your own project! For more information, check out the resources below:

Looking for more examples that monitor the environment? Check out the following tutorials.

Weather Station Wirelessly Connected to Wunderground

Build your own open-source, official Wunderground weather station that connects over WiFi via an Electric Imp.

SparkFun BME280 Breakout Hookup Guide

A guide for connecting the BEM280 sensor to a microcontroller, and for using the Sparkfun Arduino library.

micro:climate Kit Experiment Guide

A weather station kit that is built on top of the inexpensive, easy-to-use micro:bit and Microsoft MakeCode.

ESP32 Environment Sensor Shield Hookup Guide

SparkFun's ESP32 Environment Sensor Shield provides sensors and hookups for monitoring environmental conditions. This tutorial will show you how to connect your sensor suite to the Internet and post weather data online.