• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » Arduino Temperature Controller Circuit using DC Fan

Arduino Temperature Controller Circuit using DC Fan

Last updated on 21 August 2024 by Admin-Lavi Leave a Comment

This Arduino Temperature Controller Circuit article shows how to assemble a basic temperature controller by using an Arduino UNO board, an LCD display, a DC fan, a transistor, a DHT11 temperature and humidity sensor, and a few resistors.

This circuit will allow us to display changes in both temperature and fan speed on a LCD display and control the fan speed in our house or business places based on the ambient temperature.

The DC fan will be automatically turned on or off by the system depending on the chosen temperature threshold, which will be monitored by the system.

Coding with Explanation:

#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);
}
  • The DHT11 sensor measures the ambient temperature and humidity
  • LCD display shows the humidity and temperature values as of right now.
  • Transistor uses temperature to regulate the DC fan.
  • The temperature threshold is the point at which the fan activates.

Code Logic:

  • It utilizes the DHT11 sensor to read the temperature and humidity.
  • Looks for inaccuracies in the sensor readings.
  • Shows the measurements on the LCD.
  • Checks the temperature against the cutoff.
  • Depending on the comparison, turns the fan on or off.

Circuit Working:

Arduino Temperature Controller Circuit Diagram using DC Fan

Parts List:

ComponentQuantity
Arduino UNO1
DHT11 sensor1
DC Fan 9V1
16×2 LCD1
IC 78091
Transistor 2N22221
Resistors 1k1
Resistors 470Ω1

Circuit working on this project is fairly easy to work on.

Here PWM is developed at the Arduinos PWM pin and applied it to the transistors base terminal.

Subsequently, the transistor generates a voltage based on the PWM input.

The Arduino generates a PWM signal, which is then sent to the transistor to operate the project.

The voltage is then within the transistors control, and this influences the fan speed.

The DHT11 sensor provides temperature and humidity information to the Arduino UNO board.

The selected threshold is compared to the temperature.

The transistor turns on and turns on the DC fan if the temperature rises beyond the threshold.

The transistor is turned off and the DC fan stops if the temperature drops below the threshold.

The LCD shows the current humidity and temperature data.

How to Build:

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

  • Gather all the components mentioned in the above circuit diagram.
  • Connect a regulated IC1 7809 to provide a regulated 9V DC  to the Arduino board
  • Connect a resistor 470Ω from LCD backlight anode to Arduino 5V.

Connection of DC Fan:

  • Connect positive terminal of DC Fan to the collector pin of the transistor 2N2222.
  • Connect Negative Terminal of DC Fan to ground GND.

Connection of Transistor 2N2222:

  • Connect collector of transistor 2N2222 to positive wire of DC Fan.
  • Connect base of transistor 2N2222 to pin 13 of digital pin on Arduino board through resistor 1k.
  • Connect emitter of transistor 2N2222 to ground.

Connection of DHT11 Sensor:

  • Connect the DHT11s VCC pin on the Arduinos board 5V pin.
  • Connect the DHT11s GND pin on the Arduinos board GND pin.
  • Connect the DHT11s DATA pin on digital pin on the Arduino pin 2

Connection of LCD Display to an Arduino board:

  • Connect the LCDs VDD pin to 5V on the Arduino.
  • Connect the LCDs VSS GND pin to GND on the Arduino.
  • Connect the LCDs D4 pin to Arduino board pin 5
  • Connect the LCDs D5 pin on the Arduino board pin 6
  • Connect the LCDs D6 pin on the Arduino board pin 11
  • Connect the LCDs D7 pin on the Arduino board pin 12
  • Connect the LCDs RS pin on the Arduino board pin 7
  • Connect the LCDs Enable pin on the Arduino board pin 8
  • Connect the LCDs R/W pin on the Arduino board ground.

Conclusion:

An easy and efficient way to automatically adjust a DC fan depending on the outside temperature is with this Arduino based temperature controller.

The temperature threshold may be changed, and other functions like humidity control and temperature alerts can be added to tailor the system.

References:

Trouble turning on temperature controlled DC fan at the correct value

Filed Under: Arduino Projects, Sensors and Detectors

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « How to Measure Humidity and Temperature using Arduino and DHT11
Next Post: Simple Arduino LED Dimmer Circuit using PWM »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • Alarm Circuits (30)
  • Amplifier Circuits (67)
  • Arduino Projects (29)
  • Audio Circuits (93)
  • Automobile Circuits (19)
  • Battery Charger Circuits (48)
  • Free Energy (13)
  • Heater and Temperature Controllers (9)
  • Indicator Circuits (38)
  • Inverter Circuits (13)
  • LDR Circuits (13)
  • LED and Lamps (111)
  • Meters and Testers (27)
  • Motor Controllers (18)
  • Oscillator Circuits (32)
  • Power Supply Circuits (91)
  • Remote Control Circuits (6)
  • Security and Protection (23)
  • Sensors and Detectors (71)
  • Solar Circuits (16)
  • Timer Circuits (27)
  • Transistor Circuits (56)
  • Transmitter Circuit (12)
  • Tutorials (4)
  • Water Level Controller (4)

Copyright © 2025 | New Circuit Ideas