Universal Timer using Microcontroller for Home Appliances

ISSN 2319-8885
Vol.03,Issue.10
May-2014,
Pages:2128-2132
www.semargroup.org,
www.ijsetr.com
Universal Timer using Microcontroller for Home Appliances Software
Implementation
SU MON HTET1, ZAW MYO TUN2
1
Dept of Electronic Engineering, Mandalay Technological University, Mandalay, Myanmar, Email: sansan7487@gmail.com.
Dept of Electronic Engineering, Mandalay Technological University, Mandalay, Myanmar, Email: zawmyotun.mtu@ gmail.com.
2
Abstract: This paper deals with the design, development and implementation of microcontroller based universal On-Off timer
for home appliances. This system is developed for the users to control the operation of any home appliances. The system is
divided into two parts; software implementation and hardware implementation. This paper mainly concerns with software
implementation of the system. Man has no time to wait for a particular appliance to on for a particular period in modern world.
Under this control, the appliance can be on and off. It mainly consists of a keypad, microcontroller unit, relay driver circuits and
LCD display. The user can set any of the time given in the timer switch using keypad. The settings are stored in the
microcontroller and the details are displayed in the LCD display. The appliance is controlled to run for the particular period by
the timer switch. The timer switch automatically makes the appliance off if the particular period is over. This system is
efficient, reliable and user friendly.
Keywords: Timer, Microcontroller, Keypad, LCD, Relay Driver.
I. INTRODUCTION
With advancement of technology things are becoming
simpler and easier for us. Timer is an important function for
the sequence processing or precise producer of modern
control systems. The objective of this paper is to investigate a
cost effective solution that will provide controlling of home
appliances time efficiently. The PIC microcontrollers are
popular and in high demand throughout the world because it
is widely available, it has low cost, it is a large user base
device and it can work as an extensive collection of
application notes. This system aims to program and design
the required timing sequence for the automatic control
system. The maximum time the user can set is limited to 18
hours due to program memory. In this system, four sections
will be considered. These are power supply unit, input
switches for setting selection, PIC 16F877A microcontroller
unit and relay driver circuit. Power supply circuit is designed
to generate the require power for entire circuit. The keypad is
used for timer setting input.
hardware implementation for the system, part 3 describes the
software implementation of the system, part 4 deals with
discussion of result and the conclusion is presented in part5.
The overall block diagram of the system is shown in Figure1.
The PIC 16F877A microcontroller is the heart of the
system. LCD is connected to the microcontroller to display
the current time the details of the two timers. The relay driver
circuit is implemented to the output interfacing with PIC.
Two types of relay are used for high powered and low
powered appliances. The control program is written in PIC
Basic Pro language and run in PIC microcontroller. The
universal timer based on microcontroller will help to control
home appliance comfortably and time efficiently. This paper
continues in the following pattern: part2 presents the
II. SOFTWARE IMPLEMENTATION
Software implementation section consists of algorithm
for displaying message on LCD, algorithm for keypad input
reading, algorithm for keypad and LCD display, and
algorithm for timer counter. Programs for the microcontroller
are implemented in PIC Basic Pro language.
LCD
Display
Timer
Setting Input
Driver
Circuit 1
Relay 1
(motor, air
conditioner)
Driver
Circuit 2
Relay 2
(Ricecooker,fan)
PIC
Microcontroller
Fig.1.Overall Block Diagram of the System
A. Algorithm of Displaying Message on LCD
Program flow chart for displaying message on LCD is
shown in figure 2. First of all, the ports of the microcontroller
are initialized to interface with LCD. And then the clear LCD
Copyright @ 2014 SEMAR GROUPS TECHNICAL SOCIETY. All rights reserved.
SU MON HTET, ZAW MYO TUN
screen command is sent to LCD and home cursor is set. After
Endif
that, the desired message can be displayed on LCD. Source
If (row2 == 0) Then
code for displaying message on LCD is as follows;
' key 5 is down
lcdout $FE, 1
Endif
RPT:
If (row3 == 0) Then
lcdout $FE, 2
' key 8 is down
lcdout "Hello World! "
Endif
pause 1000
If (row4 == 0) Then
lcdout $FE, $C0
' key 0 is down
lcdout "I am Su Mon Htet."
Endif
goto RPT
' Check column 3
end
High col1 : High col2 : Low col3
If (row1 == 0) Then
start
' key 3 is down
Endif
Initialize Inputs,
If (row2 == 0) Then
Output Ports
' key 6 is down
Endif
If (row3 == 0) Then
Clear LCD screen
' key 9 is down
Endif
If (row4 == 0) Then
Set home cursor
' key # is down
Endif
goto loop
Display Message
start
End
Fig.2. Displaying Message on LCD.
B. Algorithm for Keypad Input Reading
Program flow chart for keypad input reading is shown in
figure 3. First of all, the inputs and outputs ports are
initialized. And then LCD screen is cleared and display
message to press the key. The input pins of the
microcontroller are checked until the key is pressed. When
any key is pressed, microcontroller checks which key is
pressed and displays the pressed key on LCD. The following
shows the keypad polling loop in basic pro language.
loop:
' Check column 1
Low col1 : High col2 : High col3
If (row1 == 0) Then
high PORTD.0 ' key 1 is down
Endif
If (row2 == 0) Then
HIGH PORTD.1' key 4 is down
Endif
If (row3 == 0) Then
' key 7 is down
Endif
If (row4 == 0) Then
' key . is down
Endif
' Check column 2
High col1 : Low col2 : High col3
If (row1 == 0) Then
' key 2 is down
Initialize Inputs,
Output Ports
Clear LCD screen
Display Message
“Press Any Key
Key Press?
No
Yes
Check which
key is pressed
Display pressed
key on LCD
End
Fig.3. Flowchart for Keypad Input Reading.
C. Algorithm for Timer Counter Display
Timer counting is the essential part of the microcontroller
based home appliance system since the user can set the on/off
timing for home appliances in smart home system. The user
needs to set the timing using keypad. The microcontroller
stores the key pressed numbers and calculates the count for
timer. After that, the timer is counted down and when the
setting time is reached, the PIC sends the command to the
output pin to show the setting time is completed. In this
International Journal of Scientific Engineering and Technology Research
Volume.03, IssueNo.10, May-2014, Pages: 2128-2132
Universal Timer using Microcontroller for Home Appliances Software Implementation
research, LED is connected to the output pin to describe the
III. RESULTS
result. The program is implemented to turn on and off the
In this system, the user has firstly set the desired hours,
LED three times when the setting time is completed to see
minutes and seconds for two timers. After that, the
the result quite clear.
microcontroller starts comparing and counting the times.
Figure 6 shows the condition when timer 1 ON time is
reached. The output signal is described with a LAMP. Figure
start
Check which
6 shows the condition when timer 2 ON time is reached. The
key is pressed
output signal is described with a LAMP.
Initialize Inputs,
Output Ports
Clear LCD screen
Display Message
“Press Any Key
Calculate count
for timer
Decrease count
Turn on/off
LED 3 times
Display on LCD
No
Key Press?
Yes
End
No
No
Count = 0 ?
Yes
Fig.4. Flowchart for Timer Counter Display.
D. Overall System Flow and Algorithm for Timer Setting
There are six subroutines included in the program. They
are subroutines for key test from keypad, for second count,
for key number calculation, for time calculation, for asking
the timer setting, and for calculating the interval of timer on
conditions. First of all,. “ON” time or “OFF” time of timer 1
and timer 2 will be asked. Then the microcontroller will
calculate the duration time for timer 1 and timer 2 and then
the output signal will be set when the setting time is
completed. The system flow procedure is shown in figure 5.
Fig.6. Simulation Result for timer 2 is ON.
.
Fig.5. Overall System Flow for the Home Automation
System.
Fig.7.Simulation Result for timer 1 is ON.
International Journal of Scientific Engineering and Technology Research
Volume.03, IssueNo.10, May-2014, Pages: 2128-2132
SU MON HTET, ZAW MYO TUN
IV. DEVELOPING HEX CODE AND DOWNLOADING HEX
CODE INTO MICROCONTROLLER
Developing Hex Code and Downloading hex code into
microcontroller. To develop the PIC and LCD interfacing
circuit, the program is written in Microcode Studio Plus
window and compiled. If compiling process succeeds, the
Microcode Studio creates hex code for microcontroller.
Figure8 shows software development window with
Microcode Studio and hex code created for microcontroller.
Fig. 10. Importing Hex file to the Microcontroller
Fig.8. Software Development Window with Microcode
Studio and Hex Code Created for Microcontroller.
The hex code is created by compiling the program in
Microcode studio Plus software. This code is burnt in
microcontroller using PIC kit 2 programmers and interfacing
software. Figures 2 and 3 shows the blank check of the
microcontroller, the importing hex file into microcontroller
and burning the hex file to the microcontroller using PIC kit
2 programmer and interfacing software.
V. SUMMARY
The hardware design and software implementation of the
timer system is described. The desired programming software
is used in PIC Basic Pro. The system can count the two
timers at the same time and switch on and off for the
particular period. The PIC 16F877A microcontroller is the
heart of the system. The twelve-key matrix keypad, 4×20
LCD and two types of relay driver are used. The user can use
this system time efficiently and comfortably.
VI. CONCLUSION
The main motivation of this system is to develop and
implement a simple and inexpensive universal timer for
home appliances.The maximum time is limited to 18
hours.The Proteus simulation software and PIC Basic Pro
programming language are used. How to implement the PIC
program is described with flowchart. Proteus test for the
system is described. A flexible and easy way for controlling
home appliance is created.
VII. REFERENCES
[1]Microchip, PICMicro Mid-Range MCU Family Reference
Manual, DS33023A, Microchip Technology Inc, 1997.
[2] Design and Development of Activation and Controlling
of Home Automation System VIA SMS through
Microcontroller, Ch. Naga Koti Kumar*, Y.V. Raghu
Babu**,A. Gamya***, P.Jainath****, M. Vijay*****(MarApr 2012,pp.1349-1352).
[3] Microcontroller based IR Remote Control Signal Decoder
for Home Application, Nhivekar G.S and Mudholker
R.R,2011.
[4] Microcontroller Based Home Automation System With
Security, Inderpreet Kaur (Asstt. Prof.), IJACSA,Vol. 1,No.6,
December 2010.
[5] Home appliances Controlling Using Windows Phone 7,
Chesti Altaff Hussain, K. Vijaya Lakshmi, International
Journal of Advanced Research in Electrical, Electronics and
Instrumentation Engineering,Vol 2,Issue 2, February 2013.
Fig.9. PIC kit2 Programmer checking whether the device
is blank or not.
International Journal of Scientific Engineering and Technology Research
Volume.03, IssueNo.10, May-2014, Pages: 2128-2132
Universal Timer using Microcontroller for Home Appliances Software Implementation
[6] “DC Motorised Treadmill For Home” http://treadmill.
jkexer.com/en/2 1789 60763/product/Motorized Treadmills
id342279.html.
[7] Herman, Stephen L. Electric Motor Control. (http://
books.google.com/books?id=Yxy8WRWfIy0C&pg=PA12
&dq=dc+electric+motor+protection&hl=en&ei=xwC8TrefF
OHq0gHW4czfCQ&sa=X&oi=book_result&ct=result&resnu
m=9&ved=0CHAQ6AEwCA#v=onepage&q=dc%20electric
%20motor%20protection&f=false) 9th ed. Delmar, Cengage
Learning, 2009. Page 12.
[8] Malcolm Barnes. Practical variable speed drives and
power electronics. (http://books.google.com/books?id=LxW
9F9WCixcC&pg=PA151&dq=dc+motor+insulation +failures
&hl=en&ei=UCrATsnlK-j30gG_s7i3BA&sa=X&oi= book _
result&ct=result&resnum=3&ved=0CD4Q6AEwAjgK#v=on
e page &q&f=false) Elsevier, Newnes, 2003. Page 151.
International Journal of Scientific Engineering and Technology Research
Volume.03, IssueNo.10, May-2014, Pages: 2128-2132