You are here
Home > IoT Experiments >

Experiment-6: To Measure humidity and temperature using Arduino

Aim : Measure humidity and temperature

Objective: At the end of this experiment we will be able to:

  1. Understand the working of DHT module
  2. Interface DHT11 with arduino and develop a program using DHT-11

Requirement: PC with Arduino IDR, Arduino Uno board, DHT-11 module and 03 jumper wire.

Theory

DHT11 Sensor

The DHT-11 is a digital-output relative humidity and temperature sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air. It is smaller and less expensive but this sensor is less precise, less accurate and works in a smaller range of temperature and humidity when compared with DHT22. DHT11 has a sampling rate of 1Hz, which means it can provide new data once every second. Comes with 4 pin or 3 pin. Figure below shows the pin names. However before interfacing just check the pin names on the PCP of DHT-11 module.

Humidity Sensor:

The humidity sensing component has two electrodes with a moisture-holding substrate (usually a salt or conductive plastic polymer) in between.

As the humidity rises, the substrate absorbs water vapour, resulting in the release of ions and a decrease in the resistance between the two electrodes.

This change in resistance is proportional to the humidity, which can be measured to estimate relative humidity.

NTC Temperature sensor

DHT11 also includes a NTC thermistor for measuring temperature. A thermistor is a type of resistor whose resistance varies with temperature. It has a negative temperature coefficient.

Resistance Variation of NTC sensor

NTC sensor resistance varies as shown in figure above.

The sensor also includes an 8-bit SOIC-14 packaged IC. This IC measures and processes the analog signal using stored calibration coefficients, converts the analog signal to digital, and outputs a digital signal containing the temperature and humidity.

DHT11 can measure temperature from 0°C to 50°C with a ±2.0°C accuracy, and humidity from 20 to 80% with a 5% accuracy.

Another alternative to DHT11 is “DHT22/AM2302 Digital Temperature Humidity Sensor”. A bit more expensive, but it has a wider range and has better precision.

Interfacing DHT-11 with Arduino

Interfacing DHT-11 is very simple. Connect Vcc to +5V pin and GND to GND pin of arduino. The data pin of the DHT-11 can be connected to any digital pin 0 to 13 (here connected to digital I/O pin 8). This is shown in figure below.

Interfacing DHT with Arduino:

Code:

Program to measure humidity and temperature and display on the serial monitor

// Open Arduino IDE

//Select port and the arduino uno board

//Install DHT11 library

#include <DHT.h>

//Define Constants

#define DHTPIN 2                                            // data input pin where DHT 11 connected to

#define DHTTYPE DHT11                                 // DHT 11  (AM2302)

// Initialize DHT sensor for normal 16mhz Arduino

DHT dht(DHTPIN, DHTTYPE);

 

//Variables

int chk;

float hum;  //Stores humidity value

float temp; //Stores temperature value

void setup()

{

Serial.begin(9600);

dht.begin();

}

void loop()

{

//Read data and store it to variables hum and temp

hum = dht.readHumidity();

temp= dht.readTemperature();

//Print temp and humidity values to serial monitor

Serial.print(“Humidity : “);              Serial.print(hum);

Serial.print(” %, Temp: “);               Serial.print(temp);      Serial.println(” Celsius”);

delay(2000); //Delay 2 sec.

}

Summary:

In this experiment we have learnt the basics of the DHT-11, its interfacing with arduino board and the programming to measure the humidity and temperature and display the reading on the serial monitor.

ViVa Questions:

  1. What is the purpose of DHT-11 sensor module and explain its working.

 

 

  1. What do you understand by NTC sensor

 

 

  1. What is use of the DHT-11 library

 

 

 

 

Leave a Reply

Top
error: Content is protected !!