Temperature controlled fan using Arduino
Introduction
The Temperature Controlled Fan using Arduino is a smart automation project that regulates a fan based on room temperature.
This project uses the LM35 temperature sensor to measure ambient temperature. When the temperature crosses a predefined threshold (for example 30°C), the Arduino automatically turns ON the fan or increases its speed using PWM (Pulse Width Modulation).
This project is ideal for:
-
Smart home automation
-
Energy-saving systems
-
School exhibitions
-
Beginner IoT learning
How the LM35 Sensor Works
The LM35 temperature sensor outputs a voltage that is directly proportional to temperature.
-
Output: 10 mV per °C
-
Example:
-
25°C → 250 mV (0.25V)
-
30°C → 300 mV (0.30V)
-
The Arduino reads this voltage using its Analog-to-Digital Converter (ADC) and converts it into temperature.
Components Required
-
Arduino UNO
-
LM35 Temperature Sensor
-
DC Fan
-
NPN Transistor (e.g., BC547 / 2N2222)
-
Diode (e.g., 1N4007)
-
10kΩ Resistor
-
External Power Supply (for fan)
-
Breadboard & Jumper wires
The transistor is required because the Arduino cannot supply enough current to drive the fan directly.
Step-by-Step Circuit Connections
Step 1: Connect LM35
-
VCC → 5V
-
GND → GND
-
OUT → A0
Step 2: Connect Transistor & Fan
-
Transistor Base → Arduino Pin 9 (via 10kΩ resistor)
-
Transistor Collector → Negative terminal of fan
-
Transistor Emitter → GND
-
Fan Positive → External 5V/9V supply
Step 3: Connect Diode
-
Place diode across fan terminals
-
Cathode → Positive side
-
Anode → Negative side
(Diode protects against back EMF)
Arduino Code (ON/OFF Control)
int sensorPin = A0;int fanPin = 9;float temperature;void setup() {pinMode(fanPin, OUTPUT);Serial.begin(9600);}void loop() {int sensorValue = analogRead(sensorPin);float voltage = sensorValue * (5.0 / 1023.0);temperature = voltage * 100; // LM35 conversionSerial.println(temperature);if(temperature > 30) {digitalWrite(fanPin, HIGH);}else {digitalWrite(fanPin, LOW);}delay(1000);}
Arduino Code (PWM Speed Control Version)
int sensorPin = A0;int fanPin = 9;void setup() {pinMode(fanPin, OUTPUT);}void loop() {int sensorValue = analogRead(sensorPin);float voltage = sensorValue * (5.0 / 1023.0);float temperature = voltage * 100;int speed = map(temperature, 20, 50, 0, 255);speed = constrain(speed, 0, 255);analogWrite(fanPin, speed);delay(1000);}
Working Principle
-
LM35 senses temperature.
-
Arduino converts analog voltage into temperature.
-
If temperature > 30°C:
-
Fan turns ON.
-
-
In PWM mode:
-
Higher temperature → Higher fan speed.
-
-
Transistor acts as a switch/driver.
Learning Outcomes
Students will understand:
-
Analog sensor interfacing
-
ADC conversion
-
Transistor switching
-
PWM speed control
-
Smart automation logic
Applications
-
Smart cooling systems
-
CPU cooling automation
-
Industrial temperature control
-
Energy-efficient ventilation
-
IoT climate monitoring
Troubleshooting Tips
-
Ensure common GND between Arduino and external power supply.
-
If fan doesn’t spin, check transistor wiring.
-
Use proper external power for high-current fans.
Code:
Try this in tinker cad:
BEGINNER PROJECTS (Foundation Skills)
- Ultrasonic Distance Measurement
- Traffic Light Simulation with 7-Segment Display
- 7-Segment Display Counter
- Kids Piano Circuit (8-Key Version)
- 16×2 LCD Display with Text Output
- LCD I2C to Arduino UNO
- Temperature Measurement using Arduino UNO
- LDR Controlled Street Light
INTERMEDIATE PROJECTS (Build Your Skills)
- Servo Motor Control Using Potentiometer
- DC Motor Speed Control
- Temperature Controlled Fan
- PIR Based Theft Alert System
- LPG Gas Leakage Detection System
- Automatic Door Locking System
- Soil Moisture Based Automatic Watering System
- Simple Digital Clock using Arduino UNO
- Automatic Voting Machine (EVM)
- Joystick Control using Arduino Uno
- RGB Lamp Control using Arduino Uno
ADVANCED PROJECTS (Master Level)
- Home Automation Using Arduino UNO
- Bluetooth RC Car using Arduino Uno
- Obstacle Avoiding Robot
- Line Follower Robot
- Radar System Using Arduino UNO
- Automatic Parking System
- Bi-Directional People Counter using Arduino Uno
- Automatic Plant Watering System
- NeoPixel LED Ring Control using Arduino Uno
- Smart Gloves for Bedridden People

Comments
Post a Comment