Arduino temperature control project

 In this project, you will learn about an Arduino fan that is temperature controlled using a DHT22 sensor and relay. We will use the DHT22 sensor to get the temperature value and we will print that temperature value on the LCD. Then we check whether the temperature value is greater than 35 or not, and if the temperature will be greater than 35, the relay will activate and the fan will start to rotate.
Temperature control is required in many places like server rooms, homes, industries etc so this project can be very helpful in understanding the basics and how to control the temperature in your home. You can take this as a DIY project that can be used anywhere. Here the temperature controlled fan will act on the temperature changes.

 

This project works in three parts:
 In the first step, the sensor senses the temperature by the temperature and humidity sensor which is DHT11.
In the second step, the output of the sensor is taken and the temperature value is converted into an appropriate number in the Celsius scale. The fan speed is controlled using PWM signals. The last part of the system shows the humidity and temperature on the LCD screen and the fan running.
Then we programmed the Arduino according to the requirements. Working on this is very simple. We have generated a PWM from the Arduino and placed it in the base terminal of the transistor. Then the transistor generates voltage with respect to the PWM input.
the project planner:

 Arduino code

#include "DHT.h" 
#include "LiquidCrystal.h"
LiquidCrystal lcd(7, 8, 9, 10, 11 ,12);
#define DHTPIN 6
#define DHTTYPE DHT22
DHT sensor(DHTPIN, DHTTYPE);
int relay_pin = 9;

void setup() {
lcd.begin(16,2);
sensor.begin();
pinMode(relay_pin, OUTPUT);
digitalWrite(relay_pin, HIGH);
}
void loop() {
lcd.clear();
float t = sensor.readTemperature(); //reading the temperature from the sensor
// Checking if the sensor is sending values or not
if (isnan(t)) {
lcd.print("Failed");
delay(1000);
return;
}
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(t);
lcd.print(" C");
if (t > 35){
digitalWrite(relay_pin, LOW);
lcd.setCursor(0,1);
lcd.print("Fan is ON ");
delay(10);
}
else{
digitalWrite(relay_pin, HIGH);
lcd.setCursor(0,1);
lcd.print("Fan is OFF ");
}
delay(2000);
}

 


 

Post a Comment

Previous Post Next Post