Introduction: How to Make a Thermometer and Hygrometer With Arduino and a DHT11 Sensor

To make the Thermometer and Hygrometer(humidity measurer) your going to need the following items:

  • Arduino Mega 2560 (the UNO should also work)
  • DHT11 sensor (The other DHT sensors will also work though you will need to change the code were shown)
  • 3x Wires (preferably black, red and white)
  • Breadboard
  • USB to Serial cable (found in any basic Arduino kit)
  • Battery pack (Optional)

Step 1: The Circuitry

  1. Put the DHT11 sensor in the breadboard, parallel to the power rails (side of the breadboard)
  2. Get your red wire and place it in the centre pin of the DHT11 sensor and the other side in the 5V pin on the Arduino
  3. Now get your Black wire and place it in the right side of the DHT11 sensor WHEN the sensor is facing you
  4. Now get your white wire and place it on the left pin of the DHT11 sensor and then get the other side of the wire and place it in digital pin 9 on the Arduino

Step 2: The DHT Library (and Code)

  1. Start off by opening the Arduino IDE (Arduino programming software)
  2. Once the Arduino IDE has opened you need to click on Sketch => Include Library => Manage Libraries, This brings up all the libraries you can download
  3. Then in a bar across the top that says 'Filter your search' you want to type 'dht', this will then come up with the libraries that have dht in it
  4. You will then want to install the second one from the top (middle); to to install the libraries you want to click on it and then in the bottom left corner of the selected tab there should be an install button, click on that
  5. Once the library is installed you want to exit out of the library manager
  6. Then you want to click on Files => Examples => DHT Sensor library => DHTtester
  7. It should then come up with a window which is calledDHTtester
  8. Open this and make the following changes:

- add two forward slashes in front of line 10 (#define DHTTYPE DHT22 // DHT 22) unless you are using that sensor, in that case you can just skip this and the next step

- you then want to take away the two forward slashes in front of the sensor you are using (I.e. #define DHTTYPE DHT11 // DHT 11)

- then at line 6 where it says '#define DHTPIN 2' you want to change the 2 to a 9 or whatever pin your white wire is connected to

Step 3: Uploading the Program

  1. Start off by getting your USB to Serial Cable and plug the serial end into the Arduino and the USB end into your computer
  2. Now you want to get back on your Arduino IDE and click the upload button in the top left corner with a little arrow on it, it is shown in the picture

Step 4: The Finished Product

  1. To see the end product you want to click on serial monitor which is in the top right corner with a little magnifying glass and a dot inside it, its shown in the picture
  2. DHTxx! should be the first thing to come up and then the Temperature and Humidity. The Temperature will be in Celsius and Fahrenheit.

If you liked this Project please consider voting me for The Circuits Competition and the First Time Authors Competition

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016

Circuits Contest 2016

Participated in the
Circuits Contest 2016