The DHT11, DHT21 and DHT22 are relative cheap sensors for measuring temperature and humidity. This article describes a library for reading both values from these sensors.
These sensors are very basic and slow, but are great for hobbyists who want to do some basic data logging. The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor. There is also a very basic chip inside that does some analog to digital conversion and spits out a digital signal with the temperature and humidity. The digital signal is fairly easy to read using any microcontroller.
It is fairly easy to connect up to the DHT sensors. They have four pins; VCC (3 to 5V power), Data out, Not connected, Ground
To test the sketch, we'll use an Arduino. You can use any micrcontroller that can do microsecond timing, but since its a little tricky to code it up, we suggest verifying the wiring and sensor work with an Arduino to start.
Begin by downloading the DHT library from the website. To download, click the Downloads
button at the top of the page. Extract the files to My Documents/Arduino/Libraries/DHT
and make sure that it contains the dht.cpp file and others. You may have to create
that libraries sub-
Now load up the ZS6KMD_DHT11Test sketch
The DHT11 Sketch can be downloaded from downloads.
http://www.zs6kmd.za.net/ZS6KMD_DHT11Test.ino
In my sketch you will notice that I have included the LCD library instead of using a serial print. I wanted to make this project a permanent fixture in the shack with a display of date, time, temperature and humidity.
All the bits and pieces for this project are available in my product section. Just complete an order and I can ship to you.
73