The RHT03 (also known by DHT-22) is a low cost humidity and temperature sensor with a single wire digital interface. The sens…
Retired
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.
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.
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.
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
Heads up! The sensor's pins are small. For a more secure connection, you may want to think about eventually soldering this to a protoboard after prototyping.
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.
Note: A 10k pull-up resistor can be added to the data pin, though it seems to work without it. If you really need, you can still add a pull-up resistor between VCC and the data pin.
Head's Up! The Fritzing part for the RHT03 (DHT22) can be found in the Fritzing software! Simply type RHT03 in the parts search.
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.
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.
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.
Heads up! You'll want to be patient as your Arduino reads the sensor. The example code checks to see if we receive a valid output from the sensor. If we receive a valid reading, the values will update respectively. If you check the datasheet, the sensor's output is typically is 2 seconds.
More Examples
Looking for more examples? Check out the following tutorials to read the sensor with other development boards!
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:
The gator:environment combines two I2C sensors for temperature, humidity, pressure, eCO2, and eTVOC values. This tutorial will get you started using the gator:environment with the micro:bit platform.
The SparkFun Artemis Global Tracker combines the Artemis processor with an Iridium 9603N satellite transceiver, ZOE-M8Q GNSS transceiver, and MS8607 PHT sensor. With a clear view of the sky, this board allows you to send and receive short data messages from anywhere in the world including remote locations far beyond the reach of WiFi and GSM networks. Follow this guide to get started with the Artemis Global Tracker.