Ventilation with Arduino

 
Class: Technology, Arduino I/O
Hardware: 1. Arduino Uno, 2. DHT 11, 3. Battery, 4. Relay Troyka, 5. Fan
Software: Arduino, Fritzing
Resources: YouTube channel @Умный Дом
Challenge: to define temperature and humidity in a bathroom using Arduino and to hook up a fan to create smart ventilation system
Process
Within the framework of our project Hydromatter and working with water condensation in a bathroom, we decided to study conditions in this place and to collect data. The bathroom is a room that is constantly exposed to high humidity and temperature changes – as a result, it can easily accomoate molf and fungus. The main way to fight is to ventilate the room and it is possible to automate the ventilation with Arduino.  
#include "DHT.h"

#define DHTPIN 2     // what pin we're connected to


#define DHTTYPE DHT11   // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)



DHT dht(DHTPIN, DHTTYPE);
int rele = 3;
int x = 0;
int y = 0;
void setup() {
  Serial.begin(9600); 
  Serial.println("DHTxx test!");

  dht.begin();
}

void loop() {
  pinMode (rele, OUTPUT);
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    Serial.println("Failed to read from DHT");
  } else {
    x=x+1;
    Serial.print("Humidity: "); 
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: "); 
    Serial.print(t);
    Serial.println(" *C");
    Serial.print(x);
 
  if(h < 70) digitalWrite(rele, HIGH); else digitalWrite(rele, LOW); if(h > 70);

    
  }

}

Additional documents and codes for DHT 11.
     

Tags: ,

Trackback from your site.

address: 20 Myasnitskaya ulitsa
(metro stations ‘Lubyanka’ and ‘Kitay-Gorod’)
Moscow 101000 Russia

phone: +7(495)772-95-90 *15026

email: city@hse.ru