You are on page 1of 25

Microcontroller based fan speed controller

Acknowledgments
First of all we would like to thanks Jimma University, electrical and computer engineering
department for giving us this chance to do for community based education. Secondly our special
and heartful thanks to our adviser Doctor Eng. Tofic Jemal for his important suggestions,
corrections and comment.

Lastly we would like to thanks all our members for their effort in doing this project.

1
Abstract
Automatic controls play an ever-increasing role in a human way of life. Automatic control is
vast technological area whose central aim is to develop control strategies that improve
performance when they applied to a system. The distinct characteristic of automatic control is
that it reduces manually operating. One such gadget is the fan. This project is about how
automatically the speed of a fan can be controlled, based on temperature sensor. It is also a part
of smart home application where the fan will gradually increase its speed if the temperature is
increasing. In general, home appliance fans need to be operated manually with the help of
regulators with the variation of temperature, thus requires a repeatedly extra effort for regulating
the fan speed which acts to our agony. So as to reduce this extra effort and to add comfort, it is
intended in this paper designing an Automatic Temperature Controlled Fan. In this project the
main intension is to control the fan by heating the sensor. As the temperature of the device
increases or decreases, the speed of the fan increases or decreases respectively. So it can be used
mainly as a cooling device. Thus, it is possible to control the speed of the fan automatically when
the devices temperature varies above threshold value.

TABLE OF CONTENTS

2
Acknowledgments....................................................................................................... i
Abstract...................................................................................................................... ii
LIST OF FIGURES......................................................................................................... v
Acronomys................................................................................................................. vi
CHAPTER ONE............................................................................................................. 1
INTRODUCTION........................................................................................................... 1
1.1 Background study............................................................................................. 1
1.2 Objectives......................................................................................................... 2
1.2.1 General Objective....................................................................................... 2
1.2.2 Specific Objective..................................................................................... 2
1.3 Problem Statement.......................................................................................... 2
1.4 Methodology.................................................................................................. 3
1.5 Scope of the project.......................................................................................... 3
CHAPTER TWO............................................................................................................ 4
2. LITERATURE REVIEW............................................................................................ 4
CHAPTER 3.................................................................................................................. 5
3. COMPONENENT DESCRIPTION.............................................................................5
3.1 Fan speed control system components..........................................................5
3.2 Components used.......................................................................................... 5
3.2.1Arduino............................................................................................................ 6
3.2.2 LM35........................................................................................................... 7
3.2.3 DC fan......................................................................................................... 8
3.2.5 Diode........................................................................................................... 9
3.2.6 Resistor....................................................................................................... 9
4.1 Circuit Description........................................................................................... 11
4.2 working principle............................................................................................. 11
CHAPTER FIVE........................................................................................................... 12
SIMULATION RESULT AND DISCUSION.......................................................................12
CHAPTER SIX............................................................................................................ 15
RECOMMENDATION AND CONCLUSION.....................................................................15
6.1 Conclusion....................................................................................................... 15
6.2 Recommendation............................................................................................ 16
Reference................................................................................................................. 17

3
Appendix.................................................................................................................. 18

LIST OF FIGURES
Fig1: Block diagram of fan speed control system5

Fig2: arduino.6

Fig3: temperature sensor7

4
Fig4. DC fan..8

Fig5: LCD (2X16)..8

Fig6: Diode9

Fig7: Resistor9

Fig8. Schematic circuit diagram of fan speed control system10

Fig 9: Temperature less than 28 degree celicius.13

Fig1

.Temperature greater than 28 degree celicius................................................14

Acronomys
LCD-liquid crystal display

DC-direct current

IC-Integrated circuit

5
PWM-Pulse width modulation

6
CHAPTER ONE

INTRODUCTION
1.1 Background study
Electric fan is one of the most popular electrical devices due to its cost effectiveness and low
power consumption advantages. It is a common circuit and widely used in many applications. It
is also one of the most sensible solutions to offer a comfortable and energy efficient. In fact, the
fan has been long used and still available in the market. Nowadays, the demand for accurate
temperature control and air freshening control has conquered many of industrial domains such as
process heat, automotive, industrial places or office buildings where the air is cooled in order to
maintain a comfortable environment for its occupants. One of the most important concerns
involved in heat area consist in the desired temperature achievement and consumption
optimization. Fan can be controlled manually by pressing on the switch button. where in this
method, any change in the temperature will not give any change in the fan speed except the user
change the speed of the fan which is manually. So, an automatic temperature control system
technology is needed for the controlling purpose in the fan speed according to the temperature
changes. Many researches focusing on automatic temperature control system application in
different fields will gain the benefits. This paper will show how arduino can be used and applied
in a real-world application. One practical use is to integrate a microcontroller in a temperature
control system that can be used for automatically controlling a room temperature.

An independent control system which responses on the ambience conditions. An idea behind this
project is to control the speed of fan using microcontroller based on variation in temperature.
Temperature controlled fan is an alternative way to deal with the speed of the fan. Temperature
control is a process in which the temperature of an object is measured and the passage of heat
energy into or out of the object is adjusted to achieve a desired temperature. This project presents
the interfacing of temperature sensor with microcontroller by means of analog to digital
converter, to display the temperature on a 16x2 LCD and to rotate a fan at different speeds at
various temperatures. The pulse width modulation speed control function is a function that
externally controls the rotation speed of the fan by changing the duty cycle of the input pulse
signal between the control terminal and ground.

1
1.2 Objectives
1.2.1 General Objective

The main aim of this document is to control dc fan speed using temperature variation
control system.

1.2.2 Specific Objective

To solve a room temperature problem and find the way to improve peoples life safety.
To control the rotation speed of the fan by changing the duty cycle of the input pulse
signal.
To save energy through the projected method and to reduce power consumption.

1.3 Problem Statement


Modern electronics has provided the consumer with the ability to remotely control a variety of
household appliances. However, there has not yet been exploited with automatic control of
ventilation devices, or more particularly to the control of fans speed. In operation to control
speed a fan, it is often necessary to physically adjust the fan in order to increase the degree of
ventilation provided, or substantially change the direction of air flow. The ability to
automatically change the speed of fan via changes of surroundings temperature would allow the
user to feel comfort without physically to change the speed of fan. The automatic control of this
operation would further aid in the use of such a fan by those who are sick, handicapped or
elderly. Moreover, this device is very suitable to be used in extensive area, hospital and
childrens room. Microcontroller (Adriano) based ceiling fan is as further step to improve the
technology of a fan. This project will satisfy a person needs to make life easier and better. All the
mundane household chores are done without having to think about those works.

2
1.4 Methodology
The methodology we have followed during the development of this project which starts from
project title selection up to the complete project submission is presented in this section. First we
did appropriately select the project title. After a topic has been selected, additional discussions
were done in order to understand the concept and objective of the project. Then, literature review
was done and the background of this project was studied by referring to various sources such as
reference books, internet, lecture notes and data sheets.

1.5 Scope of the project


This project with designing of fan speed control system circuit. It gives rotate to the fan when
the temperature is greater than 28 degree celicus. This project is applicable in which the
area is in room, library, and hall. Deals designed considering simplicity as the first
priority and secondly in an economic way. So the components are also taken as simple as
possible, which are not expensive in cost and then easily available in the market. This project
develop in protuos software by adding arduino. Do so, first of all, select the components use
in this project Temperature Sensor(LM35) as the input , microcontroller(arduino), power supply,
LCD, the DC fan as the output for the system.

3
CHAPTER TWO
2. LITERATURE REVIEW
Electric fan is defined as a device used to produce airflow for the purpose of creature comfort,
ventilation, exhaust, or any other gaseous transport. Meanwhile, a ceiling fan is a device
suspended from the ceiling of a room, which employs hub-mounted rotating paddles to circulate
air in order to produce a cooling or destratification effect. The first ceiling fans appeared in the
1860s and 1870s, in the United States [2]. At that juncture, they were not powered by any form
of electric motor. Instead, a stream of running water was used, in conjunction with a turbine, to
drive a system of belts which would turn the blades of two-blade fan units. Afterwards, the
electrically-powered ceiling fan was invented in 1882 by Philip Diehl [3]. Electric fans are
designed to create a breeze and circulate air in a room. A good fan can make a room feel 10-15
degrees cooler when used properly. Electric fans are pretty simple in their design and function.
An electric motor spins the blades, which are shaped to move air from the back of the fan out
through the front of the fan. The important parts of a ceiling fan are the electric motor, paddles or
blades, down rod and switches. Since a fan creates its cooling effect by speeding, thus, the most
important part of a fan is its speed controller. Electric fan come in a different ways of operating
method, that is depend on the manufactures and style. These types of fan are typically has three
or five of speed control. Most ceiling fans sold in recent years have switch for turned the fan on
and off operation together with adjust the speed at which the blades rotate. This invention relates
to the field of devices for moving air in enclosed spaces. More particularly it relates to an
automatic microcontroller controlled fan.

The arduino microcontroller based ceiling fan is automatically switching the speed of fan
rotating according to the environment temperature changes.

4
CHAPTER 3
3. COMPONENENT DESCRIPTION
3.1 Fan speed control system components

The microcontroller arduino is the heart of the system. It accepts inputs from the temperature
sensor, LM35 which allows for the measurement of the current room temperature, and then the
controller will give the action to maintain the required fan speed. LCD is used to display the fan
speed and room temperature. All of these can be summarized in a diagram as shown in Fig. 1.

Arduino

Temperatu
FAN
re sensor
(LM35)

Fig1: Block diagram of fan speed control system

3.2 Components used

The followings are basic components used:


Arduino UNO 3 board,
Temperature sensor IC LM35,
a DC Fan,
a resistor ,
16*2 LCD Display,
a power supply and
a Diode(1N4007)

3.2.1 Arduino

5
Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Arduino
boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message and turn it into
an output, active a motor and publishing something online.

A microcontroller is a computer control system on a single chip. It has many electronic circuits
built into it, which can decode written instructions and convert them to electrical signals. The
microcontroller will then step through these instructions and execute them one by one. As an
example of this a microcontroller could be used to control the fan speed according to the
temperature of the room. Microcontrollers are now changing electronic designs. Instead of hard
wiring a number of logic gates together to perform some function we now use instructions to
wire the gates electronically. The list of these instructions given to the microcontroller is called a
program. There are different types of microcontroller, for this project focus only on the arduino
UNO3 Microcontroller where its pins as shown in fig2.
13
12

10
11

9
8

7
6
5
4
3
2
1
0

DUINO1
AREF

PB4/MISO

PB0/ICP1/CLKO

PD7/AIN1
~ PD6/AIN0
PD5/T1

~ PD3/INT1
PD2/INT0
TX PD1/TXD
RX PD0/RXD
PB5/SCK

~PB3/MOSI/OC2A
~ PB2/SS/OC1B
~ PB1/OC1A

PD4/T0/XCK

ARDUINO UNO R3
~

DIGITAL (~PWM)

ATMEGA328P-PU
1121

microcontrolandos.blogspot.com
PC4/ADC4/SDA
PC5/ADC5/SCL

ANALOG IN
PC0/ADC0
PC1/ADC1
PC2/ADC2
PC3/ADC3
RESET

A0
A1
A2
A3
A4
A5

Fig2: arduino

3.2.2 LM35

LM35 is a device which converts the physical signal into electrical signal. Thats why this is
known as the transducer. It is calibrated with the environmental temperature and it is linearly

6
varies with the temperature and its output is in volt. There is no need of external calibration to
provide the accuracy of the LM35 at room temperature which is about C. Minimum
temperature that can be measured by the LM35 device is -55C. And maximum temperature that
can be measured by LM35 is 150C. Calibration of LM35 is done by trimming at the water level.
To make the interfacing of control circuitry and readout circuitry very easy, low impedance at
output side, output which is linear and precise inherent calibration of LM35 plays an important
role. Temperature sensor takes a very low current of order 60 A from the input supply. Heat loss
in the LM35 is very less degree of around 0.1C. LM35 can work in the range of -50C to +150
which is the rated value. LM35 is a temperature sensor that is employed to measure the
temperature. It has three terminal Vcc, Output, and Ground. The output range varies by 10mV to
each fall and rise in temperature. Circuit diagram of Digital Thermometer using LM35
temperature sensor with arduino UNO is shown below: LM35 temperature sensor output voltage
has linear relationship between the Celsius temperature scale is 0C, output is 0V, and for every 1
C increases in output voltage of 10mV.

VoutLM35= (10 /)

1 U1

27.0

2
VOUT

3 LM35

Fig3: temperature sensor

3.2.3 DC fan

It is the output part of our project. The speed of the fan varies according to the change in temperature.

7
DC fan are commutated electronically; they do not use brushes so called brushless DC motor.
These motors provide better speed versus torque characteristics, noiseless operation and high
efficiency over brushed DC motors. Magnetic field generated by stator and rotor have same
frequency, so BLDC motors are synchronous motors.

+88.8
kRPM

Fig4. DC fan.

3.3.4 Liquid Crystal Display (LCD)


This component is specifically manufactured to be used with microcontrollers, which means that
it cannot be activated by standard IC circuits. It is used for displaying different messages on a
miniature liquid crystal display. It can display messages in two lines with 16 characters each.
Also it can display all the letters of alphabet, Greek letters, punctuation marks, mathematical
symbols etc. but in this project we used to display if the temperature is less than threshold fan is
off and the temperature is less greater than threshold fan is on.

LCD1
LM016L
VDD
VSS

VEE

RW
RS

D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3

4
5
6

7
8
9
10
11
12
13
14

Fig5. LCD (2 x 16 character

3.2.5 Diode

8
Diodes are electronic components that conduct current in only in one direction only. From anode
to cathode and the arrow are in the forward direction which has low resistance and one way
street current.

The main application of diode in this design is used in parallel with FAN to prevent it from the
damage and a 9V battery to provide power to the fan.

D1

1N4007

Fig6: diode
3.2.6 Resistor

Resistor is a passive component of electronic device which used to decrease or block large
amount of current passed through it to the fan.

R
1k

Fig7: Resistor

CHAPTER FOUR

9
4. FAN SPEED CONTROL SYSTEM CIRCUIT DESIGN
This section describes how the speed of fan is controlled by PWM output from microcontroller, with the
change in room temperature. The schematic circuit diagram of fan speed control system shown in Fig.

LCD1
LM016L

D1

1N4007

VDD
VSS

VEE

RW
RS

D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3

4
5
6

7
8
9
10
11
12
13
14
+88.8
1 U2
kRPM
R1
1k 26.0

2
VOUT

3 LM35

13
12

10
11

9
8

7
6
5
4
3
2
1
0
DUINO1

PB4/MISO

PB0/ICP1/CLKO
AREF

TX PD1/TXD
RX PD0/RXD
PB5/SCK

~PB3/MOSI/OC2A
~ PB2/SS/OC1B
~ PB1/OC1A

PD4/T0/XCK
PD7/AIN1
~ PD6/AIN0
PD5/T1

~ PD3/INT1
PD2/INT0
ARDUINO UNO R3

~
DIGITAL (~PWM)

ATMEGA328P-PU
1121

microcontrolandos.blogspot.com

PC4/ADC4/SDA
PC5/ADC5/SCL
ANALOG IN

PC0/ADC0
PC1/ADC1
PC2/ADC2
PC3/ADC3
RESET

A0
A1
A2
A3
A4
A5

Fig8. Schematic circuit diagram of fan speed control system

4.1 Circuit Description


In this circuit the microcontroller (ardiuno UNO3) is used to control the fan according to the
temperature variation. The LM35 function to sense the changes of temperature surrounds the
10
area. All the operations are controlled by the arduino UNO3 to produce the digital output. The
LCD is at the output where it is set with the pseudo code of arduino and it is used to measure and
show whether the fan is working or not.

4.2 working principle


The temperature sensor senses the room temperature. Any change in the temperature the sensor
(LM 35) send to the microcontroller (ARDUINO Pin) via PORTA0 pc0, which have been
specified in the program using arduino. The microcontroller used in this system has inbuilt
PWM.
The speed of the fan is controlled by using PWM technique according to the room temperature
change. For processing analog signals, microcontroller (arduino) has analog to digital converter
which converts analog signals to digital ones. The microcontroller sends the PWM signal via pin
PB5 in port c which works as switches to the fan. Vout pin of temperature sensor LM35 is
connected on pin PC0 which is ADC0. Pin 5 and pin 1 of LCD is connected to ground , the LCD
gain power using pin2, pin3 and Pins from PD2, PD3, PD4, PD5, PB3, and PB4 are connected to
the remaining LCD pins used for data transmission and to control signals and microcontroller
PWM output is given to the fan. When Arduino pin13 is on, the dc fan starts to move and this pin
is off when the temperature is less than min temperature and the fan speed deceases slowly and
stop. The software circuits that have been designed for the controlled fan speed system in this
project, which consists of the LM35, ardiuno microcontroller, DC Fan and LCD.

11
CHAPTER FIVE

SIMULATION RESULT AND DISCUSION


The speed of the fan has been controlled using PWM technique according to the room
temperature. The simulation of the system has been done on Arduino software v1.0.6 and it is
running in good agreement. The logic used in the system is verified. The fan speed is varied
according to room temperature. The design of the system presented in this paper is appropriate
according to the modern technology. Arduino board which controls all its functions is the heart of
the circuit. An IC LM35 is used as a temperature sensor. The LM-35 analog temperature device
that is interfaced to the analog pin of the Arduino board with the help of its built-in ADC. This
helps to convert all these analog reading to digital and displays on the LCD and to indicate
temperature of the device.

After the max and min temperatures are set, the Arduino program generates PWM output on the
digital output according to the temperature which is measured on LCD. As soon as generation
occurs, it is send to a DC Fan through PB5/SCK(Pin 13). Hence, the fan speed is proportional to
the temperature measured.

12
1k
R1
D1

1N4007

0.00
kRPM

AREF
13
PB5/SCK
12 1
PB4/MISO VSS
LM016L

RESET 11 2
LCD1

~PB3/MOSI/OC2A VDD
10 3
~ PB2/SS/OC1B VEE
9
~ PB1/OC1A
8 4
PB0/ICP1/CLKO RS
microcontrolandos.blogspot.com

5
RW
1121

7 6
PD7/AIN1 E
6
A0 ~ PD6/AIN0
PC0/ADC0 5 7
A1 ~ PD5/T1 D0
ATMEGA328P-PU

PC1/ADC1 4 8
A2 PD4/T0/XCK D1
PC2/ADC2 3 9
A3 ~ PD3/INT1 D2
ANALOG IN

PC3/ADC3 2 10

Fig 9: Temperature less than 28 degree celicius


A4 PD2/INT0 D3
PC4/ADC4/SDA 1 11
DIGITAL (~PWM)

A5 TX PD1/TXD D4
PC5/ADC5/SCL 0 12
RX PD0/RXD D5
13
D6
14
D7
DUINO1
ARDUINO UNO R3
1

3
26.0

VOUT
2
U2

LM35

13
Fig1
1k
R1
D1

1N4007

+0.04
kRPM

AREF
13
PB5/SCK
12 1
PB4/MISO VSS
LM016L

RESET 11 2
LCD1

~PB3/MOSI/OC2A VDD
10 3
~ PB2/SS/OC1B VEE
9
~ PB1/OC1A
8 4
PB0/ICP1/CLKO RS

microcontrolandos.blogspot.com
5
RW

1121
7 6
PD7/AIN1 E
6
A0 ~ PD6/AIN0
PC0/ADC0 5 7
A1 ATMEGA328P-PU ~ PD5/T1 D0
PC1/ADC1 4 8
A2 PD4/T0/XCK D1

.Temperature greater than 28 degree celcius


PC2/ADC2 3 9
A3 ~ PD3/INT1 D2

ANALOG IN
PC3/ADC3 2 10
A4 PD2/INT0 D3
PC4/ADC4/SDA 1 11
DIGITAL (~PWM)

A5 TX PD1/TXD D4
PC5/ADC5/SCL 0 12
RX PD0/RXD D5
13
D6
14
D7
DUINO1
ARDUINO UNO R3
1

3
31.0

14
VOUT
2
U2

LM35
CHAPTER SIX

RECOMMENDATION AND CONCLUSION


6.1 Conclusion
Basic idea of this project is to run the DC fan when temperature sensed by the temperature
sensor is greater than threshold value. A novel design of speed control of fan based on
temperature using PWM technique is proposed. The simulation of the system is working
properly and the design is appropriate according to the modern needs and technology. Moreover,
the fan speed will increase automatically if the temperature room increases. The speed of fan
depends on the surrounding temperature and there is no need for regulating the speed manually.

15
6.2 Recommendation
This is an interesting project, and we recommend that it is better to be done in hardware
implementation rather than software implementation. But it has also some shortcomings. One of
its shortcoming as observed is that the fan is not automatically stopped below the threshold
value (temp <27C) and that the speed of the fan is not displayed in relation with temperature
variation. So for those who extend their further work on this circuit they have to consider those
shortcomings to make the device effective.

16
Reference
[1] Data sheet, LM35 Precision Centigrade Temperature Sensors, National Semiconductor, Nov.,
200

[2] B. LEVRD and C. BUDACIU, The Design Of Temperature Control System Using
Pic18f46201, ICSTC, PP 282286, 2010

[3] J.E. Johnson, P.F. Maccarini, D. Neuman, P.R. Stauffer, Automatic Temperature Controller
for Multielement Array Hyperthermia Systems, IEEE Transactions on Biomedical Engineering,
pp. 1006-1015, 2006.

[4]Vaibhav Bhatia and Pawan Whig, A Secured Dual Tone Multifrequency Based Smart
Elevator Control System," International Journal of Research in Engineering and Advanced
Technology, Volume 1, Issue 4, Aug-Sept,2013

17
Appendix
Code for fan speed controller:

#include<LiquidCrystal.h>

int A=0;

int B;

int sensorpin=A0;

int fan= 13;

int min_temp=28;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()

lcd.begin(16,2);

pinMode(fan,OUTPUT);

void loop()

A=analogRead(sensorpin);

B=(A/2);

if(B < min_temp){

digitalWrite(fan,0);

lcd.setCursor(0,0);

lcd.println("fan is off");}

if(B > min_temp)}

digitalWrite(fan,HIGH);

lcd.setCursor(0,0);

lcd.println("fan is on");

18