somenjana
Published © TAPR-OHL

Sensing the Comfort Level of Atmosphere using HUMIDEX

The comfort level was symbolized by blinking 5 different colored LED using HUMIDEX (a combined parameter of temperature and humidity).

IntermediateFull instructions provided2 hours5,488
Sensing the Comfort Level of Atmosphere using HUMIDEX

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Resistor 100 ohm
Resistor 100 ohm
×1
LED (generic)
LED (generic)
5 LED of different colors. I used white, blue, green, yellow and red.
×5
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×15

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic of the complete circuit diagram

The diagram is self explanatory. 3 difference connections (power, data and ground from the left to right) were made from the DHT22 sensor. The 3rd pin from left is 'null'. 5 different colored LED has been connected with digital pin 2, 4, 6, 10 and 12 of arduino.

schematic_T5LwejFyF9.jpg

Code

The CODE

Arduino
//* Representing the comfort level by blinking of LED using HUMIDEX by DHT22 sensor and arduino Uno.

//Libraries
#include <DHT.h>;
#include <math.h>

//Constants
#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)

DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino


//Variables

double hum;  //Stores humidity value
double temp; //Stores temperature value
double B; // Stores the value of intermediate parameter.
double dew; // Stores the value of Dew temperature
long humidex; // Stores the value of HUMIDEX
const int LED1 = 02; // White LED connected to digital pin 2
const int LED2 = 04; // Blue LED connected to digital pin 4
const int LED3 = 06; // Green LED connected to digital pin 6
const int LED4 = 10; // Yellow LED connected to digital pin 8
const int LED5 = 12; // Red LED connected to digital pin 10

void setup()
{
 
 dht.begin();
 pinMode(LED1, OUTPUT); // sets the digital pin as output
 pinMode(LED2, OUTPUT); // sets the digital pin as output
 pinMode(LED3, OUTPUT); // sets the digital pin as output
 pinMode(LED4, OUTPUT); // sets the digital pin as output
 pinMode(LED5, OUTPUT); // sets the digital pin as output
}

void loop()
{
    delay(2000);
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    B=(log(hum/100)+((17.27*temp)/(237.3+temp)))/17.27; // value of "B", the intermediate dimentionless parameter has been calculated.
    dew=(237.3*B)/(1-B); // The value of dew point has been calculated
    humidex=temp+0.5555*(6.11*exp(5417.753*(1/273.16-1/(273.15+dew)))-10); // the value of HUMIDEX has been claculated.

    if (humidex<0){ // the situation when sensor is not working ! i.e NaN is coming out of the humidity and temperature value.
      digitalWrite(LED1, HIGH); // turns the Green LED (numbered as 1) on
      delay(1000); // wait for 1 sec
      digitalWrite(LED1, LOW); // turns the Green LED (numbered as 1) off
      digitalWrite(LED2, HIGH); // turns the white LED (numbered as 1) on
      delay(1000); // wait for 1 sec
      digitalWrite(LED2, LOW); // turns the White LED (numbered as 1) off
      digitalWrite(LED3, HIGH); // turns the yellow LED (numbered as 1) on
      delay(1000); // wait for 1 sec
      digitalWrite(LED3, LOW); // turns the yellow LED (numbered as 1) off
    }
    
    else if (humidex>=0 && humidex <20){
      digitalWrite(LED1, HIGH); // turns the green LED (numbered as 1) on
      delay(5000); // wait for 5 sec
      digitalWrite(LED1, LOW); // turns the green LED (numbered as 1) off
       }
    else if (humidex>=20 && humidex <30){
      digitalWrite(LED2, HIGH); // turns the White LED (numbered as 2) on
      delay(5000); // wait for 5 sec
      digitalWrite(LED2, LOW); // turns the white LED (numbered as 2) off
    }
    else if (humidex>=30 && humidex <40){
      digitalWrite(LED3, HIGH); // turns the Yellow LED (numbered as 3) on
      delay(5000); // wait for 5 sec
      digitalWrite(LED3, LOW); // turns the Yellow LED (numbered as 3) off
    }
    else if (humidex>=40 && humidex <45){
       digitalWrite(LED4, HIGH); // turns the blue LED (numbered as 4) on
      delay(5000); // wait for 5 sec
      digitalWrite(LED4, LOW); // turns the blue LED (numbered as 4) off
    }
    
    else {
       digitalWrite(LED5, HIGH); // turns the red LED (numbered as 5) on
      delay(5000); // wait for 5 sec
      digitalWrite(LED5, LOW); // turns the red LED (numbered as 5) off
          }
      }  

Credits

somenjana

somenjana

2 projects • 0 followers

Comments