Professional Documents
Culture Documents
Microcontroller Based Automatic Room Temperature Controller Enyew
Microcontroller Based Automatic Room Temperature Controller Enyew
Microcontroller Based Automatic Room Temperature Controller Enyew
Temperature Controller
A project report
Submitted by
ENYEW EJIGU
TOLAMARIAM LELLISA
ESUBALEW TSEHAY
In partial fulfillment for the award of the degree
Of
BACHELOR OF TECHNOLOGY
IN
ELECTRICAL POWER ENGINEERING
At
BISHOFTU
JUNE 2018
i
DECLARATION
We declare that the project titled “microcontroller based automatic room temperature controller”
is submitted to the Department of Electrical power Engineering, DUEC for the fulfillment of
degree in Bachelors of Science in Electrical power Engineering. In addition, we announce that
this is our unique work and has not been submitted anywhere for the honor of any other degree
or any other publication.
Name signature date
Enyew Ejigu _________ ________
Esubalew Tsehay _________ ________
Tolamariam Lellisa _________ ________
Signature of the advisor
i
CERTIFICATE
This is to certify that the project report entitled “Microcontroller based automatic room
temperature controller” is a record of work carried out by the following students of B.
Technology at defense University, college of Engineering, Bishoftu, during the year 2018.
1. Enyew Ejigu…………………………...REG 323/06
2. Esubalew Tsehay……………………..REG 324/06
3. Tolamariam Lellisa…………………...REG 336/06
In partial fulfilment of the requirements for the award of bachelor of technology in Electrical
Engineering and the project has not formed the basis for the award previously of any degree,
diploma, fellowship or any other similar rule.
ii
Acknowledgement
Great thanks to God for seeing us through our study. We are definitely grateful to a number of
people for all the help provided in the course of this project. First and foremost we would like to
thank our advisor Major Ashebir Kelibe for taking time to guide us through this project. And
also we would like to thank Capt. Berhe G/Her for his support throughout our work. Our
appreciation also goes to all lectures, assistances and our fellow students of our department.
Finally, we must acknowledge with due respect the constant supports and patience of our
parents.
iii
ABSTRACT
Basically in this project we will be controlling fan speed with respect to the temperature. The
system will get the temperature from the temperature Sensor and it will control the speed
according to the temperature, set by the user. In this project, microcontroller forms the
processing part, which firstly senses the temperature and the controller then compares the data
with the set temperature. If the current temperature is greater than the set temperature, the
controller turns ON the fan and the set speed will be proportional to the difference between the
set temperature & the current temperature. If the current temperature is less than the set
temperature, the fan will be turned OFF and the heater is ON. The fan’s speed will change
according to the temperature.
Keywords: Microcontroller, speed, temperature, Liquid Crystal Display ( LCD), sensor
iv
TABLE OF CONTENT
Contents Page
DECLARATION ........................................................................................................................... i
CERTIFICATE ............................................................................................................................. ii
Acknowledgement ......................................................................................................................... ii
ABSTRACT .................................................................................................................................. iv
INTRODUCTION ........................................................................................................................ 1
1.1Background ................................................................................................................................ 1
v
3.2 Block diagram description ........................................................................................................ 7
3.3.12 DC Fans.................................................................................................19
Reference ..................................................................................................................................... 40
vii
LIST OF FIGURES
viii
LIST OF TABLE
ix
LIST OF ACRONYMMS
μc Microcontroller
IC Integrating circuit
°C Degree celicus
DC Direct current
RS Register select
R/W Read/Write
EN Enable
H High
IC Integrated circuit
KB Kilo byte
COM Common
NC Normally closed
NO Normally open
x
dB decibel
RX Receiver
TX Transmitter
xi
i
1
CHAPTER ONE
INTRODUCTION
1.1Background
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 desertification effect. The first ceiling fans appeared in the
1860s and 1870s, in the United States. At that time, 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. 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. The conventional fans are operated by
pull-chain control or capacitor-stepped wall control. In contemporary day nowadays, a luxurious
feature offered on many modern ceiling fans that speed is controlled by the hand-held wireless
remote control. 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 microcontroller based ceiling fan is automatically switching the speed of fan rotating
according to the environment temperature changes. This project is as further step for developing
a smart home technology by fulfilling the requirement of technologies “tomorrow will be more
advanced than today”. [8]
However the concept of this project is to create an Automatic Temperature Control System to
control the temperature of a system. The circuit maintains the temperature of the system in a
particular range. The fan RPM increases with increase in temperature and vice versa. For the
1
circuit, it consists of Temperature Sensing Unit, arduino , LCD Module, Driver, LED, heater
and a fan. It will operate based on the values or ranges of temperature in the system which is
detected by the Temperature Sensor.
The Temperature Sensor detects the temperature of the system. The temperature Sensor consists
of an LM35 IC. The temperature sensor is connected to the ADC input of the μ C. It converts the
analog input to a digital value. The arduino microcontroller generates PWM according to the
temperature sensor value. The PWM generated output control signals are sent to the Motor
Driver IC L293D. Motor Driver ICL293D is fed with the PWM generated output from
microcontroller. By using the L293D, a dc motors can be connected. The speed of the fan is
controlled by the ON time of the PWM generated by the controller. With increasing ON time, the
speed of the fan increases reducing the temperature of the system and when the temperature
becomes bellow the lower limit of normal range of temperature the arduino microcontroller
generates digital signal and sent to the transistor. The transistor amplifies this signal and sent to
relay, then the relay energizes and closes its contact and then the heater turns on. The LCD
module is connected to the microcontroller. The LCD module displays the current temperature.
The LCD display used is a 16x2 Alphanumeric Display with codeLM016L. It is a parallel LCD
which is connected to the microcontroller I/O ports. The Led is also connected to the
microcontroller and used to show the temperature status. [8]
2
1.3 Objective of the Project
1.3.1 General objective
The General objective of this project is to design and simulate microcontroller based automated
room temperature control system.
1.4 Methodology
While performing the project we have followed the following procedures:
Literature review to understand the concept and functionality of the project.
Understand the whole system of hardware and software in sequences.
Design the circuit and develop the programming.
Testing the system functionality.
Combining both the circuit and software system.
3
1.6 Scope of the project
The scope of this project is to study and design “microcontroller based automatic room
temperature controller”. The components to be studied in this project are temperature sensor,
arduino microcontroller, LCD screen, motor driver, fan, heater and power circuit.
4
CHAPTER TWO
THEORY AND LITERATURE REVIEW
2.1 Theory of Temperature
Temperature is the physical property of a system which underlies the common notions of "hot"
and "cold"; the material with the higher temperature is said to be hotter whereas the material with
the lower temperature is said to be cooler. Temperature is a measure of the average kinetic
energy of the particles in a sample of matter. In other words, temperature is a measure of activity
and the frequency of collisions of molecules. The formal properties of temperature are studied in
thermodynamics. Formally, temperature is that property which governs the transfer of thermal
energy, or heat, between one system and another. When two systems are at the same
temperature, they are in thermal equilibrium and no heat transfer will occur. When a temperature
difference does exist, heat will tend to move from the higher-temperature system to the lower
temperature system, until thermal equilibrium is established. This heat transfer may occur via
conduction, convection or radiation. Temperature is related to the amount of thermal energy or
heat in a system. As more heat is added the temperature rises, similarly a decrease in temperature
corresponds to a loss of heat from the system. On the microscopic scale this heat corresponds to
the random motion of atoms and molecules in the system. Thus, an increase in temperature
corresponds in an increase in the rate of movement of the atoms in the system.
5
In commercial sector, electricity that is needed to operate fan motors composes a large portion of
energy costs for space conditioning. In home application, most of us use fan rather than air
conditioner because it is more economical.
6
CHAPTER THREE
BLOCK DIAGRAM AND SYSTEM COMPONENT DESCRIPTION
Temperature
Sensor LCD
(LM35) Display
Motor
Microcontroller Driver FAN
(Arduino uno) (L293D)
Power
Supply
5V
HEATER
GSM
Module
7
temperature of the system. The arduino generates digital signal to turn on the heater when the
temperature is below the lower limit of the normal temperature range.
3.3 SYSTEM COMPONENTS
3.3.1LM35
LM35 is a device which converts the physical signal into electrical signal. That’s why this is
known as the transducer. It is calibrated with the environmental temperature and it is linearly
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 -55°C. And maximum temperature that
can be measured by LM35 is 150°C. 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.1°C. LM35 can work in the range of -50°C to
+150° which is the rated value. Another device which is also a temperature sensor of the family
of LM35 known as LM35C which ranges from -40°C to +110°C. LM35 costs around 10 rupees
in India and is easily available in the market which anyone can buy at any convenience store or
electronics store.
8
3.3.2 Lm35d features:-
Low cost
Accuracy is about ±¼°C
It can measure the temperature from -55°C to 150°C
The current drawn from the supply is very less about 60 μA
There is negligible heat in LM35
Low impedance output; for a load of 1 mA about 0.1 ohm.
Calibrated linearly with Celsius.
Input voltage can vary from 4 volts to 30 volt
It has an output voltage that is proportional to the Celsius temperature.
The scale factor is .01V/ .
The output voltage is converted to temperature by a simple conversion factor.
The sensor has a sensitivity of 10mV / .
Use a conversion factor that is the reciprocal that is 100o /V.
The general equation used to convert output voltage to temperature is:
Temperature ( ) = V out * (100 /V)
So if V out is 1V , then, Temperature = 100
The output voltage varies linearly with temperature
9
allowing control of light at the pixel level, greatly improving LCD’s ability to display small-
sized fonts and image clearly. Other advances have allowed LCD’s to greatly reduce liquid
crystal cell response times. Response time is basically the amount of time it takes for a pixel to
“change colors”, in reality response time is the amount of time it takes a liquid crystal cell to go
from being active to inactive. This is due to the following reasons: The declining prices of LCDs.
The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are
limited to numbers and a few characters.
An intelligent LCD display of two lines, 20 characters per line that is interfaced to the
microcontroller. Incorporation of a refreshing controller in to the LCD, there by relieving the
CPU to keep displaying the data. Ease of programming for characters and graphics.
Most of the LCD modules conform to a standard interface specification. A 14-pin access is
provided having eight data lines, three control lines and three power lines. The connections are
laid out in one of the two common configurations, either two rows of seven pins, or a single row
of 14 pins. One of these pins is numbered on the LCD’s printed circuit board (PCB), but if not, it
is quite easy to locate pin1. Since this pin is connected to ground, it often has a thicker PCB
track, connected to it, and it is generally connected to metal work at same point.
10
RS (Register Select): -There are two very important registers inside the LCD. The RS pin is used
for their selection as follows. If RS=0, the instruction command code register is selected,
allowing the user to send a command such as clear display, cursor at home, etc. if RS=1, the data
register is selected, allowing the user to send data to be displayed on the LCD.
R/W, read/write: -R/W input allows the user to write information to the LCD or read information
from it.
R/W = 1 for reading.
R/W= 0 for writing.
EN, enable: -The LCD to latch information presented to its data pins uses the enable pin. When
data is supplied to data pins, a high–to-low pulse must be applied to this pin in order for the LCD
to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide.
D0 – D7: -The 8–bit data pins, DO – D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers. To display letters and numbers, we send ASCII codes
for the letters A–Z, a-z numbers 0-9 to these pins while making RS=1.There are also instruction
command codes that can be sent to the LCD to clear the display or force the cursor to home
position or blink the instruction command codes. We also use RS = 0 to check the busy flag bit
to see if the LCD is ready to receive information.
The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if R/W = 1, RS = 0.
When D7= 1 (busy flag = 1), the LCD is busy taking care of internal operations and will not
accept any information [8].
3.3.4 Motor driver
Motor driver IC is used to control motors through a microcontroller. L293D IC is used as a
motor driver IC. It provides different logic to control the direction of the motor.
L293D is a typical motor driver or motor driver IC which allows dc motor to drive on either
direction. L293D is a 16-pin IC which can control a set of two dc motors simultaneously in any
direction. It means that you can control two dc motor with a single L293D IC. Dual H-bridge
motor driver integrated circuit(IC).It works on the concept of H-bridge. H-bridge is a circuit
which allows the voltage to be flown in either direction. As you know voltage need to change its
direction for being able to rotate the motor in clockwise or anticlockwise direction, hence h-
bridge IC are ideal for driving a dc motor. In a single L293D chip there are two h-bridge circuit
inside the IC which can rotate two dc motor independently. Due its size it is very much used in
11
robotic application for controlling DC motors. Given above is the pin diagram of a L293D motor
controller. There are two enable pins on l293D. Pin 1 and pin 9, for being able to drive the
motor, the pin 1 and 9 need to be high. For driving the motor with left H-bridge you need to
enable pin 1 to high. And for right H-bridge you need to make the pin 9 to high. If anyone of the
either pin1 or pin9 goes low then the motor in the corresponding section will suspend working.
Simply connect the pin16 VCC (5v) to pin 1 and pin 9 to make them high [8].
Pin 1: When Enable1/2 is high, Left part of IC will work, i.e motor connected with pin 3 and pin
6 will rotate.
Pin 2: Input 1, when this pin is high the current will flow though output 1.
12
Pin 4/5: GND pins
Pin 7: Input 2, when this pin is high the current will flow though output 2.
Pin 8: VSS, this pin is used to give power supply to connected motors from 5V to 36V maximum
depends on Motor connected.
Pin 9: When enable 3/4 is high, right part of IC will work, i.e motor connected with pin 11 and
pin 14 will rotate.
Pin 10: Input 4, when this pin is high the current will flow though output 4.
Pin 11: Output 4, this pin is connected with one terminal of motor.
Pin 14: Output 3, this pin is connected with one terminal of motor.
Pin 15: Input 3, when this pin is high the current will flow though output 3.
13
it can drive motors Up to 36v hence you can drive pretty big motors with this l293d.VCC pin 16
is the voltage for its own internal Operation. The maximum voltage ranges from 5v and up to
36v.
14
Figure 3.5: Ardiuno UNO board [1]
15
3.3.6 Power supply
Five volts power supply with respect to ground is needed for the operation of the
microcontroller. Fig 4 shows the schematic of the power supply used by the microcontroller
TR1
BR1
U1
7805
1 3
VI VO Vout
C1 D
N
100u G
C2
2W005G 2 220u
230/12V, 50Hz v1=230v
v2=12v
The power supply consists of a step down transformer which is used to convert 230 V, 50 Hz AC
voltages to 12 V AC, 50 Hz. This 12 V AC voltage is given to the bridge rectifier, which
converts it into 12 V dc. A voltage regulator 7805 is used to convert the 12 V dc into 5 V dc
which is needed by the microcontroller. Capacitors are used for smoothening the output voltage.
This five volts dc thus produced is given to the microcontroller for its operation.
3.3.8 Potentiometer
A potentiometer is a three-terminal resistor with a sliding or rotating contact that forms an
adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a
variable resistor or rheostat. The measuring instrument called a potentiometer is essentially a
voltage divider used for measuring electric potential (voltage).here we use this component as
rheostat to a component value of 1K ohm.
3.3.9 Transistor
A transistor is a negative-positive-negative (NPN) junction semiconductor device that is used for
many purposes. Together with other electronic components, such as resistors, coils, and
capacitors, it can be used as the active component for switches and amplifiers. Like all other
NPN transistors, this type has an emitter terminal, a base or control terminal, and a collector
terminal. In a typical configuration, the current flowing from the base to the emitter controls the
collector current. A short vertical line, which is the base, can indicate the transistor schematic for
an NPN transistor, and the emitter, which is a diagonal line connecting to the base, is an
arrowhead pointing away from the base.
17
Figure 3.8: transistor symbol and pins [3]
3.3.10 Relay
A relay is an electromagnetic operated switch. Current flowing through the coil of the relay
creates a magnetic field, which attracts a lever and changes the switch contacts. The coil current
can be ON or OFF so relays have two switch positions and they are double throw switches.
It uses to control the heater by making it turn on and off. That is when there is high output signal
from the transistor, the relay will be closed and makes the heater ON. When the temperature is
above the lower limit of the normal temperature range of the room, the relay gets no signal and
the heater is turned OFF. The relay’s switch connections are usually labeled COM, NC and NO.
3.3.11 Resistors
A resistor is a linear component that implements electrical resistance as a circuit element. It is
used to bias the switching transistor that energizes the relay. It also used to limit the amount of
current flowing. The current through a resistor is in direct proportion to the voltage across the
18
resistor's terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the
intensity of current through the resistor is called resistance.
19
3.3.12.1 12V DC Fan Specification
Type: Axial Flow Fan
Electric Current Type: DC
Blade Material: Plastic
Model Number: DC7025L12
Voltage: 12V
Current: 0.14A
Power: 1.68W
Speed: 2500RPM
Noise Level: 28dB
Weight: 52g
They work by converting electricity into heat using metals as heating elements. The metals have
high resistance that permit a certain amount of current to flow though to provide the required
heat. Electrical energy is changed into heat energy. But for software implementation we use lamp
as a heater.
20
3.3.14 GSM Module
A GSM modem is a device which can be either a mobile phone or a modem device which can be
used to make a computer or any other processor communicate over a network. A GSM modem
requires a SIM card to be operated and operates over a network range subscribed by the network
operator. It can be connected to a computer through serial, USB or Bluetooth connection.
A GSM modem can also be a standard GSM mobile phone with the appropriate cable and
software driver to connect to a serial port or USB port on your computer. GSM modem is usually
preferable to a GSM mobile phone. The GSM modem has wide range of applications in
transaction terminals, supply chain management, security applications and weather.
It has a communication that can be programmed using AT commands. The signal names for the
GSM modem communication port include the following; audio input and output pins (for
connecting external hands free audio devices), mute control pin, flash programming signal pins,
external power pins, and receiver and transmitter pins.
Here the RX and TX pins are used for the serial communication with the microcontroller. There
are various AT commands to check the signal strength and connection and SIM status etc. Here
the Hyper Terminal is used to initially interface with the computer to check the module. It also
has an antenna to receive the GSM signal from the user’s phone. The basic AT commands are
loaded into the program of microcontroller for it to interface with the GSM module. The figure
given below shows a GSM module.
21
3.3.14.1 Connecting GSM module to arduino
There are two ways of connecting GSM module to arduino. In any case, the communication
between Arduino and GSM module is serial. So we are supposed to use serial pins of Arduino
(Rx and TX). So if you are going with this method, you may connect the TX pin of GSM module
to Rx pin of Arduino and Rx pin of GSM module to TX pin of Arduino. You read it right. GSM
TX to Arduino Rx and GSM Rx to Arduino TX. Now connect the ground pin of arduino to
ground pin of GSM module. We made 3 connections and the wiring is over. Now you can load
different programs to communicate with GSM module and make it work. The problem with this
connection is that, while programming Arduino uses serial ports to load program from the
Arduino RX and TX If these pins are used in wiring, the program will not be loaded Successfully
to Arduino. So you have to disconnect wiring in Rx and TX each time you burn the program to
arduino. Once the program is loaded successfully, you can reconnect these pins and have the
system working. To avoid this difficulty, we can use an alternate method in which two digital
pins of arduino are used for serial communication. We need to select two PWM enabled pins of
arduino for this method. So we choose pins 9 and 10 (which are PWM enabled pins). This
method is made possible with the Software Serial library of Ardunio. Software Serial is a library
of Arduino which enables serial data communication through other digital pins of Arduino. To
avoid this difficulty, we can use an alternate method in which two digital pins of arduino are
used for serial communication. We need to select two PWM enabled pins of arduino for this
method. So we choose pins 9 and 10 (which are PWM enabled pins). To avoid this difficulty, we
can use an alternate method in which two digital pins of arduino are used for serial
communication. We need to select two PWM enabled pins of arduino for this method. So we
choose pins 9 and 10 (which are PWM enabled pins). To avoid this difficulty, we can use an
alternate method in which two digital pins of arduino are used for serial communication. We
need to select two PWM enabled pins of arduino for this method. So we choose
pins 9 and 10 (which are PWM enabled pins). The library replicates hardware functions and
handles the task of serial communication. The library replicates hardware functions and handles
the task of serial communication. To avoid this difficulty, we can use an alternate method in
which two digital pins of arduino are used for serial communication. We need to select
two PWM enabled pins of arduino for this method. So we choose pins 9 and 10 . The library
22
replicates hardware functions and handles the task of serial communication.
+5V +12v
+ Power
Usb jack jack
GND
~10 Rx
~9 Tx GSM
Ardiuno Module
UNO
o o GND
23
CHAPTER FOUR
CIRCUIT DIAGRAM AND ITS DESCRIPTION
LCD1
LM016L
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
ARD1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D3 D2
U1(VS) D1 LED-YELLOW LED-RED
LED-GREEN
ON
Reset BTN
www.TheEngineeringProjects.com
AREF 16 8 U1
13
PB5/SCK
12 2 3
PB4/MISO IN1 VSS VS OUT1
RESET 11 7 6
IN2 OUT2
~ PB3/MOSI/OC2A
10 1
EN1
U2(+VS) ~ PB2/OC1B
9
~ PB1/OC1A
8
1 U2 PB0/ICP1/CLKO 9
EN2
ATMEGA328P-PU
10 11
1121
7 IN3 OUT3
ANALOG IN
PD7/AIN1
6 15 14
IN4 GND GND OUT4
A0 ~ PD7/AIN1
5
38.0 PC0/ADC0
A1 ~ PD5/T1/OC0B
4
PC1/ADC1
A2 PD4/T0/XCK
3 L293D
PC2/ADC2
2 A3 ~ PD3/INT1/OC2B
2
VOUT PC3/ADC3 PD2/INT0
A4 1
PC4/ADC4/SDA PD1/TXD
A5 0
PC5/ADC5/SCL PD0/RXD
RXD
3 LM35
ARDUINO UNO TXD
RTS
RV1
CTS
L1(1)
1k
L1
12V
+12v
R1 Q1
NPN RL1
10k 12V
24
turned back to the required range, no control action is needed. The current temperature of the
room must be continuously displayed on the LCD .This makes user is easily to know current
temperature of the system. The Temperature Sensor detects the temperature of the system .the
temperature Sensor consists of an LM35 IC. The temperature sensor is connected to the analog
input of the arduino μC. It converts the analog input to a digital value. The arduino generates
PWM according to the temperature sensor value. The PWM generated Output control signals are
sent to the Motor Driver IC L293D. Motor Driver IC L293D is fed with the PWM generated
output from arduino. By using the L293D, two dc Motors can be connected. The speed of the fan
is controlled by the ON time of the PWM generated by the controller. With increasing ON time,
the speed of the fan increases reducing the temperature of the system. And also the arduino
generates digital signal and feds to the heater. The LCD module is also connected to the arduino
microcontroller. The LCD module displays the current temperature
4.3 Flowchart
start
Read
Temperatur NO
e
Is NO
Temp<=10
NO YES YES
Is Is Is Fan
Temp<=35 Temp<=30 Temp>=27 Off
Heater
off
NO YES
NO
Is Fan speed slow Fan
Temp<=40 Heater Off
YES NO OFF Heater
YES on
end
25
4.3.1 Flowchart Description
The logical representation of the software code has been presented in the flowchart form. Fig
shows the flowchart of the logic implemented in the modeled system. The temperature is read
from the temperature sensor and the condition is checked and the following processes are done:
1. When temperature is greater than 27 and less than 30degree Celsius, the fan speed is slow and
heater is off.
2. When temperature is greater than 30 and less than 35 degree Celsius, the fan speed is medium
and heater is off.
3. When temperature is greater than 35 and less than 40 degree Celsius, the fan speed is fast and
heater is off.
4. When temperature is greater than 45 degree Celsius, the fan speed is very fast and heater is
off.
5. When temperature is less than 27 and greater than10 degree Celsius, both fan and heater are
off.
6. When temperature is less than 10 degree Celsius, the fan is off and heater is on.
4.4 Algorithms
1. Initialize analog temp pin, heater input pin, LCD and Motor Driver IC Input.
2. Clear LCD.
3. Display set temperature range on LCD.
4. Read Analog Voltage Value from Temperature Sensor on A5 of arduino pin.
5. Temperature = Voltage *100
6. Now compare the value of T with range of temperatures and set the fan Speed according to
that
a) If T <=10
Fan off
Green led off
Yellow led off
Red led off
Heater on
b) If T >= 10 and T <=27
Fan off
26
Green led on
Yellow led off
Red led off
Heater off
c) If T >= 27 and T <=30
Fan Speed = 25%
Green led on
Yellow led off
Red led off
Heater off
d) If T >30 and T <=35
Fan Speed = 50%
Green led off
Yellow led on
Red led off
Heater off
e) If T>35 and T <=40
Fan Speed = 75%
Green led off
Yellow led on
Red led off
Heater off
f) If T >40
Green led off
Yellow led off
Red led on
Fan Speed = 100%
Heater off
7. End
27
4.5 programs
#include <LiquidCrystal.h>
#include<SoftwareSerial.h>
float temp;
#define tempPin A5
#define m11 11
#define m12 10
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup()
{
pinMode(A5,INPUT);
pinMode(m11,OUTPUT);
pinMode(m12,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop()
{
lcd.print("TEMPER. IN ^C ");
lcd.setCursor(0,1);
temp = analogRead(A5);
float mv = (temp/1024.0)*5;
float C = mv*100;
lcd.print("==> ");
lcd.print(C);
lcd.setCursor(10,1);
28
lcd.print(" ");
Serial.println("Temprature in ^C:");
Serial.print(C);
Serial.print(" ^C");
if (C<10)
{
analogWrite(m11,0);
analogWrite(m12,0);
digitalWrite(12,0);
digitalWrite(13,0);
digitalWrite(9,0);
digitalWrite(8,HIGH); //Heater ON
Serial.println("AT+CMGF=1");// to send sms in text mode
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("FAN is OFF and Heater is ON:");
delay(20);
}
if (C>=10&&C<27)
{
analogWrite(m11,0);
analogWrite(m12,0);//Fan OFF
digitalWrite(13,0);//Yellow led off
digitalWrite(9,0);//red led off
digitalWrite(8,LOW); //Heater OFF
digitalWrite(12,HIGH); // green led on
Serial.println("AT+CMGF=1");// to send sms in text mode
29
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("Normal Temprature both FAN and Heater OFF:");
Serial.println("wawww it is Good weather:");
delay(20);
}
if(C>=27&&C<30)
{
digitalWrite(12,HIGH); // green led on
digitalWrite(13,LOW); // yellow led off
digitalWrite(9,LOW); //red led off
digitalWrite(8,LOW); //Heater OFF
analogWrite(m11,64);//fan ON
analogWrite(m12,0);
Serial.println("AT+CMGF=1");// to send sms in text mode
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("Temprature somewhat Hot:");
Serial.println("Heater OFF And FAN runs at slow RPM:25%:");
delay(20);
if(C>=30&&C<35)
{
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
digitalWrite(9,LOW);
30
analogWrite(m11,127);
analogWrite(m12,0);
digitalWrite(8,LOW); //Heater OFF
Serial.println("AT+CMGF=1");// to send sms in text mode
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("My Room Temprature is HOT:");
Serial.println("Heater OFF And FAN runs at medium RPM :50%:");
delay(20);
}
if(C>=35&&C<40)
{
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
digitalWrite(9,LOW);
analogWrite(m11,191);
analogWrite(m12,0);
digitalWrite(8,LOW); //Heater OFF
Serial.println("AT+CMGF=1");// to send sms in text mode
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("My Room Temprature is Too Hot:");
Serial.println("Heater OFF And FAN runs at fast RPM :75%:");
delay(20);
}
if(C>=40)
{
31
digitalWrite(12,LOW);
digitalWrite(13,LOW);
digitalWrite(9,HIGH);
analogWrite(m11,255);
analogWrite(m12,0);
digitalWrite(8,LOW); //Heater OFF
Serial.println("AT+CMGF=1");// to send sms in text mode
delay(20);
Serial.println("AT+CMGS=\"+251925992313\"\r");// change to the phone number that we use
delay(20);
Serial.println("My Room Temprature reaches maximum:");
Serial.println("Heater OFF And FAN runs at very fast RPM :100%:");
delay(20);
Serial.println();
//delay(30);
32
CHAPTER FIVE
RESULTS AND DISCUSSIONS
The speed of the fan has been controlled using PWM technique when the temperature is above
the higher limit of the normal room temperature.The simulation of the system has been done on
Proteus ISIS7 Professional software packages and it is running in good agreement .The logic
used in the system is verified and shown in the flowchart form. The duty cycle is varied
according to room temperature and speed of the fan is controlled accordingly and heater is on
when the temperature is below the lower limit of the normal range of room temperature.
Accordingly to our project the fan is driven by DC motor. After we simulate we gained the
following results in three conditions. Those condition are stated as follows:
Condition 1: When the temperature is less than 10ºC. In this case microcontroller generates
digital signal to heater. This implies that the temperature is below the lower limit of the normal
room temperature range. Due to this all Led and motor is off accordingly and the heater is on.
33
Condition 2: When the temperature is greater than10ºC and less than 27ºC. In this condition the
microcontroller does not generate any signal to the yellow led, red led, fan and to heater but it
feds digital signal to green led and it becomes on . This implies that the room is at normal
temperature.
34
Figure 5.3: Circuit diagram Condition 3
35
Figure 5.4: Circuit diagram Condition 4
36
Figure 5.5: circuit diagram Condition 5
37
Figure 5.6: Circuit diagram Condition 6
38
CHAPTER SIX
CONCLUSION AND FUTURE WORK
6.1 Conclusion
Generally in this project the temperature of a system is controlled automatically using ardiuno
microcontroller. The LM35DZ temperature sensor senses the temperature of a given room and
feed it to the arduino microcontroller which then decodes it and compared it to a predetermined
temperature value stored in it. The microcontroller in turn automatically switches on/off a heater
or a fan based on the result of the comparison. If the temperature is above the predetermined
value the fan runs at different speed based on change in environment temperature. This design is
considered on a predetermined temperature value of 10ºC as minimum and 27ºC as the
maximum. The system was tested and the result show that the switching occurs at temperature of
below 10ºC and above 27ºC .This system helps to maintain the temperature within a limit. This
system is very marketable because of its simplicity, low cost and small size. It can be used in
various industrial applications such as to control the temperature in living room, Computers
room, chemical reaction room, furnace room and Laboratories.
6.2 Future modifications & Recommendations
The goals of this project were purposely kept within what was believed to be attainable within
the allotted timeline. As such, many improvements can be made upon this initial design the
recommendation provided as idea for future expansion of this project is:
Changeable temperature limits can be applied by adding a matrix keypad
39
Reference
[1]. Arduino Uno, https://www.arduino.cc/en/Main/ArduinoBoardUno
[2]. Measuring Room temperature using LM 35 Temperature Sensor with Arduino by
Microcontroller Projects.
[3]. Automation https://en.wikipedia.org/wiki/Automation.
[4]. Vaibhav Bhatia “room temperature based fan speed control system using pulse width
modulation technique”, NOVEMBER 2013.
[5]. http://www.circuitstoday.com/interface-gsm-module-with-arduino.
[6]. Temperature Controlled Relay with Arduino – Tutorial #6 by electroschematics.com.
[7]. /Electric heating - Wikipedia.htm.
[8]. Ghana Shyam Soren and Ram Ashish Gupta “Temperature Controlled DC Fan usin
Microcontroller”.
[9]. Mustafa Saad “automatic fan speed control system using microcontroller”, 2014.
[10]. Sushma Verma “automatic temperature controlled fan using thermistor”, JULY 2016.
[11]. J.P Introduction to Sensors, LCD and LED. http://wwwfars.nhtsa.dot.gov/Main/index.aspx.
40
41
42