Home > Projects > Temperature Measurement Projects > Arduino Temperature Control – Adjust Fan Speed based on Temperature

Arduino Temperature Control – Adjust Fan Speed based on Temperature

Summary of Arduino Temperature Control – Adjust Fan Speed based on Temperature


This Arduino project automates DC fan speed control based on room temperature measured by a DHT11 sensor, displaying real-time data on a 16x2 LCD. The system uses Pulse Width Modulation (PWM) to adjust voltage and regulate fan rotation. As temperature rises above specific thresholds, the duty cycle increases from 0% to 100%, scaling the fan speed accordingly.

Parts used in the Temperature Controlled Fan:

  • Arduino UNO
  • DHT11 sensor
  • DC Fan
  • 2n2222 transistor
  • 9 volt battery
  • 16x2 LCD
  • 1K resistor
  • Connecting wires

In this Arduino based project, we are going to control DC fan speed according to the room temperature and show these parameter changes on a 16×2 LCD display. It is accomplished by the data communications between Arduino, LCD, DHT11 sensor Module and DC fan that is controlled by using PWM. PWM is a technique by using which we can control voltage.

Temperature-Controlled-Fan

Circuit Components

  1. Arduino UNO
  2. DHT11 sensor
  3. DC Fan
  4. 2n2222 transistor
  5. 9 volt battery
  6. 16×2 LCD
  7. 1K resistor
  8. Connecting wires

This project consists of three sections. One senses the temperature by using humidity and temperature sensor namely DHT11. Second section reads the dht11 sensor module’s output and extracts temperature value into a suitable number in Celsius scale and control the fan speed by using PWM. And last part of system shows humidity and temperature on LCD and Fan driver.

Here in this project we have used a sensor module namely DHT11 that are already have discuss our previous project namely “Humidity and Temperature Measurement using Arduino”. Here we have only used this DHT sensor for sensing temperature, and then programmed our Arduino according to the requirements.

Working of this project is very simple. We have created PWM at pwm pin of Arduino and applied it at base terminal of transistor. Then transistor creates a voltage according to the pwm input.

pwm wave form

Fan speed and PWM values and duty cycles values are showing in given table

Temperature

Duty Cycle

PWM Value

Fan Speed

Less 26

0%

0

Off

26

20 %

51

20%

27

40%

102

40%

28

60%

153

60%

29

80%

204

80%

Greater 29

100%

255

100%

What is PWM? PWM is a technique by using we can control the voltage or power. To understand it more simply, if you are applying 5 volt for driving a motor then motor will moving with some speed, now if we reduces applied voltage by 2 means we apply 3 volt to motor then motor speed also decreases. This concept is used in the project to control the voltage using PWM. (To understand more about PWM, check this circuit: 1 Watt LED Dimmer)

pwm5

The main game of PWM is digital pulse with some duty cycle and this duty cycle is responsible for controlling the speed or voltage.

Suppose we have a pule with duty cycle 50% that means it will give half of voltage that we apply.

Formula for duty cycle given below:

Duty Cycle=  Ton/T

Where T= total time or Ton+Toff

And Ton= On time of pulse (means 1 )

And Toff= Off time of pulse (means 0)

Automatic temprature

Read More:  Temperature Controlled Fan using Arduino

Quick Solutions to Questions related to Temperature Controlled Fan:

  • How does this project control the DC fan speed?
    The project controls fan speed using PWM techniques to adjust voltage based on temperature readings.
  • What sensor is used to measure room temperature?
    A DHT11 humidity and temperature sensor module is used for sensing.
  • How is the temperature value displayed to the user?
    Humidity and temperature values are shown on a 16x2 LCD display connected to the Arduino.
  • What happens to the fan when the temperature is less than 26 degrees?
    The fan remains off with a 0% duty cycle and a PWM value of 0.
  • How is the maximum fan speed achieved in this circuit?
    Maximum speed occurs when the temperature is greater than 29 degrees, resulting in a 100% duty cycle.
  • Which component receives the PWM signal to drive the fan?
    The base terminal of the 2n2222 transistor receives the PWM signal from the Arduino.
  • What formula calculates the duty cycle in this project?
    The formula is Duty Cycle equals Ton divided by T, where T is the total time.
  • Can this project be powered without a computer connection?
    Yes, the circuit can be powered using a 9 volt battery.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top