Only
Temperature Based Fan Speed
Control & Monitoring With Arduino
2
‘Alex Newton Last Updated: May 17, 2020 33 #9447 PA minute read
Table of Contents [hide]1 Temperature Based Fan Speed Control & Monitoring With Arduino:
2 Bill of Materials
3 Circuit Diagram & Connections
4 Working of the Circuit:
5 Source Code/Program:
6 Video Tutorial & Explanation:
Temperature Based Fan Speed Control &
Monitoring With Arduino:
In this post, we have described how to design Temperature Based Fan
Speed Control & Monitoring With Arduino and LM35 Temperature
Sensor. The microcontroller controls the speed of an electric fan
according to the requirement & allows dynamic and faster control
and the LCD makes the system user-friendly. Sensed temperature in
Celsius Scale and fan speed in percentage are simultaneously
displayed on the LCD panel.
The applications areas of this project are air-conditioners, water-
heaters, snow-melters, ovens, heat-exchangers, mixers, furnaces,
incubators, thermal baths, and veterinary operating tables.
Bill of Materials
COMPONENTS
S.N. DESCRIPTION Quantity @Mazor
NAME
1 Arduino Board = Arduino UNO. 1 https://amzr
R3
Development
BoardS.N.
COMPONENTS
NAME
Temperature
Sensor
Fan
LCD Display
Potentiometer
Transistor
Resistor
Diode
Capacitor
LED
Power Supply
Connecting
Wires
DESCRIPTION
LM35 Analog
Temperature
Sensor
12V DC Fan
JHD162A 16x2
LCD Display
10K
2N2222 NPN
Transistor
1K
1N4007
10uF
Electrolytic
Capacitor
5mm LED Any
Color
12v
Battery/Adapter
Jumper Wires
QUANTITY
20
amazor
—
https://amzr
https://amzr
https://amzr
https://amar
https://amzr
https://amzr
https://amzr
https://amzr
httpsi//amzr
https://amzr
https://amarCOMPONENTS
SIN. DESCRIPTION quantity @Mazor
NAME —
13. Breadboard = - 1 https://amzr
Homes Starting 3(
Affordable Apartments in
Kanakapura Road. Pay in 2
Easy Instalments.
Prestige Group
16-200 oe Fan 127
* e a
LM35 1N4007 Diode 22222 Transistor 1K Resistor - 2
@ -
10UF Capactr Leo 12 Vot Battery
Circuit Diagram & Connections:pea
Circuit diagram of the Temperature Based Fan Speed Control &
Monitoring With Arduino & LM35 is shown above. Arduino is at the
heart of the circuit as it controls all functions. LM35 is a precision
integrated-circuit whose output voltage is linearly proportional to
Celsius (Centigrade) temperature. It is rated to operate over a -55°C
to 150°C temperature range. It has +10.0mV/Celsius linear-scale
factor.
The 2N2222 transistor acts as a switch and controls the fan speed
depending upon temperature. 1N4007 diode controls the fan from
being damaged. The LED glows whenever the temperature exceeds
60°C.Working of the Circuit:
Temperature sensor LM35 senses the temperature and converts it into
an electrical (analog) signal, which is applied to the ATmega328
microcontroller of the Arduino UNO Board. The analog value is
converted into a digital value. Thus the sensed values of the
temperature and speed of the fan are displayed on the LCD. When
the temperature exceeds 30°C the fan starts rotating.
‘A low-frequency pulse-width modulation (PWM) signal, whose duty
cycle is varied to adjust the fan's speed is used. An inexpensive, single,
small pass transistor-like 2N222 or BD139 can be used here. It is
efficient because the pass transistor is used as a switch.
Homes Si
Affordable Apai
Kanakapura Ro
Easy Instalmen
Prestige GroupSU80K - Available - Starting at: $Submit for Pric
Tripp Lite ® Authorized Distributor
onlinecomponents.com
Source Code/Program:
The program for Temperature Based Fan Speed Control & Monitoring
With Arduino is given below. Simply copy this code and paste it inyour Arduino IDE. Then compile the code and then upload it.
include
Liquidcrystal 1ed(2,3,4,5,6,7);
int tempPin = AO; // the output pin of LM35
int fan = 11; // the pin where fan is
lint led = 8; // led pin
int temp;
Jint tempMin = 30; // the temperature to start the fan 0%
|int tempMax = 60; // the maximum temperature when fan is at 10]
int fanspeed;
int fanLep;
void setup() {
pinode(fan, OUTPUT) ;
pinMode(led, OUTPUT) ;
pinMode(tempPin, INPUT) ;
lcd. begin(16, 2);
Serial. begin(9600) ;
}
void 1oop()
{
temp = readTemp(); // get the temperature
Serial.print( temp );
Jif (temp < tempMin) // if temp is lower than minimum temp
C
fanspeed = 0; // fan is not spinning
lanalogwrite(fan, fanspeed);
fani.cD=0;
digitalwrite(fan, LOW);
}
Jif((temp >= tempMin) && (temp <= tempMax)) // if temperature jj
{
fanSpeed = temp;//map(temp, tempMin, tempMax, 0, 100); // the
.5*fanSpeed;
map(temp, tempMin, tempMax, 0, 100); // speed of fan
janalogwrite(fan, fanSpeed); // spin the fan at the fanSpeed sp|
}
Jif (temp > tempax) // if temp is higher than tempMax
t
digitalwrite(1ed, HIGH); // turn on led1}
else // else turn of led
{
digitalwrite(led, LOW);
}
lcd. print("TEMP: ");
licd.print(temp); // display the temperature
lcd. print("c ");
jicd.setCursor(0,1); // move cursor to next line
lcd. print("FANS: ");
licd.print(fanicb); // display the fan speed
lcd. print("%");
ldelay(200) ;
icd.clear();
}
lint readtemp() { // get the temperature and convert it to cels|
temp = analogRead(tempPin) ;
return temp * 0.48828125;
Video Tutorial & Explanation:
SU80K - Available
Tripp Lite ® Authorized Distributor
onlinecomponents.com OPEN
Temperature Based Fan Speed Control & Monitoring With Arduino