Professional Documents
Culture Documents
INSTITUTE OF TECHNOLOGY
DEPARTEMENT OF ELECTRICALAND COMPUTER ENGINEERING
INDUSTRIAL CONTROL ENGINEERING STREAM
PREPARED BY:
1. Fatuma Seid (0349/06)
2. Haymanot Melese(0436/06)
3. Miftah Mohammed (0584/06)
4. Misgana Desta (0592/06)
June 2009
Gondar, Ethiopia
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C
Approval page
We hereby declare that this project is our original work done under the guidance of Mr.
Agumasse B. and this project work has not been submitted before.
Advisor
Agumasse B. ________
Acknowledgement
We extend our sincere thanks to our advisor Agmuasie B. b.sc in industrial control
engineering with the guidance and facilities for the semester project. We express our sincere
gratitude to the semester project coordinator staff in charge, for their cooperationand guidance
for preparing and presenting this project.We also extend our sincere thanks to all other
friends for their support and encouragement especially for Abdugefar Nurhassen.
Abstract
Microcontroller based pass code door lock system is a system that use microcontroller
interfaced with GSM module, keypad ,buzzer, and stepper motor.Unauthorized access to
things might cause harm to the individual person and also can make the company a target to
theft and burglary. For these systems to be secured it will normally take high budget, many
human resources and consume time to implement it.
In our system some embedded program in computer is used.our system able to use GSM
module to send sms message to the owner Since mobile phones have become the most
prevailing communication gadget.
The system has a keypad by which the password can be entered through it . When the entered
password is the same with the password stored in the memory then the relay gets on so that
the door is opened. If we entered a wrong password more than three times then the alarm will
turned on and send SMS to police or the owner. If the password exactly matches with the
stored password in the LED turns on and valid is displayed on the LCD. At this time the door
is open.
The system can provide effective, accurate and real time based security while the owners are
away from their home.
Contents
Electrical and computer engineering
Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C
Chapter one...........................................................................................................................................1
Introduction...........................................................................................................................................1
1.6. Methodology...............................................................................................................................3
Chapter 2...............................................................................................................................................5
Literature review....................................................................................................................................5
2.1. Introduction................................................................................................................................5
3.2 Keypad.......................................................................................................................................14
3.7.Capacitor....................................................................................................................................22
3.9. Resistor.....................................................................................................................................22
CHAPTER FOUR....................................................................................................................................23
SYSTEM DESIGN...................................................................................................................................23
4.1 Introduction...................................................................................................................................23
4.2.1. Transformer.......................................................................................................................25
Chapter 5.............................................................................................................................................32
5.1 Result.........................................................................................................................................32
Chapter 6.............................................................................................................................................37
6.1 Conclusion..................................................................................................................................37
6.2 Recommendation.......................................................................................................................38
Reference.............................................................................................................................................39
Appendices..........................................................................................................................................39
List of figure
figure 3. 1; microcontroller..................................................................................................................10
figure 3. 2; PIC16f877a.......................................................................................................................10
figure 3. 3keypad..................................................................................................................................14
figure 3. 44 led symbol and schematic diagram...................................................................................15
figure 3. 55 LCD....................................................................................................................................16
figure 3. 66 stepper motor....................................................................................................................19
figure 3. 7 GSM mode (SIM 900)..........................................................................................................21
figure 3. 8 capacitor.............................................................................................................................22
figure 3. 9 resistor................................................................................................................................22
figure 4. 1 block diagram.....................................................................................................................23
figure 4. 2schematic diagram of microcontroller interfaced with LCD and keypad.............................24
figure 4. 3schematic diagram of microcontroller interfaced with GSM module...................................25
figure 4. 4 digram of microcontroller interfaced with stepper motor....................................................25
figure 4. 5;complete system design for door........................................................................................26
figure 4. 6; simulation result................................................................................................................27
figure 4. 7supply design.......................................................................................................................27
figure 4. 8schematic diagram of power supply.....................................................................................30
figure 4. 9 flow chart chart...................................................................................................................31
List of Abbreviations
AT………………………………………Atmel
IC……………………………………….Integrated circuit
MCS……………………………………Microcontroller system
MCU……………………………………Microcontroller unit
3D………………………………………Three dimensional
List of table
Introduction
When World War I came to an end in1918, an increase in crime followed. As a result, the
Americans become eagled to find ways of protecting themselves and their property. In
addition to this, many insurance companies began to offer premium discounts to alarm
subscribers. These events in turn produced a consumer demand for alarm system. An early
model of an advanced video home security system consisted of a large camera that could
view the exterior of the home through tiny holes mounted in the front door.
Burglar safety alarms are found in electronic form nowadays. Sensors are connected to a
control unit via either a low-voltage hardwire which in turn connects to a means for
announcing the alarm to elicit response. In a new construction systems are predominately
hardwired for economy while in retrofits wireless systems may be more economical and
certainly quicker to install. Some systems are dedicated to one mission; handle fire,
intrusion, and safety alarms simultaneously.
In common security system, the lights are triggered by motion gives the impression to user
that someone is at home and able to see the burglar. Infrared motion detectors placed in
house security system in crucial areas of the house can detect any burglars and alert the home
owner or police. The first security system invented, house alarms were triggered by the
release of a pressure button fitted into a door or window frame.
This basic alarm was fundamentally flawed as the entire intruder needed to do to silence. The
alarm was to close the door or window. While various systems on the mark ranging from
inexpensive house security alarms to highly sophisticated systems requiring
professional installation. All modern alarms are based on the same foundation, the electric
The alarm is triggered when the circuit is altered and will not be silenced until a code is
punched into the control panel.
The most expensive and complicated alarm systems might also involve a combination of
motion sensors and pressure pads to ensure even the most cunning intruder doesn’t get
his hands on treasures.
Home security is one of the major issues that need to be prioritized by individuals. We are
living in a computerized world where crime and unanticipated accidents occur beyond our
knowledge and awareness.Considering the increasing number of theft needs attention in
collaboration with the government or civil authorities.
Then our project intends to interface the microcontroller with the LED keypad and other
hardware components like memory, sounder start/stop the stepper motor through sending a
right or wrong password. The measure of efficiency is based on how fast the microcontroller
can detect the incoming message and act accordingly.
The controlling unit has an application program to allow the microcontroller read the
incoming data through the modem and control the engine motor as per the requirement. The
performanceof the design is maintained by the controlling unit.
1.2.PROBLEM STATEMENT
Security is a prime concern in our day-today life. Everyone wants to be as much secure as
possible. Knowing your home is protected provides peace of mind both when you are away
and when you are home. Security is important even if you have outstanding public safety
agencies in your area. There are far more homes than there are police officers, not to
mention of skilled thieves. And the other problem is lost of key, the password might be
hack ,the card will be lost, it might be open by similar key.So we would like to implement our
project to do everything possible to make your housesecure rather than just relying on others.
1) This kind of systems control home security and other systems, in order to improve
Our general objectives are todesign and simulation of microcontroller based pass code door
lock system.
Our goal is to minimize man power, to minimize the need for a key, to keep room security
based on microcontroller, to use only by the authorized person.
1.6. Methodology
For successful completion of this project some steps have been followed to carry out different
tasks. Different literatures were revised relating to this project and data has been collected
from nearby system. Based on the data collected and parameter availability, system model
have been designed. Finally using appropriate software, the programming hasbeen developed.
Literature review
2.1. Introduction
Various home security system solutions are not available. Most of them are very expensive.
We have studied different individual components separately and integrated them together with
some more innovative features to make a home security system. Home security system are
expected to be the standard in the near future when all aspects of the home can be monitored
and controlled remotely by the home owner.
Different methods proposed by researchers around the globe related to the home security
system are outlined here:
The work of N. Sriskanthan et al. shows the implementation of a home automation system
using Bluetooth. They use a host controller implemented on a PC, which is connected to a
microcontroller-based sensor and device controllers. The researchers even built a new
protocol on top of the Bluetooth software stack, called Home Automation Protocol (HAP), to
make the communication between devices possible. The device controller is connected to
electronic devices through the I2C Bus. The system allows more than one device controller to
be connected to the host controller.
The work of H. Kanmaet al. also proposes a home automation system using Bluetooth that
can be accessed remotely through GPRS. The researchers use a cellphone equipped with
Bluetooth connectivity as a host controller and a GSM modem that provides Internet
connectivity. Home devices are fitted with Bluetooth communication adapters so that they can
communicate with the host controller phone via Bluetooth. The paper discusses remotely
controlling and updating home devices along with fault diagnostics and detection. The work
also talks about providing an electronics user manual on the phone using Bluetooth and
Internet.
There are a lot of home security systems implemented using GPRS. Most systems use the
word security in the traditional sense, and only address the threat put forth by old fashioned
intruders in home.
Researchers M. Danaher and D. Nguyen propose a home security system using GPRS. The
work uses a webcam to stream video and pictures of the home to its owner’s mobile through
GPRS. The webcam detects movement by comparing frames for differences, including light
intensity. Video streaming in the proposed work is done using the home Internet connection,
not the GSM modem.
The work describes video camera surveillance using the GPRS facility in mobile phones. The
camera is triggered when an intrusion is detected or the door bell is rung. The system
identifies intrusions with an infrared sensor. In the case of a doorbell, the system calls the
homeowner and establishes voice communication with a live video feed between the visitor
and the homeowner. When an intrusion is detected, an email is sent to the user along with a
picture, most likely of the intruder. Upon receiving this email the user can start monitoring
the video feed on his phone.
The work of L. Muhury and A.H.M.A Habib describes the design and implementation of a
DTMF-based home automation system. The user calls a SIM number assigned to the home
and presses the digits on their phone’s keypad to control the home’s devices by generating a
DTMF tone. The tone is received and decoded by the GSM module at home using a DTMF
decoder. The decoded instructions are passed to the microcontroller so that user commands
can be implemented at home.
DTMF-based Home Automation System: Home automation systems using DTMF are not
very commonly implemented, maybe because there are other better options for
Our project will solve the above problems by creating strong security system it have used
GSM module and password. It was used by only authorized person and when problem is
happen, our system send a message to the owner or police. This make our system more safe
and secure than before.
Program memory and data memory are separated. Data memory is 8-bit, 16-bit, and, in latest
models, 32-bit wide. Program instructions vary in bit-count by family of PIC, and may be12,
14, 16, or 24 bits long. The instruction set also varies by model, with more powerful chips
adding instructions for digital signal processing functions.
The hardware capabilities of PIC devices range from 6-pin SMD, 8-pin DIP chips up to 144-
pin SMD chips, with discrete I/O pins, ADC and DAC modules, and communications ports
such as UART, I2C , CAN, and even USB . Low-power and high-speed variations exist for
many types.
The manufacturer supplies computer software for development known as MPLAB assemblers
and C/C++ compilers, and programmer/ debugger hardware under the MPLAB and PICKit
series. Third party and some open-source tools are also available. Some partshave in-circuit
programming capability; low- cost development programmers are availableas well as high-
production programmers.
Features of PIC
PIC devices are popular with both industrial developers and hobbyists due to their
low cost
wide availability
Electrical and computer engineering
Page
large user base
extensive collection of application notes
availability of low cost or free development tools
serial programming, and re-programmable Flash-memory capability.
figure 3. ; microcontroller
The microcontroller in the above figure the components that are the RAM, ROM, I/O, Timer,
serial com port are all within the chip.
The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and
interrupt system to continue functioning. The Power-down mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until the next external interrupt or
hardware reset.
figure 3. ; PIC16f877a
Electrical and computer engineering
Page
2.1.4 Pin Description of PICF16F877A
Pin 14&13 are interfaced with crystal and capacitor for stability.
Pin 33 to pin 38(RB0 to RB5) are interfaced with LCD display.
Pin 39(RB6) was interfaced with buzzer.
3.2 Keypad
Keypad is most widely used input device to provide input from the outside world to
the microcontroller. The keypad makes an application more users interactive. A matrix
keypad consists of arrangement of switches in matrix format in rows and columns with the
microcontroller I/O pins connected to the rows and columns of the matrix such that switches
in each row are connected to one pin and switches in each column are connected to another
pin. A keypad is generally a matrix arrangement of tact switches which are basically push
button switches.
figure 3. keypad
There are numerous techniques depending on the connection keypad with microcontroller,
but the fundamental logic is same the columns are made as input and drive the rows making
them as output. So as to detect which key is pressed from the matrix keypad, the row lines are
to be made low one by one and read the columns.
Here we are going to see a 4×4 matrix keypad. It is 16 keys keypad consists of four rows and
four columns. Assume that if row1 is made low, then read the columns. If any of the key in
row1 is pressed then correspondingly the column 1will give low that is if second key is
pressed in row1, then column2 will give low.
The concept of interfacing a keypad with the PIC is similar to interfacing it with any other
microcontroller. The article of interfacing keypad with PIC can be referred for detailed
LED is a component used for indication. All the functions being carried out are displayed by
led .The LED is diode which glows when the current is being flown through it in
forward bias condition. The LEDs are available in the round shell and also in the flat shells.
The positive leg is longer than negative leg.
In our project the led light used to indicate that the password is correct.
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range
of applications. In this project we use the 16x2 LCD display; it’s a very basic module and
is very commonly used in various devices and circuits. These modules are preferred over
Electrical and computer engineering
Page
seven segments and other multi segment LEDs. LCDs are economical; easily programmable;
have no limitation of displaying special & even custom characters (unlike in seven segments),
animations and so on .A 16x2 LCD means it can display 16 characters per line and there are 2
such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data. The command register stores the command
instructions given to the LCD. A command is an instruction given to LCD to do a
predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc.
Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by
the MCU. Before starting the internal operation of the LCD, control information is
temporarily stored into these registers to allow interfacing with various MCUs, which
operate at different speeds, or various peripheral control devices. The internal operation of
the LCD is determined by signals sent from the MCU.
These signals, which include register selection signal (RS), read/write signal (R/W), and the
data bus (DB0 to DB7), make up the LCD instructions.
figure 3. 5 LCD
LCD PIN description: The LCD Pin description is illustrates in the table below
Initializing LCD: To initialize LCD to the pic16f8877a the following instruction and
commands are to be embed in to the functions
In our project LCD is used to display the request to enter the password ,to display the
password with asterisk and also it displays writher the password we enter is Wright or wrong.
Are economic; easily programmable; have no limitation of displaying special & even custom
characters (unlike in seven segments), animation and so on.
The MODEM needs AT commands, for interacting with processor or controller, which are
communicated through serial communication. The controller sends these commands. The
MODEM sends back a result after it receives a command. Different AT commands supported
by the MODEM can be sent by the controller computer to interact with the GSM cellular
network. AT commands are used to control MODEMs functionality.
In this project RXD and TXD pin of GSM module and PIC should be connectedwith each
other in reveres manner because transmitted data of PIC microcontroller receive to GSM
module andsimilarly transmitteddata from GSM TXD go to RXD receive pin of PIC
microcontroller .this is a weird communication to send data from one device to another.
There are many method of weird communication but PIC and GSM interfaced through 2 wire
serial communications. Serialcommunication means to send data bit bybit. There is one
important to consider whileusing serial communication that is baud rate.Baud rate is the
number of bits transfer persecond from one device to another. You shouldcheck baud rate
compatibilitybetween twodevices. Usually SIM900D GSM module support9600 baud rate
with UART type serial communication. UART mean universalAsynchronous receiver and
transmitter. PIC microcontroller have built hardware toimplement UART serial
communication process between PIC microcontroller and GSM module.SIM900D GSM
module also support UART serialcommunication.
GSM module is used to establish communication between our system and mobile system.
Global System for Mobile communication (GSM) is an architecture usedfor mobile
communication in most of the countries.
3.7.Capacitor
Capacitors are two-terminal electrical elements. Capacitors are essentially two
conductors, usually conduction plates - but any two conductors - separated by an
insulator - a dielectric -with connection wires connected to the two conducting plates.
Capacitors occur naturally. On printed circuit boards two wires running parallel to
each other on opposite sides of the board form a capacitor.
figure 3. capacitor
3.9.Resistor
The flow of charge through any material encounters an opposing force similar in many
respects to mechanical friction this opposing force is called resistance of the material .in
some electric circuit resistance is deliberately introduced in form of resistor. Resistor
used fall in three categories, only two of which are colour coded which are metal film and
carbon film resistor.The third category is the wire wound type, where value is generally
printed on the vitreous paint finish of the component. Resistors are in ohms and are
represented in Greek letter omega, looks as an upturned horseshoe.
Most electronic circuit requires resistors to make them work properly and it is
obliviously important to find out something about the different types of resistors
available. Resistance is measured in ohms; the symbol for ohm is an omega ohm. 1 ohm is
quite small for electronics so resistances are often given in KOhm and M Ohm.Resistors
used in electronics can have resistances as low as 0.1 ohm or as high as 10 Mohm.
figure 3. resistor
Electrical and computer engineering
Page
CHAPTER FOUR
SYSTEM DESIGN
4.1 Introduction
There are several steps to be applied in designing room security system. The relevant
information is gathered through literature review. Data on different hardware materials and
security system projects has been collected where the theoretical design is studied based on
microcontroller for security concept.
The hardware development according to the circuit designed. This process is just only being
preceded if each part of the circuit being improved is valid, else, it will be repeated until it is
valid as the theoretical. Once the hardware development circuits have the output as the
expected, then, the comparison for both hardware and theoretical analysis will be done. Next
is the step where software structure is developed for the security system to be interface with
the hardware development. While the final step of this research is on applying the whole
project to the real room entrance like doors.
In our system first give the power supply to activate microcontroller and stepper motor.
Keypad used as an input for the microcontroller to enter pass word. buzzer,GSM module
AND LCD are output of microcontroller and also stepper motor driver . The stepper motor
driver connected to the stepper motor and stepper motor connected to the door. The buzzer
used for give sound ,GSM module used for receiving and sending message to and from the
system and LCD display the action.
The stepper motor driver used for connecting motor with microcontroller and stepper motor
used for activate the door.
When the microcontroller interfaced with LCD display and keypad,the schematic diagram
will look like the following.
4.2.1. Transformer
V 1 N 1 I2
= = … … … … … … … .( 4.1)
V 2 N 2 I1
Form the above equation and the give values for input output we can calculate number of
turns
v2 9
= =24.4
v 1 220
So from these we get the turn ratio is 24:1 assume that number of turn in secondary be 50
220 N 1
Therefore, =
9 50
N1 = 1222turns
Rectifier
The input from step down transformer is 9 volts AC is converted to DC voltage using a 4
diodes bridge rectifier circuit. 1N4007 rectifier diodes have been used. These diodes have a
voltage drop of 0.9 volts across them and maximum rating 5 V/ 1 A. It also gives
better rectified output compared to other rectifier diodes. First we need to convert the RMS
power supply voltage to its peak voltage value (amplitude) as follows:
Vdc=0.9*12.73=11.457V
Vacrms
Ripple factor, y= Vdc =0.786
Capacitor
Electrical and computer engineering
Page
Capacitors are used as a filtering component. They filter out the AC ripple present in the
output of full wave rectifier.The value of capacitor is calculated as follows for full wave
rectifier
1
C= 4∗√ 3∗¿ f ∗y =0.03f
We use standard electrolytic capacitors of rating 100µF/25V and 1000 µF/16V for this
purpose. We require 1 µF for 1 mA. Therefore, for 500mA we will require 500 µF. Hence we
use 1000 µF (standard) filter capacitor and d 100 µF (standard) ripple capacitor.
Regulator
Since we require a constant 5 V DC supply voltage for the entire circuitry, we have to
regulate the output from the bridge rectifier circuit. So we use LM2937 500mA Low dropout
regulator. The LM2937 is a positive voltage regulator capable of supplying up to 500 mA of
load current. The use of a PNP power transistor provides a low dropout voltage
characteristic. With a load current of 500 mA the minimum input to output voltage
differential required for the output to remain in regulation is typically 0.5V (1V
guaranteed maximum over the full operating temperature range). Special circuitry has
been incorporated to minimize the quiescent current to typically only 10 mA with a full
500 mA load current when the input to output voltage differential is greater than 3V.
The LM2937 requires an output bypass capacitor for stability. As with most low dropout
regulators, the ESR of this capacitor remains a critical design parameter, but the LM2937
includes special compensation circuitry that relaxes ESR requirements. The
Flowchart description
First initialized the material that used in the system then assign a trial to ready entered the
password if the password is correct LCD display welcome then the really on and the stepper
motor activate clock wise and the door open after some delay stepper motor rotate at revisers
direction and the door closed after this the system ready for the next, else check the trial if the
trial is greater than two the buzzer is on and send SMS to the authorized person after this
they need reset value or text to restart the system, else the LCD display in valid password and
increment the trial to give another chance to enter password.
5.1 Result
The power supply is provided first to the hardware and through voltage regulator, the
circuit components receive their proper supply voltage. After that, the LCD displays the
required BCD code. The code is received by the module and checks the code availability.this
all is done by the following procedure.
when the right password is enter the schematic diagram will look like this
6.1 Conclusion
This project concentrates on the design and implementation of a home security system
via cellular phones through GSM modem and microcontroller support. It realizes the help of
mobile since this is the cheapest gadget that almost everybody is using nowadays. In our
project, since it deals with simplicity and low cost, we were able to conceptualize a
user friendly device that helps to protect our properties.
Pertaining to the devices involved in our project, we have tried configuring the GSM modem
for the very first time and also the performance of different sensor needed to accomplish our
project were first studied for their feasibility before any configuration. The software
simulation greatly helped us also to demonstrate the detailed output of our project and it was
very successful. In this project we have studied and completely and successfully modeled
home security system with sending message to cell phone. Interfaced sensors,
programmed microcontroller, GSM configuration and lights activation was obtained by
the group to help protecting our home properties.
The result of our final designed project has met our objectives, in which every sensor is
working and will sound specific alarm when the system goes into alert condition. The
designed project was a really enjoyable and challenging project to work with. It requires a lot
of hard work but the result was amazing and gave as reward, a lot of experience in exploring
different technologies.Our project is really very effective and practical. It can be used not
only in the home but also in any establishment too. It can detect the surrounds to not only
protect our assets but also our lives. Besides, it can be highly customized to suit each one's
need and preference. We think that our designed project is very useful for us as well as
other people. We believe every house in our country should equip a security system like
the one we design.
This project has deepened our technical knowledge in each aspect of electrical
engineering streams. In addition to this, we are proud that we were able to express our own
ideas to make this project more meaningful, from the beginning we were realistic about
the specifications of ourprojects given time, knowledge, and financial constraints. Our final
6.2 Recommendation
Along the course of project completion, we encountered various problems and
obstacles. Not everything that we had planned went smoothly during the project development
span. We had to start from the research phase at the beginning and needed to gain knowledge
on all the devices and components that we had intended to use for our project.
[2]. Dogan Ibrahim, Microcontroller projects in C for the 8051, Oxford, 2000.
Appendices
char AT[]="AT";//to initialize mode
while (*s)
UART1_WRITE(*s++) ;
UART1_WRITE(0X0D) ;
void send_to_modem1(char*s)
while (*s)
UART1_WRITE(*s++) ;
void send_sms()
char txt[6];
int pass[3];
int k,j;
sbit ck at RC0_bit;
void main() {
TRISB = 0x3F;
while(1){
//ANSELH = 0;
start: sum = 0;
Lcd_Init();
// Initialize LCD
Lcd_Cmd(_LCD_CURSOR_OFF);
motor = 0;
ck=1;
cnt = 3;
for(k = 0;k<10;k++) {
do kp = Keypad_Key_Click();
switch (kp) {
/*case 10: kp = 42; break; // '*' // Uncomment this block for keypad4x3
default: kp += 48;
case 1: kp = 1; break; // 1
case 2: kp = 2; break; // 2
case 3: kp = 3; break; // 3
case 5: kp = 4; break; // 4
case 6: kp = 5; break; // 5
case 7: kp = 6; break; // 6
case 9: kp = 7; break; // 7
if(k>5)
Lcd_Cmd(_LCD_CURSOR_OFF);
delay_ms(200);
goto start;
if (kp != 42 && kp != 35 )
if(k == 2)
if(k == 1)
if(k == 0)
} else
if (kp == 42)
Electrical and computer engineering
Page
{ //if clear is pressed
if(k == 2)
if(k == 1)
if(k == 0)
goto start;
Lcd_Cmd(_LCD_MOVE_CURSOR_LEFT);
k--;
Lcd_Out(1, 1, "1");
for(i = 1;i<4;i++) {
Lcd_Cmd(_LCD_CURSOR_OFF);
DELAY_MS(50);
Lcd_Out(1, 1, "CHECKING.");
delay_ms(50); }
if(sum == 147)
motor = 1;
Lcd_out(1,1,"wellcom");
ck=1;
delay_ms(1200);
ck=0;
delay_ms(1200);
motor = 0;
else {
buzzer=1;
UART1_Write(10);
Electrical and computer engineering
Page
UART1_Write(13); // Endless loop
UART1_Write_Text("Unauthorized person");
delay_ms(1000);
} } } }}