How To Use The DHT11 Temperature and Humidity Sensor With An Arduino!
How To Use The DHT11 Temperature and Humidity Sensor With An Arduino!
1 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
OVERVIEW
In this tutorial we will learn how to use a DHT (DHT11 version) Temperature and Humidity Sensor.
It’s accurate enough for most projects that need to keep track of humidity and temperature readings.
Again we will be using a Library specifically designed for these sensors that will make our code short and easy
to write.
PARTS USED
Arduino UNO
Amazon usa
Amazon canada
2 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
Amazon canada
Dupont Wires
Amazon usa
Amazon canada
CONNECTIONS
As you can see we only need 3 connections to the sensor, since one of the pin is not used.
The connection are : Voltage, Ground and Signal which can be connected to any Analog Pin on our UNO.
3 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
THE CODE
Since we will be using a Library that is available for this sensor, our code will be very short and simple.
Once you have the library, just go ahead and extract it to the Library folder inside your Arduino IDE software
folder.
#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
delay(1000);//Wait before accessing Sensor
}//end "setup()"
void loop(){
//Start of Program
DHT.read11(dht_apin);
4 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
TUTORIAL VIDEO
DOWNLOAD
For the Arduino code, just copy and paste the code above in your Arduino IDE software.
DHT_Library.zip
Download ZIP • 2KB
5 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
6 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
7 of 8 17/01/2023 15:43
How to use the DHT11 Temperature and Humidity Sensor with an Arduino! https://www.brainy-bits.com/post/how-to-use-the-dht11-temperature-an...
8 of 8 17/01/2023 15:43