IONOTS

Fan/Motor speed control with change in Temperature

In this project, you will learn how to control speed of the motor/fan automatically with respect to the change in the temperature using Arduino and LM35

Problem 

It’s too chilled, too hot, moderate. Its the change in mood in a single night and we get up plenty of times to control the fan speed which causes a sleep disorder.

Solution

Come on let’s solve this with the skills we developed till now. Here we start monitoring the temperature and according to the change in temperature, we adjust the speed of the fan with Arduino PWM (pulse width modulation) control

Requirements:

5v-2A power adapter
arduino nano or Arduino Uno
connecting wires/jumper wires
LM35
10k resistor
Diode Rectifier 1A-50V
N-channel MOSFET 60v 30A

Construction:

NOTE:  Here we are connecting the ground terminal of the motor to the Arduino PWM pin. The amount of  PWM to the ground is inversely proportional to the speed of the motor.

Process:

Here we continuously measure the temperature in the room using the LM35 sensor and for a particular level of change in the temperature, we adjust the speed of fan using PWM control.

Reference:

For a brief video on PWM click here.

For AC power control with PWM check here, here.

Code:

int val;
int tempPin = A3;
int fanPin = 5;   // to Digial pin 5 

void setup()
{
Serial.begin(9600);
pinMode(fanPin, OUTPUT);
pinMode(tempPin, INPUT);
}

void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000; // measuring in milli volts
float cel = mv/10;             // converting to celcius
float farh = (cel*9)/5 + 32;   // converting to faranheat

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
if(cel > 30){
 analogWrite(fanPin, 0);  
 //---------------------------- NOTE -------------------------------------- 
 //| 0 is equal to LOW, Ground pin is 0 i.e fully grounded             |
 //|(arduino output pins cotrolled with pwm and resolution is 8bit)    | 
 //---------------------------- NOTE -------------------------------------
Serial.print('running at maximum speed');
}
else if(cel <30 && cel >25){   // between 25 and 28
   analogWrite(fanPin, 100);
   Serial.print('fan is at 75% speed');
}
else if(cel >25 && cel <20){
   analogWrite(fanPin, 150);
   Serial.print('fan is at 50% speed');
}
else if(cel >15 && cel <20){
   analogWrite(fanPin, 200);
   Serial.print('fan is at 25% speed');
}
else if(cel < 15){
   analogWrite(fanPin, 255);
   Serial.print('fan is off');
}
delay(10000);
}

In this example, we showed you how to control a dc motor with MOSFET. In the same way, you can even control AC fans by changing MOSFET according to your fan specifications.

–ABHIJITH 

Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp