Microcontroller Based Code Locking System with Alarm

Published on June 2016 | Categories: Types, Presentations | Downloads: 53 | Comments: 0 | Views: 232
of 9
Download PDF   Embed   Report

IOSR Journal of Electrical and Electronics Engineering (IOSR-JEEE) vol.9 issue.1 version.2

Comments

Content


IOSR Journal of Electrical and Electronics Engineering (IOSR-JEEE)
e-ISSN: 2278-1676,p-ISSN: 2320-3331, Volume 9, Issue 1 Ver. II (Jan. 2014), PP 09-17
www.iosrjournals.org
www.iosrjournals.org 9 | Page

Microcontroller Based Code Locking System with Alarm

Diarah Reuben Samuel, OsuekeChristian.O, Egbune Dickson
(Electrical and Information Engineering, College of Science and Engineering/ Landmark University Omu-Aran,
Nigeria)
(Mechanical Engineering, College of Science and Engineering/ Landmark University Omu-Aran, Nigeria
(Electrical and Information Engineering, College of Science and Engineering/ Landmark University Omu-Aran,
Nigeria)

Abstract : The need for strict security measures has been necessary since the beginning of time. Access to
certain places and items need strict restrictions to only the privileged few. This restricted zone can vary from
strong holds and safes in financial institutions to doors leading to restricted areas. The various innovations in
security access system include; code based lock, keycard lock, thumb print scan, retina scan. They come in
handy in security systems. Code based locking system is best suited in most applications because of its
simplicity and reliability. Since the code based locking system is always resident in the area to be protected,
there are fewer chances of security breaches unlike the keycard lock system in which the access card can fall
into unauthorized hands. Furthermore, in the issue of maintenance, the access code can easily be changed at will
with lesser cost unlike in the case of keycard system where a new set of access cards are required. The design
and operational principles of a microcontroller based code locking system is the subject of the thesis.The project
is made of a keypad unit for entering the access code, a dynamic display unit that displays different messages at
specific time, a door controller section made up of a H-bridge driver IC that controls the movement of the motor
attached to the door and an alarm system that triggers when the conditions are bridged. The whole system is
controlled by an 8051 based microcontroller (89s51).
Keywords :Debugging,Hardware, Microcontroller, programming, software.

I. Introduction
¬O· OC O·· C¹CcOsO©CC C× ¬c1O·¹ C·O± ¬C1O cC
C¹1 scC a· CC·C·c O©O· ·c1·± O©O·COO C·¹¬©11©CC
C¹ O©O· C©OOC· C¹ CC CC©1·± O··¹·aO COOO©C- C©O·
1 cO ccC-·¹ cCc C¹CC·¹O©·1 cO ¹©1C C× O··×O_
E·cO Oc1 O··¹· O·· ©C1C©¹cO©CC C× O·©1
CcC·¹ sc¬· ×¹C¬± O©O· c sCc· ac1·c CCsC©C- 1O1O
·¬± CCCO O·· C·¹1CC1 O©O· O·· css·11 sCc· scC C
C·C O·· cCC¹± 1c×· C¹ cCO O·©C- O·cO C··c·c OC
a· CCsC·c _E·· cCC¹ ·c1 OC a· a¹CC·C ×¹C¬ O·· ·
©C-·1 a·×C¹· OCOcCO·c O©1©OC¹ scC -c©C css·11 O
·O1 OcC©C- 1·sO¹©OO cO c ·©-··¹ C¹C1C·sO1_
lC O·©1 c·1©-C O· ·cO· ©¬CCC¹·c O·· O1· C× a
CO· ·c¹cOc¹· cCc 1C×OOc¹· OC a¹©C- caCOO O·· ·C
O©¹· C¹C¤·sO_
E·· ·c¹cOc¹· sC¬CCC·CO1 c¹· 1CC·CO sCC¹c©CcO
·c aO O·· *E·±L¯_ ¬©s¹CsCCO¹CCC·¹ s·©C O·©C· O·
· ¨ C¹C-¹c¬¬©C- CcC-Oc-· Oc1 O1·c OC C¹C-¹c¬ O·
· s·©C_
E·©1 Oc1 c©¬·c cO ¹·cOs©C- O·· ¹cO· C× ©CC·
-cC ·CO¹cCs· ©COC ¹·1O¹©sO·c c¹·c1 1Os· c1 ·C¬·
1 C×שs·1± ·CO·C1 ·Os_ O·©1 C¹C¤·sO scC cC1C a·
©¬CC·¬·CO·c ©C 1O¹CC- ·CCc1 cCc 1c×·1 O1·c ©C
שCcCs©cC ©C1O©OOO©CC1_
C·O ¬O1O O· O1· sCc· ac1·c CCsC± ©O 1COC
c1 ¬C¹· ·OC·C1©O· cCc ²O©O· OC¹·c1CCcaC·´ O·O 1
·COCc CC·
O1· c sCc· OC CC·C c cCC¹ O··C O©O· c s··cC
CccCCsC O·· cCC¹ CCCC1 1c×· ·CCO-·_ * ¬©s¹CsCC
O¹CCC·¹±ac1·c sCc· ac1·c CCsC ©1 O1·c ¬C1OCO ©C
·©-·CO ¹·1O¹©sO·c OCC·1 ©C ©C1O©OOO©CC1_ O¹O··¹
¬C¹·± c sCc· ac1·c CCsC©C- 1O1O·¬
Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 10 | Page
scC a· ©¬CC·¬·CO·c ©C 1c×·1 cCc 1O¹CC- ¹CC¬1
_ LC O©O· O·©1 sCc· ac1·c CCsC©C- 1O1O·¬± O·· C¹
Caca©C©OO C× ©CC·-cC ·CO¹cCs· ©1 O·¹O CCO± a·scO
1· CCCO O·· C·CCC· O©O· O·· ¹©-·O sCc· scC ·cO·
css·11 ± O·©s· ©1 cC ccOcCOc-· CO·¹ O·· CC¹¬cC
CCsC1 C¹ C·O1± O·©s· scC a· CC·C·c O©O· c ¬c1O
·¹ C·O_E·©1 CcC·¹¯C¹C¤·sO ©1 ¬©s¹C sCCO¹CCC·c ac
1·c
c©¬·c cO 1·sO¹©OO_ E·· ¬©s¹CsCCO¹CCC·¹ ©1 O
·· ¬c¤C¹ CC·¹cOC¹ C× O·©1 C¹C¤·sO ©O sCCO¹CC1 ¬C
1O Cc¹O C× O·· sCCC·sO©CC CC O·· aCc¹c_ lO ©1 CC
O·¹·c aO c _´ OCCO1 *s 1O·C cCOC O¹cC1×C¹¬·¹ O·©
s· ©c sCCO·¹O·c OC c _´±OCCO ¬s O©O· O·· ··CC C
× c ¹·sO©×©·¹´ O·· sO¹¹·CO ©1 ¬cc· 1O¹c©-·O O©O
· O·· ··CC C× c scCcs©OC¹_ E··C O·· sO¹¹·CO ©1
¹·cOs·c OC c ¯ OCCO O©O· c OCCOc-· 1Oca©C©O·¹ c
Cc c CcC·¹ scCcs©OC¹ J¯_¯_ O× ×©CcC 1O¹c©-·O·C1
O·· sO¹¹·CO c×O·¹ ¹·cOsO©CC_
* ¯OI c¹¹cO1 C× ¹·1·O 1O©Os··1 c¹· O1
·c c1 O·· C·O Ccc_ E·· ¬©s¹CsCCO¹CCC·¹ 1scC1 O
·¹CO-· O·· C·OCcc OC CCCO O·· C¹·11·c C·O1_ *C
c¹¹cO C× 1·O·C 1·-¬·CO c©1CCcO ©1 O1·c OC c©1CC
cO O·· C¹·11·c C·O1± O·©C· c C©²O©c s¹O1OcC c©1C
CcO ©1 O1·c OC ©Cc©scO· O·· sCCc©O©CC C× O·· 1O
1O·¬_ LC¬· C©C1 ©C cCCO··¹ CC¹O C× O·· ¬©s¹C sC
CO¹CCC·¹ O©CC a· sCCC·sO·c OC v*¬L cCc O·· Cc1O
CC¹O O©CC a· O1·c OC sCCC·sO OC O·· t±a¹©c-· c¹©
O·¹ O·cO O©CC CCO·¹ O·· ¬COC¹ O·cO O©CC CC·C O··
cCC¹_ *CC sCCC·sO©CC1 OC O·· ¬©s¹CsCCO¹CCC·¹ O·
¹· cCC· O©O· c ¹·1©1OC¹ sCCC·sO·c OC ©O_
___ -¹C¤·sO 1C·s©×©scO©CC ´
1l¨Lר×EL×vv*L ¯*L*¬ ¨×¬* vרl. LmLE*1 c11O¹·1 c ·©-
··¹ ¹cO· C× 1·sO¹©OO_ E·· ¬c¤C¹ sC¬CCC·CO ©1 O·
· ¬©s¹CsCCO¹CCC·¹± O·©s· ·c1 sCc·1 O·cO c¹· aO¹
C·c ©COC ©O± O·©s· ¹OC1 C¹ sCCO¹CC1 O·· ×OCsO©CC
cC©OO C× O·©1 c·1©-C_ ×O··¹1 Cc¹O1 C× O·· c·1©-C
c¹·
c E·· CCO·¹ 1OCCCO OC©O
a L·1·O 1O©Os··1
s E·· cCC¹
c t±a¹©c-· c¹©O·¹
· v©-·O *¬©OO©C- ¬©Cc·1 Jv*¬
× v¨¬

c E·· CCO·¹ 1OCCCO OC©O J-LC sCC1©1O1 C× c
O¹cC1×C¹¬·¹± c ¹·sO©×©·¹± c scCcs©OC¹± c OCCOc-
· ¹·-OCcOC¹ cCc c CcC·¹ scCcs©OC¹_ lO C¹CcOs·1 _
¯O O·©s· O·· ¬©s¹CsCCO¹CCC·¹ cCc 1C¬· CO··¹ sC¬
CCC·CO1 ¬cC·1 O1· C×_ LC¬· CO··¹ sC¬CCC·CO1 C©C·
O·· ¬COC¹ O1·c aO O·· cCC¹ C··c1 __´O± 1C O·· s
CCC·sO©CC ×C¹ CCO·¹ 1OCCCO ©1 a·×C¹· O·· OCCOc-·
¹·-OCcOC¹_
a * ¯OI ¹·1·O 1O©Os· ¬cO¹©O ©1 O1·c c1 O··
C·OCcc_
s E·· cCC¹ Oc1 c·1©-C·c O©O· c O¨¬ O¹cO± 1
C O··C ©O ©1 CC·C O·· cCC¹ ©1 CCsC·c cCc O©s·
O·¹1c_
c E·· ¹·CcO OC©O ·c1 O·· 1CC· cOOO OC ¬CO·
O·· ¬COC¹± O·©s· OO¹C1 O·· -cO· CC·C cCc sCC1·
_
· E·· v¨¬ 1·CO1 O·· Cc¹O©sOCc¹ sCCc©O©CC1
C× cCC O·· O·CC· 1O1O·¬_
× E·· v*¬1 c¹· O·¹·· ©C CO¬a·¹ O··O ¬cC· O
·· c·1©-C ¬C¹· ©CO·¹csO©O·± O··C O·· cCC¹ ©1 CC
Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 11 | Page
sC·c C¹ CC·C± O··C c O¹CC- sCc· ©1 ·CO·¹·c cCc
O··C O·· O¹CC- C·O Oc1 ·CO·¹·c_
´ tc¹cOc¹· 1Oa1O1O·¬
E·· c·1©-CO ©1 ¬cc· OC C× ×©O· ¬CcOC·1 Cc¬·
CO´
__ ·OCcc OC©O
´_ ¬©1CCcO OC©O
I_ ¨CCO¹CC OC©O
¯_ -CO·¹ 1OCCCO OC©O
¯_ ¬CC¹ sCCO¹CC OC©O
±_ *Cc¹¬ 1O1O·¬
´__-CO·¹ 1OCCCO OC©O
E··¹· c¹· ¬cCO OOC·1 C× CCO·¹ 1OCCCO_ 1C1O c
¹· c·1©-C·c OC sCCO·¹O ·©-· OCCOc-· *¨ ¬c©C1 ·C
·sO¹©s©OO OC c 1O©OcaC· CCO OCCOc-· 1OCCCO ×C¹ ·
C·sO¹CC©s1 s©¹sO©O1 cCc CO··¹ c·O©s·1_ * CCO·¹ 1
OCCCO scC aO a¹CC·C cCOC ©COC c 1·¹©·1 C× aCCsC1
± ·cs· C× O·©s· C·¹×C¹¬1 c Cc¹O©sOCc¹ ×OCsO©CC_


 E¹cC1×C¹¬·¹´ 1O·C1 cCOC ·©-· OCCOc-· *¨
¬c©C1 OC CCO OCCOc-· *¨_
 L·sO©×©·¹´ sCCO·¹O1 *¨ OC ¬¨± aOO O·· ¬¨
COOCOO ©1 Oc¹O©C-_
 L¬CCO·©C-´ 1¬CCO··1 O·· ¬¨ ×¹C¬ Oc¹O©C-
-¹·cOCO OC c 1¬cCC ¹©CCC·_
 L·-OCcOC¹´ ·C©¬©CcO·1 ¹©CCC· aO 1·OO©C-
¬¨ COOCOO OC c שO·c OCCOc-·_


©-O¹·´___´ E¹cC1×C¹¬·¹1
_ L·sO©×©·¹ _ ¨cCcs©OC¹ _ L·-OCcOC¹
E·· ¹·-OCcO·c ¬¨ COOCOO ©1 O·¹O 1¬CCO· O©O· CC ¹
©CCC·_ lO ©1 1O©OcaC· ×C¹ cCC ·C·sO¹CC©s s©¹sO©O
1_

2.2 DISPLAY UNIT:
the display unit consists of 16*2 liquid crstal display that dispays the position of the intruder as well as the
condition of the alarm system. The lower data bus of the LCD is connected to port 2 of the microcontroller
while RS and EN pins are connected to port 3_0 and port 3_1 respectively.

2.3 Key pad unit
Keypads are assembled in a matrix form as illustrated below:

Fig 2.3 4x3 matrix key pad
Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 12 | Page
The above diagram shows 4x3 keypad – 12 switches in a default state (all switches open) there is no connection
between the rows and columns. When the switch is pressed a connection between the switch’s columns is made.

KEYPAD DECODER
Many keypads are built with an onboard decoder that scan the keypad, and if a key is pressed, returns a number
identifying the key.
The decoder has 7 inputs; the 4 x inputs are connected to the 4 keypad columns while the y inputs are connected
to the 3 keypad rows.
How the keyboard is scanned.
The steps are
Scan row 1
Scan row 2
Scan row 3
Scanning a row is achieved applying 0V to the port pin for that row and 5V to the other three rows, then
scanning each individual column to see if one of them is low. If it is, then the key at the junction between the
current row and column being scanned is the pressed key.
Clear row 1, set other 3
Scan column 1
Scan column 2
Scan column 3
Clear row 2, set other 3
Scan column 1
Scan column 2
Scan column 3
Clear row 3, set other 3
Scan column 1
Scan column 2
Scan column 3

For example, let’s say the key being pressed is key 6. When scanning the first row, P1.0 will be cleared while
the other 3 rows (P1.1, P1.2, and P1.3) are set. Since no key in this row is closed, there is no path for current
through any of the pull up resistors and all 3 columns (on P1.4 to P1.6) are high. Therefore the key pressed was
not found while scanning row 1.
- Scanning row 2 (with 6 still closed) in this case, column 3 is connected through the closed switch to row 2.
Since row 2 is low, column 3 is low
The keypad is initialized in the main program all rows are cleared. Therefore when a key is pressed, since all
rows are LOW, then one of the columns (the one containing the key that has been pressed) will be connected to
0V.

2.4 Microcontroller unit:
The AT89C51 is a low power, high performance cmos 8-bit microcontroller with 4Kbytes of flash
programmable and erasable read only memory (PEROM). The device is manufactured using Atmel`s high
density nonvolatile memory technology and is compatible with the industry standard MCS-51 instruction set
and pinout. The on-chip flash allows the program memory to be reprogrammed in system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with flash on a monolithic chip, the
Atmel AT89C51 is a powerful microcomputer, which provides a highly flexible and cost effective solution to
many embedded control application.The AT89C51 is designed with static logic for operation down to zero
frequency and support two software selectable power saving modes. 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
hardware reset.
.
Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 13 | Page





















Fig. 3.22: Pin configuration of AT89S51
Features of AT89S51
 Programmable serial channel
 Compatible with MCS-51TM product
 4Kbytes of in-system Reprogrammable flash memory - Endurance: 1,000 write/Erase cycles
 Fully static operation:0Hz to 24MHz
 Three-level program memory lock
 128 x 8-bit internal RAM
 32 programmable I/O lines
 Two 16-bit timer/counters
 Six interrupt sources
 Low-power idle and power-down modes.

2.5 Alarm unit
This consists of an LED, which connects from the P0.7 of the micro controller, which in turn connects
to 1K resistor, which finally connects to the VCC. The LED indicates on the alarm is set to slow.
P3.7 of the micro controller connects to the resistor (1K), through the base of the transistor (NPN C945) and
the collector to the ground, while the emitter terminal is connected to the negative terminal of the alarm speaker,
and the positive to the Vcc. The remaining terminal of the resistor to Vcc, as shown in the figure 3.4

1k
vcc
M
I
C
R
O
-
C
O
N
T
R
O
L
L
E
R

A
T
8
9
C
5
1
C945
GND
VCC
VCC
Buzzer
4.7k
2k
or NPN Transistor
P2.7
P2.6
28
27

Fig. 3.4 Micro controller interface with alarm unit
Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 14 | Page
2.5.1 Door control segment:
The door control segment consists of an H-Bridge driver IC that guarantee’s the clockwise and the anti
clockwise movement of the electric motor attached to the door system. The H-Bridge driver IC L293D is
designed to control 2 DC motors. There are 2 input and 2 output pins for each motor. The 2 pairs of input
determine the behavior of electric motor attached to it. The chip has two enable pins that must be high (+5V) for
operation.

The behavior of motor for various input conditions are as follows:
A B
Stop Low Low
Clockwise Low High
Anti clockwise High Low
Stop High High
Table 3.5: H-bridge motor control

II. Design Process:
A micro-controller based project design process is characterized by the following;
 Definition of task
 Requirements
 Factor that influence choice
In defining a task, every design comes from an idea or a problem that requires a solution. Questions may be
generated on what exactly that is required to be achieved and the feasibility of the ideas as regards to the
implementation.
If these questions are analyzed critically with tangible solutions to the problem, a development of this idea into a
reality is the next step.
Requirements for design process have to be considered once an idea has been established. The need to
determine whether or not the idea requires a PC or not, depending on the complexity of the circuitry, or whether
the circuits to be designed needs to make a complex decision or deal with complex data.
The compare these factors with topic with IC’s (AND gates) which two inputs when high logic changes
outputs. Preferably, a micro-controller will be the best option based on the circuits to be designed with less
hardware connections and flexibility. Writing a program that performs a desired function accesses the ability of
the micro-controller. However, it came to our thought that among all the components used here the one that
consumes the highest power is the Light Emitting Diodes (LEDs), which need as much as 15-volt to glow and
draw as maximum as 2-ampere of current. As a result if this, I decided to use 15-volts, 2-ampere rated
transformer for this design. After the voltage is stepped down 15-volts using a transformer, a full wave rectifier
circuit was designed using four Diodes (IN4001). This value of Diodes is used here because from the
specification of voltage/Diode rectifying data book, this value is adequate for lower voltages, say 0-24 volt. The
load current of the rectifier is given as follows;
Idc = 21m/3.1

When 1m = maximum current = 2 amp
Idc = load current which is in dc form after recification.
Hence idc = 2*3 / 3.14 =4/3.14, idc = 1.27 amps
Therefore 1.27amps is the maximum load current that can be drawn in the whole system. Also it is known that
after rectification, the same voltage (15-volts) continues to flow into the filter. As a result the load voltages 15-
volts
Thus Vdc = Load voltage = 15volts.
And Vdc = 21m*RL / 3.14
RL = Load resistance
RL = 47.13/4
RL = 11.78* 3.14 = 1.78
From this, it is obvious that V = IR = 1.27 * 1.27








Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 15 | Page
III. System Block Diagram

Figure 4.1 Block Diagram of Microcontroller Based code based locking system

4.2 System Flowchart

Fig 4.2 system flow chat


Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 16 | Page
4.3 CIRCUIT DIAGRAM

Fig 4.3 circuit diagram

IV. Software Design
Software, are computer programs; instructions that cause the hardware, the machines to do work.
Software as a whole can be divided into a number of categories based on the type of work done. The two
primary software categories are operating systems (system software), which control the workings of the
computer, and application software, which addresses the multitude of tasks for which people use computers.

Fig .5.1 Software Design




Microcontroller Based Code Locking System With Alarm
www.iosrjournals.org 17 | Page
5.2 Program
#include "at89x51.h"
#define LCD_en P3_1
#define LCD_rs P3_0
#define LCD_DELAY 2000 /* Delay for 1 ms */
#define LCD_clear() LCD_command(0x1) /* Clear display LCD */
#define LCD_origin() LCD_command(0x2) /* Set to origin LCD */
#define LCD_row1() LCD_command(0x80) /* Begin at Line 1 */
#define LCD_row2() LCD_command(0xC0) /* Begin at Line 2 */

code unsigned char
digit[16]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0,0x10,0xff,0x03,0x46,0x21,0x06,0x0e};
LCD_row1(); LCD_puts("access blocked!!");
LCD_row2(); LCD_puts("pls enter puk!!");
.
.

alarm();
//delay(2000);
}
}

}
}
}
}
V. Conclusion
This paper microcontroller based code locking system with alarmhas successfully presented a functional
and an easy way to combat crime and theft using a low cost device, and can be remotely applied everywhere
security is needed.

REFERENCES
[1]. Belone Schilling, Electronic Circuits: Discrete and Integrated, McGraw-Hill, New York,1979.
[2]. B.L Theraja and A.K Theraja, A Textbook on Electrical Technology, 2003, 23
rd
Edition, Pp 1887 – Pp 1888.
[3]. Paul Horowitz and Windfield Hill, The Art of Electronics, 1989, 2
nd
Edition, Pp 7- Pp 8, Pp 55 – Pp 58, Pp 614 –Pp 622.
[4]. Atmel Corporation Data Sheet on AT89C51, 0285D-B-12/97
[5]. NTE Electronics Inc., ECG Data Book, January 2002, 10
th
Edition.
[6]. Giorgio Rizzoni, Principles of Electrical Engineering, 2003, 3
rd
Edition

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close