AIM: To Setup DHT 11 Humidity sensor using Arduino board
APPARATUS: 1. Arduino Uno Board – 1 No.
2. LED - 1No.
3. Resistor-100 Ohm -1 No.
4. Bread Board – 1 No.
5. Connecting Wires
6. USB Cable.
7. DHT 11 Humidity sensor-1 No.
THEORY:
The DHT11 detects water vapor by measuring the electrical resistance between two electrodes. The humidity sensing component is a moisture holding substrate with electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes.
The DHT11 measures temperature with a surface mounted NTC temperature sensor (thermistor) built into the unit.
The DHT11 uses just one signal wire to transmit data to the Arduino. Power comes from separate 5V and ground wires. A 10K Ohm pull-up resistor is needed between the signal line and 5V line to make sure the signal level stays high by default (see the datasheet for more info).
There are two different versions of the DHT11 you might come across. One type has four pins, and the other type has three pins and is mounted to a small PCB. The PCB mounted version is nice because it includes a surface mounted 10K Ohm pull up resistor for the signal line. Here are the pin outs for both versions:
HOW TO SET UP THE DHT11 ON AN ARDUINO
Wiring the DHT11 to the Arduino is really easy, but the connections are different depending on which type you have.
CONNECTING A THREE PIN DHT11:
CONNECTING A FOUR PIN DHT11:
• R1: 10K Ohm pull up resistor
DISPLAY HUMIDITY AND TEMPERATURE ON THE SERIAL MONITOR
Before you can use the DHT11 on the Arduino, you’ll need to install the DHTLib library. It has all the functions needed to get the humidity and temperature readings from the sensor. It’s easy to install, just download the DHTLib.zip file below and open up the Arduino IDE. Then go to Sketch>Include Library>Add .ZIP Library and select the DHTLib.zip file.
P0ROGRAM:
#include <dht.h>
dht DHT;
#define DHT11_PIN 7
void setup(){
Serial.begin(9600);
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
delay(1000);
}