Temperature Based Fan Speed Control System
This Project demonstrate how to build a Fan Speed Controller which responds to the surrounding temperature.Keep in mind that this is for small room cooler fan and not suitable for storage areas or use as exhaust fans.
Normally we detect a huge difference even when the temperature around us changes by few degrees.
This system is designed to respond to 24° Celsius to 30° Celsius range.
The indication LEDs indicate whether the fan is stopped,running or running at full speed (Temperature is above 30°C).
Tools & Components
1 X Arduino Uno1 X L293D Motor Shield
1 X DS18B20 Temperature Sensor
1 X 12VDC Fan (Metal Propeller fan is Recommended)
1 X Red LED
1 X Green LED
1 X Blue LED
12VDC Power Source
Connecting Wires
This is the L293D Motor Shield which used for this project :
Connecting Components
Temperature Sensor Signal In to Arduino pin D02
Blue LED to Arduino Pin A0
Green LED to Arduino Pin A01
Red LED to Arduino Pin A02
Temperature Sensor Must Not contained in a confined space. It should be able to sense the surrounding temperature, hence keep the sensor exposed to the surrounding.
Connect DC Fan to M02 Terminals of Motor Shield
You can Extend the numbers of fans up to 4 and control their speeds because motor shield allows four DC motors.
Alternate the Arduino Code for Control up to four fans if nedeed.
Arduino Code
//Before uploading arduino code add following three libraries#include <OneWire.h>
#include <DallasTemperature.h>
#include <AFMotor.h>
AF_DCMotor motor(2, MOTOR12_64KHZ);
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
Serial.begin(9600);
sensors.begin();
}
void loop(void){
sensors.requestTemperatures();
Serial.print("Celsius temperature: ");
Serial.print(sensors.getTempCByIndex(0));
Serial.print(" - Fahrenheit temperature: ");
Serial.println(sensors.getTempFByIndex(0));
delay(1000);
if (sensors.getTempCByIndex(0)<=24)
{motor.setSpeed(0);
motor.run(RELEASE);
analogWrite(A0, 0);
analogWrite(A1, 0);
analogWrite(A2, 255);
}
else if ((24<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=25))
{motor.setSpeed(70);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if ((25<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=26))
{motor.setSpeed(120);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if ((26<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=27))
{motor.setSpeed(140);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if ((27<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=28))
{motor.setSpeed(160);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if ((28<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=29))
{motor.setSpeed(180);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if ((29<sensors.getTempCByIndex(0)) && (sensors.getTempCByIndex(0)<=30))
{motor.setSpeed(200);
motor.run(FORWARD);
analogWrite(A1, 255);
analogWrite(A0, 0);
analogWrite(A2, 0);
}
else if (30<sensors.getTempCByIndex(0))
{motor.setSpeed(255);
motor.run(FORWARD);
analogWrite(A1, 0);
analogWrite(A0, 0);
analogWrite(A2, 255);
}
}
Safety First !
Even this is an ELV Project, always Connect the power supply if you are absolutely sure that the components are connected correctly without changing polarity and short circuited the wiring.
Even if it seems nothing is wrong : DOUBLE CHECK EVERYTHING !!Your Feedback is very important to us.
Please Leave a comment about how you feel about this project.
Post a Comment