Arduino Tutorial: DHT 11 temp/humidity sensor

DHT11 Temperature and Humidity Sensor


testing_DHT11_schemGet the library

This library is on GitHub, and the procedure below is common for most if not all libraries that come from GitHub:

  1. Visit the DHT11 library page at
  2. 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:

  1. Unzip this file in the folder named “libriaries” in your Arduino sketch folder
  2. The library will be created in a folder named DHT-sensor-library-master.
  3. Rename the DHT-sensor-library-master folder to DHT.
  4. 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:

  1. 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

  1. Open the DHTtester example in the DHT category of examples
  2. Select the correct value for DHTTYPE
  3. Open Serial Monitor
  4. Exhale on the sensor to increase humidity and verify that the humidity level rises
Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *