PASSWORD BASED SECURITY DOOR LOCK SYSTEM A PROJECT REPORT Submitted by ARPAN SINHA 0102092808 CHHAVI GOYAL 0412092808 DEEKSHA AGGARWAL 0562092808 SNEHA 0602092808 in partial fulfillment for the award of the degree Of BACHELORS OF TECHNOLOGY In ELECTRONICS AND COMMUNICATION ENGINEERING AT i
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
PASSWORD BASED SECURITY DOOR LOCK SYSTEM
A PROJECT REPORT
Submitted by
ARPAN SINHA 0102092808
CHHAVI GOYAL 0412092808
DEEKSHA AGGARWAL 0562092808
SNEHA 0602092808
in partial fulfillment for the award of the degree
Of
BACHELORS OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
AT
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERINGGB PANT ENGINEERING COLLEGE
OKHLA INDUSTRIAL ESTATENEW DELHI 110019
DECEMBER 2011
i
LIST OF TABLES
CHAP-TER NO.
TABLE NO
TABLE TITLE PAGE NO
3. 3.1.1 Alternate functions of Port 1 11
3.1.2 Alternate functions of Port 3 11
3.4.1 Pin Description of AT24C02 16
3.5.1 Pin description of 16x2 18
3.5.2 LCD command codes 20
ii
LIST OF FIGURES
CHAP-TER NO.
FIG NO.
FIGURE TITLE PAGE
NO.2. 2.1 Circuit diagram of PASSWORD BASED SE-
CURITY DOOR LOCK SYSTEM
6
3 3.1.1 Microcontroller AT89S52 9
3.1.2 Pin Configuration of AT89S52 10
3.2.1 Symbol of an LED 13
3.2.2
3.2.3
3.3.1
3.3.2
3.4.1
3.5.1
3.5.2
3.6.1
3.6.2
3.7.1
3.7.2
3.8.1(a
)
3.8.1(b
)
3.9.1
3.10.1
Parts of an LED
Recombination in an LED
Variants of Push Button Tact Switch
Working of Push Button Tact Switch
Pin Diagram of AT24C02
16X2 LCD
Pin diagram of 16x2 LCD
Types of resistors
Colour coding of resistor
Ceramic Capacitor
Electrolytic Capacitor
Step Down Transformer
9-0-9 Step Down Transformer
7805 IC
Full Wave Rectification
IN4007 diode
Equivalent circuit of crystal oscillator
13
14
15
15
16
17
18
22
23
24
24
26
26
27
28
30
32
iii
3.11.1
3.12.1
4. 4.1 Interfacing of Microcontroller 34
4.1.1 16X2 LCD Display 34
4.1.2 Interfacing of AT89S52 with 16X2 LCD Dis-
play
35
4.2.1 Interfacing with Push button switches 36
4.3.1 Interfacing Microcontroller with reset switch 37
4.4.1 Interfacing of crystal oscillator with Microcon-troller
37
4.5.1 Interfacing of output LED with Microcontroller 38
iv
DECLARATION
We hereby declare that the project work entitled “PASSWORD BASED SECU-
RITY DOOR LOCK SYSTEM” submitted to the G.B.Pant Engineering Col-
lege, Delhi is a record of an original work done by us under the guidance of
Mrs. Monika Garg, and this project work is submitted in the partial fulfillment
of the requirements for the award of the degree of Bachelor of Technology in
Electronics & Communication Engineering. The results embodied in this thesis
have not been submitted to any other University or Institute for the award of any
These diodes are used to convert AC into DC. These are used as half wave recti-
fier or full wave rectifier. Three points must he kept in mind while using any
type of diode.
1.) Maximum forward current capacity
2.) Maximum reverse voltage capacity
3.) Maximum forward voltage capacity awesome
The number and voltage capacity of some of the important diodes available in
the market are as follows:
Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and
IN4007 have maximum reverse bias voltage capacity of 50V and maximum for-
ward current capacity of 1 Amp.
Diode of same capacities can be used in place of one another. Besides this,
diode of more capacity can be used in place of diode of low capacity but diode
of low capacity cannot be used in place of diode of high capacity. For example,
in place of IN4002; IN4001 or IN4007 can be used but IN4001 or IN4002 can-
not be used in place of IN4007.The diode BY125made by company BEL is
equivalent of diode from IN4001 to IN4003. BY 126 is equivalent to diodes
IN4004 to 4006 and BY 127 is equivalent to diode IN4007. IN4007 diode is
shown in the adjacent figure.
41
Fig 3.11.1: IN4007 DIODE
One disadvantage of this full-wave rectifier design is the necessity of a trans-
former with a center-tapped secondary winding. If the circuit in question is one
of high power, the size and expense of a suitable transformer is significant.
Consequently, the center-tap rectifier design is seen only in low-power applica-
tions.
3.12 CRYSTAL OSCILLATOR
A crystal oscillator is an electronic oscillator circuit that uses the mechanical
resonance of a vibrating crystal of piezoelectric material to create an electrical
signal with a very precise frequency. This frequency is commonly used to keep
track of time (as in quartz wristwatches), to provide a stable clock signal for
digital integrated circuits, and to stabilize frequencies for radio transmitters and
receivers. The most common type of piezoelectric resonator used is the quartz
crystal, so oscillator circuits designed around them became known as "crystal
oscillators."
3.12.1 OPERATION
A crystal is a solid in which the constituent atoms, molecules, or ions are
packed in a regularly ordered, repeating pattern extending in all three spatial di-
mensions.
Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonant frequencies of
42
vibration. For example, steel is very elastic and has a high speed of sound. It
was often used in mechanical filters before quartz. The resonant frequency de-
pends on size, shape, elasticity, and the speed of sound in the material. High-
frequency crystals are typically cut in the shape of a simple, rectangular plate.
Low-frequency crystals, such as those used in digital watches, are typically cut
in the shape of a tuning fork. For applications not needing very precise timing, a
low-cost ceramic resonator is often used in place of a quartz crystal.
When a crystal of quartz is properly cut and mounted, it can be made to distort
in an electric field by applying a voltage to an electrode near or on the crystal.
This property is known as piezoelectricity. When the field is removed, the
quartz will generate an electric field as it returns to its previous shape, and this
can generate a voltage. The result is that a quartz crystal behaves like a circuit
composed of an inductor, capacitor and resistor, with a precise resonant fre-
quency.
Quartz has the further advantage that its elastic constants and its size change in
such a way that the frequency dependence on temperature can be very low. The
specific characteristics will depend on the mode of vibration and the angle at
which the quartz is cut (relative to its crystallographic axes).Therefore, the reso-
nant frequency of the plate, which depends on its size, will not change much, ei-
ther. This means that a quartz clock, filter or oscillator will remain accurate. For
critical applications the quartz oscillator is mounted in a temperature-controlled
container, called a crystal oven, and can also be mounted on shock absorbers to
prevent perturbation by external mechanical vibrations.
The equivalent circuit for the quartz crystal shows an RLC series circuit, which
represents the mechanical vibrations of the crystal, in parallel with a capaci-
tance, Cp which represents the electrical connections to the crystal. Quartz crys-
tal oscillators operate at "parallel resonance", and the equivalent impedance of
43
the crystal has a series resonance where Cs resonates with inductance, L and a
parallel resonance where L resonates with the series combination of Cs and Cp
as shown below in Fig 3.12.1.
Fig 3.12.1: Equivalent circuit of crystal oscillator
44
CHAPTER-4INTERFACING
WITHMICROCONTROLLER
45
Interfacing basically means connection of different component to form a com-plete system. In this project following components are interfaced with micro controller:
16X2 LCD
Push button switches
Reset switch of microcontroller
Crystal oscillator
An overall interfacing of microcontroller with different component is shown be-
low
Fig 4.1: Interfacing of Microcontroller
4.1 INTERFACING WITH LCD.
As described above 2X16 LCD display has been used, with 16 pins and each
pin having a particular function. Fig. 4.1.1 shows the 16X2 LCD display with
16 pins.
Fig 4.1.1: 16X2 LCD display
46
OUTPUT
16X2 LCD,LED
MICROCONTROLLER
AT89S52
INPUT12 PUSH BUTTON TACT SWITCHES
POWER SUPPLY 5V
LCD 16X2
For interfacing 16X2 LCD display with microcontroller, port 0 and port 2
of the microcontroller is used.
Pin 0.0 to pin 0.7 is connected to data lines i.e. pin 7 to pin 14 of the LCD
display with pull up registers.
P2.7 is connected to the enable pin of the circuit.
P2.5 is connected to the RS pin of the LCD.
P2.6 is connected to the R/w pin of the LCD.
LCD interfacing with AT89s52 microcontroller is shown in Fig 4.1.2.
Last two pins of the LCD are connected to the back light. Some time
these are internally connected and some time these are connected by the
power supply.
Fig 4.1.2: INTERFACING OF AT89s52 WITH 16X2 LCD DISPLAY.
4.2 INTERFACING OF SWITCHES
As described above, 12 push button tact switches
have been used, each having 2 legs. To interface it
with microcontroller one leg of all the switches is
connected to ground and the other leg is connected
to microcontroller i.e. pins of port1 and port 3 as
shown in the Fig 4.2.1. The 12 I/O pins of the micro-
controller are made normally high,; when a switch is
press a low appears at the pin. This makes the microcontroller to detect that a
switch has been pressed.
47
LCD 16X2
Fig 4.2.1: Interfacing of switches
4.3 INTERFACING OF RESET SWITCH:Pin 9 of the microcontroller is connected to the reset circuit. Reset circuit con-
sists of a resistor, switch and a capacitor as shown in Fig.4.3.1 When power
supply is given to the AT89s52 microcontroller, it doesn’t start. So to ON the
microcontroller, it needs to be reset. Resetting of microcontroller requires giv-
ing ‘logic 1’ to the reset pin for at least 2 clock pulses.
When power supply is given to the circuit, it makes the capacitor to charge. On
pressing the reset switch current follows through the alternative path via the
switch and makes pin 9 high in addition to this capacitor also discharges with
the help of resistor and help in making the pin 9 high.
48
Fig 4.3.1. INTERFACING MICROCONTROLLER WITH RESET SWITCH.
4.4 INTERFACING OFCRYSTAL OSCILLATOR
To interface crystal oscillator with the microcontroller Pin no 18 and 19 is con-
nected to external crystal oscillator to provide a clock to the circuit. Two capaci-
tors of 33 pf are also applied to the crystal oscillator circuit as shown in Fig
4.4.1. to make it free from noise.
Fig. 4.4.1. INTER-FACING OF CRYSTAL OSCILLATOR WITH MICROCONTROLLER4.5. INTERFACING OF OUTPUT LED
As described above LED has been used for output. For interfacing it with
AT89s52 microcontroller pin no.21 is used as shown in Fig. 4.5.1. The voltage
across the LED is very insensitive to (i.e., very close to constant with) the cur-
49
P9 AT89s52
1918
rent through the device. This means that to a good approximation, we can model
the LED as a constant voltage drop.
If we want to model the LED's V-I characteristics more accurately, then we
could do that as a series combination of an ideal diode and a resistor. The ideal
diode has an exponential V-I characteristic; that is what is responsible for the
non-linear part of the curve near 1.6 V. There is also an ohmic (i.e., linear rela-
tionship between V and I) resistance associated with the LED; the voltage
dropped by that resistance is negligible at small currents, because V = IR is
small when I is small, but becomes significant at higher currents.
Fig.4.5.1 INTERFACING OF MICROCONTROLLER WITH O/P LED.
CHAPTER 5
50
AT89s52
P21
PROGRAMMING OF MICROCON-
TROLLER
51
5.1 KEIL SOFTWARE
As described above, keil software has been used for coding. Keil devel-
opment tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to
the student just learning about embedded software development.
Keil was founded in 1982 by Günter und Reinhard Keil, initially as a
German GBR. In April 1985 the company was converted to Keil Elek-
tronik GMBH to market add-on products for the development tools pro-
vided by many of the silicon vendors. Keil implemented the first C com-
piler designed from the ground-up specifically for the 8051 microcon-
troller.
The industry-standard Keil C Compilers, Macro Assemblers, Debuggers,
Real-time Kernels, Single-board Computers, and Emulators support all
8051 derivatives.
The Keil 8051 Development Tools are designed to solve the complex
problems facing embedded software developers.
When starting a new project, simply select the AT89s52 microcontroller
from the Device Database and the µVision IDE sets all compiler, assem-
bler, linker, and memory options.
The Keil µVision Debugger accurately simulates on-chip peripherals of
microcontroller. Simulation helps in understanding hardware configura-
tions and avoids time wasted on setup problems. Additionally, with simu-
52
lation, one can write and test applications before target hardware is avail-
able.
To begin testing your software application with target hardware, use the
MON51, MON390, MONADI, or FlashMON51 Target Monitors, the
ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to down-
load and test program code on the target system.
The snap shot of keil µ vision 2 is shown in Fig.5.1.1.
Fig. 5.1.1: Keil snapshot
5. 5.2 PROGRAMMING AT89s52 IN DIGITAL LOCK SYSTEM.
53
/*HEADER FILES*/
#include<reg51.h>
#include<string.h>
/*LCD PIN CONNECTIONS*/
#define lcd P0
sbit rs=P0^1;
sbit en=P0^3;
/*LCD FUNCTIONS DECLARATIONS*/
void init_lcd(void);
void cmd_lcd(unsigned char);
void data_lcd(unsigned char);
void str_lcd(unsigned char *);
void Delay_ms(unsigned int);
/*KEYPAD PIN CONNECTIONS*/
sbit row0=P2^3;
sbit row1=P2^5;
sbit row2=P2^6;
sbit row3=P2^0;
sbit col0=P2^4;
sbit col1=P2^2;
sbit col2=P2^1;
/*MOTOR PIN CONNECTIONS*/
sbit M1=P1^0;
sbit M2=P1^5;
sbit BUZZER=P1^2;
54
/*VARIABLES DECLARATION*/
unsigned char i,j;
unsigned char colval,rowval,pwdchange;
unsigned char pwd[15],str1[]="12345";
unsigned char keypad[4][3]={'1','2','3',
'4','5','6',
'7','8','9',
'*','0','#',};
/*PASSWORD FUNCTION DECLARATION*/
void password(void);
/*KEYPAD FUNCTION DECLARATION*/
unsigned char key(void);
/*MAIN FUNCTION*/
main()
{
unsigned char k=0;
BUZZER=0;
M1=M2=0;
init_lcd(); //LCD INITIALIZATION FUNCTION CALLING
str_lcd("ENTER PASSWORD:"); //DISPLAY STRING ON LCD
while(1)
{
cmd_lcd(0xc0); //2ND LINE DISPLAY
password(); //PASSWORD FUNCTION CALLING
55
if(pwdchange)
{
pwdchange=0;
continue;
}
if(!strcmp(str1,pwd)) //COMPARING WITH 1ST PASS-
WORD
{
BUZZER=0;
cmd_lcd(0xc0);
str_lcd("DOOR OPEN");
M1=0;
M2=1;
Delay_ms(30); //30 MILLISECONDS DE-
LAY
cmd_lcd(0xc0);
str_lcd(" ");
M1=0;
M2=0;
Delay_ms(1500);
cmd_lcd(0xc0);
str_lcd("DOOR CLOSE");
M1=1;
M2=0;
Delay_ms(30);
cmd_lcd(0xc0);
str_lcd(" ");
56
M1=0; M2=0;
k=0;
}
else
{
strcpy(temp,pwd);
cmd_lcd(0x01);
str_lcd("Confirm Password");
cmd_lcd(0xc0);
password();
if(!strcmp(temp,pwd))
{
strcpy(str1,temp);
cmd_lcd(0x01);
str_lcd("Password‘Changed");
}
Delay_ms(1000);
cmd_lcd(0x01);
str_lcd("Enter Pass word");
cmd_lcd(0xc0);
pwdchange=1;
return;
}
else
{
cmd_lcd(0x01);
str_lcd("Password Error");
Delay_ms(1000);
cmd_lcd(0x01);
57
str_lcd("Enter Password");
cmd_lcd(0xc0);
pwdchange=1;
return;
}
}
Else
{
cmd_lcd(0x01);
str_lcd("Password Error");
Delay_ms(1000);
cmd_lcd(0x01);
str_lcd("Enter Password");
cmd_lcd(0xc0);
pwdchange=1;
return;
}
}
else goto label;
}
else goto label;
}
else
{
label:pwd[i++]=j;
data_lcd('*');
}
}
pwd[i]='\0';
}
58
CHAPTER 6BIBLIOGRAPHY
59
BIBLIOGRAPHY
Reference Books
1. The 8051microcontroller and embedded systems:MUHAMMAD ALI MAZIDI, JANICE GILLISPIE MAZIDI