Skip to content

1.13. Smart Fan Indicator

Description In this project, learners will build an automatic cooling system that switches on a DC fan whenever the temperature exceeds a predefined limit. The system continuously monitors temperature using a temperature sensor and activates a motor-driven fan when cooling is required. This project introduces environmental automation and demonstrates how sensor data can directly control mechanical devices.
Use case This project is connected to real-world uses such as: cooling systems in computers, air conditioners, incubators, and industrial equipment.

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires DC Motor Temperature Sensor Fan Blades

| --------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |

Building the circuit

Things Needed:

  • Arduino Uno = 1
  • Arduino USB cable = 1
  • Bread Board = 1
  • Jumper Wires
  • Temperature Sensor
  • DC Motor
  • Fan Blade

Mounting the component on the breadboard and wiring the circuit

Step 1: Place the temperature sensor (LM35 or equivalent) on the breadboard and prepare the DC motor for connection. Connect the VCC pin to 5V on the breadboard using a jumper wire of the temperature sensor.

Components on breadboard

Step 2: Connect the GND pin of the temperature sensor to GND on the Arduino Uno board using a jumper wire.

Components on breadboard

Step 3: Connect the OUT pin of the temperature sensor to A0 on the Arduino Uno board using a jumper wire.

Components on breadboard

Step 4: Connect one lead of the DC motor to Pin 9 on the Arduino Uno board and the other lead to GND using jumper wires.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.


// Temperature sensor connected to A0
int tempPin = A0;
// Motor control pin
int motorPin = 9;
// Temperature threshold
float threshold = 30.0;
void setup() {
 // Set motor pin as output
 pinMode(motorPin, OUTPUT);
 // Start serial monitor
 Serial.begin(9600);
}
void loop() {
 // Read sensor value
 int sensorValue = analogRead(tempPin);
 // Convert to voltage
 float voltage = sensorValue * (5.0 / 1023.0);
 // Convert voltage to temperature
 float temperature = voltage * 100;
 // Display temperature
 Serial.print("Temperature: ");
 Serial.println(temperature);
 // Check threshold
 if (temperature >= threshold) {
   // Turn fan ON
   digitalWrite(motorPin, HIGH);
 } else {
   // Turn fan OFF
   digitalWrite(motorPin, LOW);
 }
 delay(500);
}

Step 3: Save your code. See the Getting Started section

Step 4: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.

Step 5: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code

CONCLUSION

When the temperature is below 30°C, the fan remains OFF. As the temperature rises above 30°C, the motor starts rotating. Temperature readings update continuously in the Serial Monitor.