The RHT03 is a digital humidity and temperature sensor. It is sometimes know as the DHT22.

Hello World

Import programRHT03_HelloWorld

A sample program showing how to read data from the RHT03


Import libraryRHT03

An eddied version of http://mbed.org/users/crazystick/code/DHT22/ for LPC11U24. All printf statements are removed and features requiring the real time clock are removed.




Wiring the RHT03

The sensor comes in a 4 legged package, but only 3 are required. The pins are numbered 1-4 from left to right when looking at the front of the sensor.

The will work on any voltage from 3.3-6v. The datasheet advises putting a 100nF capacitor between VDD and GND for wave filtering, but don't worry if you don't have one of these it will still work!

VDD should be connected onto pin 1 and GND onto pin 4.

The sensor uses a MaxDetect 1-wire bus, this is a dual direction digital signal. This can be connected to any of the Digital In/Out ports on the mbed. The digital in/out port of the mbed should be connected to pin 2 on the RHT03. A 1K pull up resistor is also required on the data line.

The pins are numbered 1-4 from left to right when looking at the front of the sensor.


Getting Data from the RHT03

The bus/sensor is a little bit temperamental at times...

All you need to know about getting the data is:

  • You have to wait at least 2 seconds after a power on to get data from the sensor
  • You can only request data from the sensor every 2 seconds
  • You will get a get a couple of check sum errors most times you try to read sensor data

You need to log in to post a discussion