Temperature Controlled Fan with Arduino

In this project, arduino and I will check the engine fan correctly from the DHT11 heat sensor, we will write the data to the LCD module to monitor it instantly, we will use PWM for engine control, if you do not know about this, you can look at the PWM contents that we already have, you do not have to use LCD with a small extraction, you can also use it without LCD without a small extraction, you can also use the engine and engine power supply for triggering PN222 NPNN I used the transistor, so both the working life of the fan was extended and I did not receive the energy source through Arduino, In such cases, the first movement of the fan, high current in the power supply, this was prevented thanks to the transistor, the negative power that would occur after the fan stopped here, so I did not see the need to add zener diode.

What is LCD?

LCD (Liquid Crystal Display) is the Turkish equivalent of Liquid Crystal Display. It is based on an image technology based on the principle that electrically polarized liquid passes light in a single phase and can be seen with a polarization filter added to the front. Liquid crystal displays, which were monochrome and very low resolution in the early days; calculators, watches, mobile phones, etc. are used for simple imaging. It is the most preferred type of display today due to its low radiation release, low electricity consumption and low footprint compared to cathode beam tubes.

Materials used

  • 16×2 LCD Module
  • DHT 11 Sensor
  • 1k OHM Resistance
  • PN2222 Transistor, or NPN
  • DC Power Supply for engine or 9v PIN
  • DC Motor (FAN)

Circuit Diagram

Temperature with Arduino

Arduino Code

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
#define dht_dpin 12
dht DHT;
#define pwm 9
void setup()
  lcd.begin(16, 2);
  lcd.print(" Fan Speed ");
  lcd.setCursor(0, 1);
  lcd.print(" Checking ");
  analogWrite(pwm, 255);
void loop()
  int temp = DHT.temperature;
  lcd.setCursor(0, 0);
  lcd.setCursor(0, 1);
  if (temp < 26 ) { analogWrite(9, 0); lcd.print("Fan Kapalı "); delay(100); } else if (temp == 26) { analogWrite(pwm, 51); lcd.print("Fan Hızı: 20% "); delay(100); } else if (temp == 27) { analogWrite(pwm, 102); lcd.print("Fan Hızı: 40% "); delay(100); } else if (temp == 28) { analogWrite(pwm, 153); lcd.print("Fan Hızı: 60% "); delay(100); } else if (temp == 29) { analogWrite(pwm, 204); lcd.print("Fan Hızı: 80% "); delay(100); } else if (temp > 29)
    analogWrite(pwm, 255);
    lcd.print("Fan Speed: 100%");