top of page
Search
Writer's pictureWatchIT Group

Experiment #:Control air Temp in your home and activate the fan when the temp reaches a certain *C.

In this experiment we are going to regulate the temperature in the room , using the DHT11 sensor (DHT11 measure both air temperature and air humidity ) ,relay and the Fan to cool the room .

Important application of controlling Air temperature


In the Warehouse where the store harvested crops it may be necessary to control air temperature to maintain the desired level of air temperature, this is an important task that can be easily done by with an embedded technology


Warehouse for agriculture Harvest


In greenhouse where their practice in door agriculture it is a crucial task to maintain the temperature in the greenhouse.


greenhouse for agriculture


there is many application of controlling indoor temperature ,


Components to be used

  • DHT11 sensor

  • Arduino Nano

  • relay

  • white box (fan )


Circuit diagram



connections explained :


DHT11 arduino nano relay Arduino Nano


gnd => gnd gnd gnd

Do => D3 vcc 3v3


vcc => 5v CN D2



Code


#include "DHT.h"
#define relay 2 // relay pins declaration
#define DHTPIN 3 // dht11 pins declaration

#define DHTTYPE DHT11 // the type of sensor used dht11

DHT dht(DHTPIN, DHTTYPE); //

void setup()
{
Serial.begin(9600);
dht.begin(); 
pinMode(relay,OUTPUT);// initialize the pins 2 (relay) as output
}
void loop ()
{
// wait a few seconds between measurements.
delay (2000);
float t = dht.readTemperature();// reading temperature values and store in variable t

if (t> 25) // if temperature t from dht11 is great than 25 
{
digitalWrite(relay,HIGH); // activate the relay
Serial.println("the Fan is on "); // print the fan is on
 Serial.print(F("%  Temperature: ")); // and print temp values
Serial.print(t);
Serial.println("");
}
 else 
   {
   digitalWrite(relay,LOW);//if the temp is lessthan 25 nothing happ
   Serial.println("the Fan is off ");
   Serial.print(F("%  Temperature: "));
   Serial.print(t);
   Serial.println("");
   }
   }

The output



In your case you may want to change the values of the temperature where the fan has to be activated .


let us know if its worked .


kindly make some changes with code and let us know what you have discovered , a quick example add a sound or alarm when the temperature goes high .


Thank you 😎!

214 views3 comments

3 Comments


kayitana pacific
kayitana pacific
Jul 02, 2020

am only seeing this whether its above 25 or below 25


Like

kajothada
kajothada
Jun 26, 2020

how do one deal with this error

Like

Ismael Siriyamungu
Ismael Siriyamungu
Jun 22, 2020

Well uploaded !!

Like
Post: Blog2_Post
bottom of page