Humidity sensor

Oh the Humidity sensor. Students think that it should be so easy, but my friends are sorely mistaken. Of all of the sensors that student’s use, this little guy seems to give them the most problems.


The first issue is its name – it is sometimes known as the DHT22, and used to be called the RHT03. Names aside, I think that students difficulties arise because this product is not really well documented at Sparkfun – it’s hard to be great all of the time I guess!

Adafruit on the other hand has a great library supporting this. In fact, Adafruit’s DHT library is so good that it is actually used as an example on the Arduino “How to Make a Library” tutorial and API style guide. If you didn’t click the first link, the library can be found here.

But Wait!

Even if you install the DHT library, you still are not done. The DHT library requires the use of the ADAfruit Unified Sensor Library, so make sure to install that into your Arduino Libraries folder as well.

Once you have the Libraries up and going, it is pretty easy to use the DHT sensor. Instead of re-inventing the wheel, I will just point you to this Bildr tutorial.

If you spend time looking through the datasheet of the humidity sensor or the example code from Sparkfun, you will see things that send project makers like me into a cold sweat  (in hindsight I would have done an Electrical Engineering minor) “MaxDetect 1-wire bus is specially designed by MaxDetect Technology Co., Ltd. , it’s different from Maxim/Dallas 1-wire bus, so it’s incompatible with Dallas 1-wire bus.”


Therefore the libraries and code that Adafruit started and Bildr finished allows students to use the humidity sensor in their projects for humidity – without that EE degree.

So if you are here and measuring Humidity – make sure to thank the BFGs at Adafruit and Bildr for letting us stand on their shoulders for a little while.