Skip to content
Free Delivery on Orders Above Rs 999/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA

I Built a Smart Fan Using Arduino

I Built a Smart Fan Using Arduino
-
Written By - Robocraze -
📅 Updated on 15 Jul 2026
Summarize with AI
✅ Prompt copied

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.

I Built a Smart Fan Using Arduino - Cover image

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.

Smart Fan Work Using Arduino

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

Arduino Uno R3 Board compatibleArduino Uno R3 Board compatible

    Arduino Uno R3 Board compatible

    Arduino Uno R3 Compatible Board  The Arduino Uno R3 CH340G ATMEGA328P Development Board is more than just a microcontroller board; it's a gateway to endless possibilities in the world of electronics and programming. For hobbyists, students, and makers, it stands out as the best Arduino...
    Rs 383/-
    Rs 383/-
    Rs 699/-
    Save Rs 316/-
    2N2222A NPN Transistor (5PC) – Versatile NPN transistor. -Basic Components -Robocraze2N2222A NPN Transistor (5PC) – Versatile NPN transistor. -Basic Components -Robocraze

    2N2222A NPN Transistor (Pack of 5)

    2N2222A NPN Transistor (Pack of 5) The PN2222A is a common NPN BJT used for general purpose low-power amplifying or switching applications. It is designed for low to medium current, low power, and medium voltage, and can operate at moderately high speeds. 2N2222A is...
    Rs 90/-
    Rs 90/-
    Rs 106/-
    Save Rs 16/-
    1k Ohm Resistor (10PC) – Versatile resistors for projects. -Basic Components -Robocraze1k Ohm Resistor (10PC) – Versatile resistors for projects. -Basic Components -Robocraze

    1k Ohm Resistor - (Pack of 10)

    1k Ohm Resistor - (Pack of 10) A 1k Ohm resistor is an electronic component that is used to reduce the flow of electric current in a circuit. It is a passive component that is designed to resist the flow of current, and it...
    Rs 12/-
    Rs 12/-
    Rs 19/-
    Save Rs 7/-
    🏆 Best seller
    ESP32 NodeMCU Dev Board (CP2102, 30-Pin) – WiFi & BLE support. -Nodemcu ESP Board -RobocrazeESP32 NodeMCU Dev Board (CP2102, 30-Pin) – WiFi & BLE support. -Nodemcu ESP Board -Robocraze

      ESP32 NodeMCU Development Board with Wi-Fi & Bluetooth (CP2102, 30-Pin)

      ESP32 NodeMCU Development Board with Wi-Fi & Bluetooth (CP2102, 30-Pin) The ESP32 NodeMCU Development Board (30-Pin) is a powerful Wi-Fi and Bluetooth-enabled microcontroller designed for IoT, automation, robotics, smart home, industrial monitoring, and embedded system development. Powered by Espressif's dual-core ESP32 processor, it delivers...
      Rs 383/-
      Rs 383/-
      Rs 597/-
      Save Rs 214/-
      DHT22 Temperature Sensor – Digital humidity and temperature sensor for Arduino and IoT applications -RobocrazeDHT22 Temperature Sensor – Digital humidity and temperature sensor for Arduino and IoT applications -Robocraze

      DHT22 Temperature Sensor

      DHT22 Temperature Sensor DHT22 Sensor is a premium quality Humidity & Temperature Sensor from Techtonics. Moglix is a well-known e-commerce platform for a qualitative range of Humidity & Temperature sensors. All DHT22 sensors, TECH1120 are manufactured by using quality-assured material and advanced techniques, which...
      Rs 131/-
      Rs 131/-
      Rs 199/-
      Save Rs 68/-
      12V 4CH Relay Board – 4-channel 12V relay board for Arduino and Raspberry Pi. -Relay Module -Robocraze12V 4CH Relay Board – 4-channel 12V relay board for Arduino and Raspberry Pi. -Relay Module -Robocraze

        12V 4CH Relay Board

        12V 4CH Relay Board This is a 12V 4-Channel Relay interface board. It can be used to control various appliances and other equipment with large current. The 4 channel relay board can be controlled directly by Micro-controller (Arduino, 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic)....
        Rs 175/-
        Rs 175/-
        Rs 249/-
        Save Rs 74/-
        0.96" 6-Pin OLED Display – OLED screen for Arduino, ESP32 & Raspberry Pi.-OLED Display -Robocraze

          0.96in 6 pin OLED Display

          0.96in 6 pin OLED Display This is the 0.96 inches (2.44 cm) OLED Display Module is a precise small, This OLED module can be interfaced with any microcontroller using SPI protocol. It is having a resolution of 128x64. OLED (Organic Light-Emitting Diode) is a self-lighting...
          Rs 231/-
          Rs 231/-
          Rs 405/-
          Save Rs 174/-

          Components Required

          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.

          Circuit Connections Diagram

          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.

          Excerpt

          Looking for a smart fan Arduino project? Build a temperature-controlled fan with LM35, DC motor, and transistor. Full circuit, code, and testing guide.
          Prev Post
          Next Post

          Leave a comment

          Please note, comments need to be approved before they are published.

          Thanks for subscribing!

          This email has been registered!

          Shop the look

          Choose Options

          Edit Option
          Back In Stock Notification
          Compare
          Product SKU Description Collection Availability Product Type Other Details

          Choose Options

          this is just a warning
          Login
          Shopping Cart
          0 items
          FREE SHIPPING!
          ₹100 OFF
          ₹200 OFF
          ₹999
          ₹2500
          ₹4900
          WhatsApp Chat Chat