Site icon Circuit Ideas for You

Arduino Temperature Controller Circuit using DC Fan

This article show how to make Arduino Temperature Controller Circuit using DC Fan Arduino UNO, LCD, transistor, DHT11 sensor and with few resistors.

Also, it show temperature and fan speed on LCD and control fan speed based on room temperature in home or office; then fan turns ON and OFF automatic when temperature goes above or below a set limit.

Arduino Code:

#include <LiquidCrystal.h>
#include <DHT.h>

#define DHTPIN 2     // Digital pin connected to DHT sensor
#define DHTTYPE DHT11 // DHT sensor type

#define FANPIN 3     // Digital pin connected to transistor base

#define LCD_RS 7     // LCD Register Select pin
#define LCD_EN  8     // LCD Enable pin
#define LCD_D4  5     // LCD Data pin 4
#define LCD_D5  6     // LCD Data pin 5
#define LCD_D6  11    // LCD Data pin 6
#define LCD_D7  12    // LCD Data pin 7

#define TEMP_THRESHOLD 25.0 // Temperature threshold in degrees Celsius

LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  lcd.begin(16, 2);
  dht.begin();
  pinMode(FANPIN, OUTPUT);
}

void loop() {
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  if (isnan(temperature) || isnan(humidity))   
 {
    lcd.setCursor(0, 0);
    lcd.print("Error reading DHT sensor!");
  } else {
    lcd.setCursor(0, 0);
    lcd.print("Temp: ");
    lcd.print(temperature);
    lcd.print(" C  Humidity: ");
    lcd.print(humidity);
    lcd.print("%");

    if (temperature >= TEMP_THRESHOLD) {
      digitalWrite(FANPIN, HIGH);
    } else {
      digitalWrite(FANPIN, LOW);
    }
  }

  delay(1000);
}

Code Explanation:

Code Logic:

Circuit Working:

Arduino Temperature Controller Circuit Diagram using DC Fan

Parts List:

ComponentsQuantity
Resistor
1k 1/4 watt1
470Ω 1/4 watt1
Semiconductors
Arduino UNO1
DHT11 sensor1
DC Fan 9V1
16×2 LCD1
IC 78091
Transistor 2N22221

This circuit project is easy to work and make, as Arduino make PWM at PWM pin and sends to transistor base nd ten transistor give voltage based on PWM signal.

After that, PWM control fan speed through transistor and DHT11 send temperature and humidity to Arduino.

Arduino check if temperature is more than set limit; if temperature is high then transistor turns ON and fan starts and if temperature is low then transistor turns OFF and fan stops.

Finally, LCD shows current temperature and humidity.

How to Build:

To build a Arduino Temperature Controller Circuit using DC Fan following are the steps for connections:

DC Fan Connection:

Transistor 2N2222 Connection:

DHT11 Sensor Connection:

LCD Connection to Arduino:

Conclusion:

To conclude, this Arduino Temperature Controller Circuit controls a DC fan based on room temperature and users can change its threshold temperature.

Hence, if we require additional features such as humidity monitoring and alerts, we can add them to the system.

Exit mobile version