Summary
Automatic appliances are becoming increasingly common in homes, offices, and industrial environments. One of the simplest yet most practical examples is a smart fan that automatically adjusts its operation based on the surrounding temperature. Instead of manually switching the fan ON or OFF, a microcontroller continuously monitors the ambient temperature and controls the fan whenever cooling is required.
This project is an excellent introduction to Arduino because it combines sensor interfacing, analog data acquisition, digital outputs, and basic automation into a real-world application. It also demonstrates how embedded systems can make everyday appliances more energy-efficient and convenient.
In this tutorial, we'll build a Smart Fan using an Arduino Uno, an LM35 temperature sensor, a DC motor (representing the fan), and an NPN transistor for motor control. By the end of this project, you'll understand how temperature sensors work, how Arduino processes analog inputs, and how to safely control DC motors using external switching circuits.

How Does a Smart Fan Work?
The Smart Fan continuously measures the surrounding temperature using an LM35 temperature sensor.
The Arduino converts the analog voltage produced by the LM35 into a temperature value in degrees Celsius.

The measured temperature is then compared with a predefined threshold.
The decision-making process is simple:
- If the temperature is below the threshold, the fan remains OFF.
- If the temperature rises above the threshold, the Arduino switches the fan ON.
- Once the temperature falls below the threshold again, the fan switches OFF.
This automatic operation makes the system ideal for room cooling, electronic enclosures, greenhouses, and small automation projects.
Components and Supplies
Components Required
- Arduino Uno Board
- LM35 Temperature Sensor
- DC Motor (5V or Mini Fan)
- NPN Transistor (TIP122 or 2N2222)
- 1kΩ Resistor
- Flyback Diode (1N4007)
- Breadboard
- Jumper Wires
- USB Cable
- External 5V Power Supply (recommended)
Optional Components
- Relay Module
- 16×2 LCD Display
- ESP32 Development Board
- OLED Display
- DHT22 Temperature & Humidity Sensor
- PWM Fan
- Battery Pack
Understanding the Components
Arduino Uno
The Arduino Uno acts as the controller of the project.
It continuously reads the temperature sensor and decides whether the fan should remain ON or OFF.
LM35 Temperature Sensor
The LM35 is an analog temperature sensor that produces an output voltage directly proportional to temperature.
Its output changes by 10 mV for every 1°C.
For example:
- 25°C → 250 mV
- 30°C → 300 mV
- 40°C → 400 mV
The Arduino reads this voltage using one of its analog input pins.
NPN Transistor
The Arduino GPIO pins cannot supply enough current to operate a DC motor directly.
The transistor acts as an electronic switch.
When the Arduino outputs a HIGH signal, the transistor switches ON and supplies power to the motor.
Flyback Diode
DC motors are inductive loads.
When switched OFF, they generate a reverse voltage that can damage the transistor or Arduino.
The flyback diode safely absorbs this voltage spike and protects the circuit.
DC Motor
The DC motor represents the fan.
Whenever the Arduino detects high temperature, the motor begins rotating.
Building the Project
Step 1: Assemble the Temperature Sensor
Place the LM35 on the breadboard.
Connect the VCC, Output, and GND pins according to the circuit connections.
Step 2: Build the Motor Driver Circuit
Insert the transistor onto the breadboard.
Connect the base resistor, DC motor, and flyback diode.
Double-check the transistor pin configuration before powering the circuit.
Step 3: Connect the External Power Supply
Power the motor using an external 5V supply.
Avoid powering the motor directly from the Arduino's 5V pin, as the board cannot provide sufficient current.
Step 4: Upload the Program
Connect the Arduino to your computer using a USB cable.
Upload the Arduino sketch using the Arduino IDE.
The Arduino will immediately begin monitoring the temperature.
Circuit Connections
LM35 Temperature Sensor
With the flat side of the LM35 facing you:
- Connect Pin 1 (VCC) to the 5V pin on the Arduino.
- Connect Pin 2 (Output) to Analog Pin A0 on the Arduino.
- Connect Pin 3 (GND) to the GND pin on the Arduino.
Transistor Connections
- Connect the Base of the transistor to Digital Pin 8 through a 1kΩ resistor.
- Connect the Emitter of the transistor to the GND pin on the Arduino.
- Connect the Collector of the transistor to the negative terminal of the DC motor.
DC Motor Connections
- Connect the positive terminal of the DC motor to the positive terminal of the external 5V power supply.
- Connect the negative terminal of the motor to the Collector of the transistor.
Flyback Diode Connections
- Connect the cathode (striped end) of the diode to the positive terminal of the motor.
- Connect the anode of the diode to the negative terminal of the motor.
The diode should be connected in parallel with the motor.
Common Ground
- Connect the GND of the Arduino to the negative terminal of the external power supply.
A common ground is essential for proper transistor switching.

Arduino Code
Upload the following sketch to your Arduino Uno.
// Smart Fan Using Arduino
const int sensorPin = A0;
const int fanPin = 8;
const float thresholdTemp = 30.0;
void setup() {
pinMode(fanPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
float voltage = sensorValue * (5.0 / 1023.0);
float temperature = voltage * 100.0;
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
if (temperature >= thresholdTemp) {
digitalWrite(fanPin, HIGH);
}
else {
digitalWrite(fanPin, LOW);
}
delay(500);
}
How the Code Works
The Arduino continuously reads the analog voltage from the LM35 temperature sensor.
It converts the measured voltage into temperature using the LM35's calibration of 10 mV per degree Celsius.
The measured temperature is compared with the threshold value of 30°C.
- Temperature below 30°C → Fan OFF
- Temperature equal to or above 30°C → Fan ON
The current temperature is also displayed on the Serial Monitor for debugging and calibration.
Testing the Project
Once the program is uploaded, test the following conditions.
Room Temperature Below Threshold
Expected result:
The fan remains OFF.
Increase Temperature
Warm the LM35 gently using your fingers or place it near a warm object.
Expected result:
Once the temperature exceeds the threshold, the fan starts rotating.
Cool the Sensor
Allow the sensor to cool naturally.
Expected result:
The fan switches OFF automatically.
Final Thoughts
A Smart Fan is an excellent Arduino automation project because it demonstrates how embedded systems can monitor environmental conditions and control appliances automatically. By combining a temperature sensor with a simple motor driver circuit, the system responds to changes in ambient temperature without requiring manual intervention.
For anyone interested in building a smart fan Arduino India project, this tutorial provides a solid introduction to temperature sensing, motor control, and embedded automation. Once you've mastered this build, you can expand it with variable fan speed control, IoT connectivity, or humidity monitoring to create a more advanced smart climate control system.






