DHT11 Temperature and Humidity Sensor
This library is on GitHub, and the procedure below is common for most if not all libraries that come from GitHub:
- Visit the DHT11 library page at https://github.com/adafruit/DHT-sensor-library
- Click the button that says “Download ZIP”
Install the library
This procedure is common for installing all libraries that come from GitHub, and for libraries that come from most other places:
- Unzip this file in the folder named “libriaries” in your Arduino sketch folder
- The library will be created in a folder named DHT-sensor-library-master.
- Rename the DHT-sensor-library-master folder to DHT.
- If you have the Arduino IDE open, you will need to restart it to make it aware of the new library.
Check that the library installed properly
A general suggestion is to check whenever you can that whatever you just did worked. That way if later things don’t work, you can rule out things you checked earlier and will have fewer things to check.
Most libraries ship with at least one example. It is highly likely any such example should verify (compile) correctly if the library is installed correctly:
- Check that you’ve properly installed the library by opening the DHTtester example in the DHT category of examples, and then press the Verify button. If you get the message “Done compiling” then you have installed the library correctly.
Upload example sketch
- Open the DHTtester example in the DHT category of examples
- Select the correct value for DHTTYPE
- Open Serial Monitor
- Exhale on the sensor to increase humidity and verify that the humidity level rises
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.