Smart Fan Using Arduino | Arduino Project

by | May 24, 2022 | Arduino, Basic Coding, Coding

Introduction

In this Arduino project, we will make a Smart Fan using Arduino. For this, we will use PIR Sensor & temperature sensor to know the existence of any human in the room based on which the fan will ON or OFF w.r.t the room’s temperature. This smart fan will not only help save electricity, but it will also provide comfort and save human time to switch on and off the fan.

 

Supplies

To make a Smart Fan using Arduino, we will require the following components:

Components

Circuit Diagram

Smart Fan Using Arduino - Arduino Project

Steps To Make A Smart Fan Using Arduino

Step 1: Firstly, gather all the required components on the Digital Board or Physical Table.

DC Motor:

Step 2: Connect the one terminal of it to the GND pin of the Arduino. And connect the fan to the DC motor.

Step 3: Connect the second terminal of it to the 10 number pin of the Arduino.

PIR Sensor:

Step 4: Connect the Power terminal of it to the 5V pin of the Arduino.

Step 5: Connect the Ground terminal of it to the GND pin of the Arduino.

Step 6: Connect the Signal terminal of it to the 6 number pin of the Arduino.

Temperature Sensor:

Step 7: Connect the Power terminal of it to the 5V pin of the Arduino.

Step 8: Connect the Ground terminal of it to the GND pin of the Arduino.

Step 9: Connect the Vout terminal of it to the A0 number pin of the Arduino.

Source Code

int input = 0;
int temp = 0;
int status = 0;
float voltage = 0.0;
void setup()
{
pinMode(6, INPUT);
pinMode(A0, INPUT);
pinMode(10, OUTPUT);
}
void loop()
{
input = digitalRead(6);
status = analogRead(A0);
voltage = status * 5.0;
voltage = voltage/1024.0;


temp = (voltage - 0.5) * 100;
digitalWrite(10, LOW);


if(temp >=30 && input == HIGH)
{
digitalWrite(10, HIGH);
delay(100000);
}
else
digitalWrite(10, LOW);
}

Explanation of the Code

1. In the beginning, we have initialized variables to 0, in which we will be storing the input value from the sensors.

2. Then, we have configured pins for input and output purposes in the setup function.

3. In the loop function, we read the input from the sensor, calculate the voltage and temperature in degrees centigrade, and store the value in the input variable.

4. At last, we use the if statement to rotate the fan if the input value is high and the temperature is greater than or equal to 30 degrees celsius.

Output

We will get the following output on the successful completion of the project.

Smart Fan Using Arduino - Arduino Project

On starting the simulation, the fan will rotate if any object or human is there in the range of the sensor and the temperature is greater than or equal to 30 degrees. If no object is in the range of the sensor, the fan will not rotate. In this way, electricity will be saved.

 

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *