MP PROJECT
MP PROJECT
AND
MICROCONTROLLERS
LAB
PROJECT ABSTRACT
DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ENGINEERING
TKM COLLEGE OF ENGINEERING KOLLAM
SEMESTER:5
CLASS: E5 B
GROUP MEMBERS:
• Afzal Mohammed A S (10)
• Abel M Sajeev(1)
• Hadhi Ismail(35)
• Safwan V(75)
• Gokul Krishna P(33)
PROJECT TOPIC: Arduino Based Fan Speed control
Aim
To design and implement a system that controls and monitors the
speed of an electric fan based on the surrounding temperature using
an Arduino microcontroller and an LM35 temperature sensor. The
system should display the sensed temperature and fan speed on an
LCD screen.
Introduction
Temperature-based fan speed control is essential in various
applications where temperature regulation and energy efficiency are
priorities. This project aims to provide dynamic and automatic
control of a fan's speed based on real-time temperature input. The
Arduino microcontroller plays a pivotal role in interpreting
temperature data and adjusting the fan's speed using pulse-width
modulation (PWM).
Components Required
• Arduino UNO Board (ATmega328)
• LM35 Temperature Sensor
• 2N2222 Transistor (or BD139)
• 1N4007 Diode
• 16x2 LCD Display
• LED Indicator
• Fan (DC motor)
• Resistors and Capacitors
• Connecting wires
• Breadboard or PCB
• Power supply (5V)
Circuit Description
The core of this project is the Arduino UNO microcontroller, which
receives temperature data from the LM35 sensor. The LM35 is
chosen for its precision and linear response to temperature,
producing an output of +10.0mV per degree Celsius. The 2N2222
transistor acts as a switch, modulating the power supplied to the fan
based on temperature readings. A 1N4007 diode is used for back
EMF protection to prevent damage to the fan circuit.
An LED serves as an indicator to show when the temperature
surpasses 60°C. The analog signal from the LM35 is converted to a
digital value within the Arduino, which then adjusts the PWM signal's
duty cycle to control the fan speed. The system is programmed to
start the fan when the temperature exceeds 30°C, and the LCD
display shows both temperature (°C) and fan speed (%).
Working Principle
• The LM35 sensor detects the ambient temperature and outputs
an analog voltage proportional to the temperature.
• This voltage is fed into the Arduino's analog input, where it is
converted to a digital value using an ADC (analog-to-digital
converter).
• The Arduino calculates the temperature in degrees Celsius and
determines the appropriate PWM duty cycle to control the fan
speed.
• A PWM signal is sent to the 2N2222 transistor, which
modulates the fan's speed by switching it on and off at varying
frequencies.
• An LED lights up when the temperature crosses 60°C as a visual
alert.
Software Implementation
The Arduino is programmed using the Arduino IDE, and the code
includes:
• ADC conversion of the temperature sensor's analog output.
• Calculation logic to determine the PWM signal based on the
temperature.
• LCD library to display temperature and fan speed.
• Conditional checks to trigger the LED when the temperature
exceeds 60°C.
Applications
This temperature-based fan control system has applications in:
• Air conditioners
• Water heaters
• Snow-melters
• Ovens and heat exchangers
• Industrial mixers and furnaces
• Incubators and thermal baths
• Veterinary operating tables
Circuit Diagram
void setup() {
pinMode(fan, OUTPUT);
pinMode(led, OUTPUT);
pinMode(tempPin, INPUT);
lcd.begin(16,2);
Serial.begin(9600);
}
void loop()
{
temp = readTemp(); // get the temperature
Serial.print( temp );
if(temp < tempMin) // if temp is lower than minimum temp
{
fanSpeed = 0; // fan is not spinning
analogWrite(fan, fanSpeed);
fanLCD=0;
digitalWrite(fan, LOW);
}
if((temp >= tempMin) && (temp <= tempMax)) // if temperature is
higher than minimum temp
{
fanSpeed = temp;//map(temp, tempMin, tempMax, 0, 100); // the
actual speed of fan//map(temp, tempMin, tempMax, 32, 255);
fanSpeed=1.5*fanSpeed;
fanLCD = map(temp, tempMin, tempMax, 0, 100); // speed of fan to
display on LCD100
analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
}
lcd.print("TEMP: ");
lcd.print(temp); // display the temperature
lcd.print("C ");
lcd.setCursor(0,1); // move cursor to next line
lcd.print("FANS: ");
lcd.print(fanLCD); // display the fan speed
lcd.print("%");
delay(200);
lcd.clear();
}
Future Scope
• Integrating wireless control and monitoring using IoT.
• Adding more sensors for enhanced precision.
• Implementing a more robust display interface, such as an OLED
screen or smartphone application.