New York, NY IMG HI 58° LO 56° Home About Contact
IMG-LOGO
Home Engineering Mechanics Automation Control Engineering Lab Determine the humidity using Arduino
Automation Control Engineering Lab Lab Experiments

Determine the humidity using Arduino



Aim

To determine the humidity using Arduino

Tools and Components required:

  1. Arduino UNO board
  2. DHT-22
  3. Bread Board
  4. Arduino Software.
  5. Connecting Wires

Theory

The DHT-22 (also named as AM2302) is a digital-output, relative humidity, and temperature sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and sends a digital signal on the data pin.

arduino

Circuit Diagram:

circuit-diagram

Program:

#include "DHT.h"

#define DHTPIN 2

#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);

Serial.println("DHTxx test!");

dht.begin();

}

void loop() {

delay(2000);

float h = dht.readHumidity();

float t = dht.readTemperature();

float f = dht.readTemperature(true);

if (isnan(h) || isnan(t) || isnan(f)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

float hif = dht.computeHeatIndex(f, h);

float hic = dht.computeHeatIndex(t, h, false);

}

Serial.print ("Humidity: ");

Serial.print (h);

Serial.print (" %\t");

Serial.print ("Temperature: ");

Serial.print (t);

Serial.print (" *C ");

Serial.print (f);

Serial.print (" *F\t");

Serial.print ("Heat index: ");

Serial.print (hic);

Serial.print (" *C ");

Serial.print (hif);

Serial.println (" *F");

}

Result:The obstacle are detected using an ultrasonic sensor and arduino UNO.