Testing the DHT11 Sensor
Posted by Marius Cloete on
What you will need :
First, we need to download and install the DHT-sensor-library.
https://github.com/adafruit/DHT-sensor-library
"To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder DHT. Check that the DHT folder contains DHT.cpp and DHT.h. Place the DHT library folder your [arduino IDE install directory]/libraries/ folder. You may need to create the libraries subfolder if it is your first library. Restart the IDE."
Next, connect the sensor to the UNO board
VCC to 5volt
Ground to Ground (GND)
Data to PIN 2
Connect you UNO board to USB, make sure you have the correct board and port selected in the IDE.
Upload the following sketch :
https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino
Set the type to DHT 11 before uploading
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
Make sure your baud rate is set to 9600.
You will see the following:
DHTxx test!
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Humidity: 35.00 % Temperature: 18.00 *C
Share this post
0 comment