Professional Documents
Culture Documents
SCHOOL OF ENGINEERING
GROUP MEMBERS:
NAME ID NUMBER
1) TolossaAssefa 02023391
2) TesfuFeleke 02023318
3) TesferiEshetu 02023255
4) MengistuBediye 02022683
5) MekoninTsega 02022641
Approval sheet:
ii
DIGITAL DOOR LOCK SYSTEM
Declaration
We hereby declare that the project entitled “Digital Door lock system” submitted in partial
fulfillment of the requirement of the BSc degree in Electrical and Computer Engineering
(ECENG) in Adama Science and Technology University, is record of our own work carried out
by us during the academic year2013/14 under the supervision and guidance of
MrKenaLikasa, Department of Electrical and Computer Engineering, School of Engineering.
The extent and source of information are derived from the existing literature and have been
indicated through the project at the appropriate places. The matter embodied in this work is
original and has not been submitted for the award of any other degree, either in this or any other
University.
TolossaAssefa: ___________________
TesfuFeleke : ___________________
TeferiEshetu : ___________________
MengistuBediye: ___________________
MekonninTsega: ___________________
Confirmed by:
Signature: ____________________
Project Advisor:
Mr.KenaLikassa
Signature: ____________________
iii
DIGITAL DOOR LOCK SYSTEM
ACKNOWLEDGEMENT
First of all we would like to express our heart full gratitude for our GOD to help us during our
work throughout all things.
Next to this we would thanks our heart full gratitude to our advisor Mr. Kena Likasa for his an
reserved guidance, suggestion and advice. We great full to his motivation for the timely
completion of our project, especially in programming part.
Beside this we would like to thanks E/G poullinger v.ogoc to help us on hard ware part of our
project and also we like to thanks our friends who support and help us in different aspects.
Finally we would like to express our gratitude to our family for their whole heart full support
during our study in university, without their encouragement and supports, both financial and
mental, we would not have gone this far. Thanks for their tolerance and understanding shown
during our project.
iv
DIGITAL DOOR LOCK SYSTEM
1. INTRODUCTION ................................................................................................................... 1
v
DIGITAL DOOR LOCK SYSTEM
vi
DIGITAL DOOR LOCK SYSTEM
vii
DIGITAL DOOR LOCK SYSTEM
LIST OF FIGURES
FIGURE TITLE PAGE
2.1 Block diagram of power supply system…………………………………...7
2.2 Transformer Circuit………………………………………….....................8
2.3 Full wave (Bridge) Rectifier and Wave forms using four Diodes……..10
2.4 Regulator…………………………………………………………………13
2.5 pin description of PIC16F877A………………………………………….18
2.6 Clock Generator Circuit…………………………………………………20
2.7 Transistors………………………………………………………………..21
2.8 Showing the 4x3 Matrix Keypad………………………………………...25
2.9 LCD……………………………………………………………………..25
2.10 Unipolar stepper motor………………………………………………….27
2.11 ULN2003A………………………………………………………………30
3.1 block diagram of the microcontroller based digital door lock system…...32
viii
DIGITAL DOOR LOCK SYSTEM
LIST OF TABLES
Table TITLE PAGE
4.2 Lcd_Init………………………………………………………………………….43
4.3 Lcd_Out…………………………………………………………………………43
ix
DIGITAL DOOR LOCK SYSTEM
LIST OF SYMBOLS
A Ampere
EN Enable
GND Ground
WR Read Write
RS Register Select
OSC Oscillator
VB Visual Basic
x
DIGITAL DOOR LOCK SYSTEM
ABSTRACT
The increasing rate of crime, attacks by thieves, intruders and vandals, despite all forms of
security gadgets and locks still need the attention of researchers to find a permanent solution to
the well being of lives and properties of individuals .so, Security is a prime concern in our day-
today life. Everyone wants to be as much secure as possible. . To this end, we design a effective
security system for doors open and close. to prevent unauthorized person from having access to
ones properties through the use of codes, we therefore experiment the application of electronic
devices as locks.
An access control for doors forms a vital link in a security chain. The microcontroller based
Door locker is an access control system that allows only authorized persons to access a restricted
area. The major components that we used include a keypad, LCD, EEPROM and the micro
controller PIC16F877A which belongs to the 16F877A series of micro controllers. The system is
fully controlled by the 8 bit microcontroller PIC16F877A which has a 2Kbytes of ROM for the
program memory. The password is stored in the EPROM so that we can change it at any time.
The system has a Keypad by which the password can be entered through it. The electronic
control assembly allows the system to unlock the device with a password. A four digit predefined
password needs to be specified the user. The system has a Keypad by which the password can be
entered through it. A 4x3 matrix KEYPAD and a 16x2 LCD have been used here to set the
password which is stored in the EPROM so that we can change it at any time. While unlocking,
if the entered password from keypad matches with the stored password, then the lock opens and
a message is displayed on LCD. The keypad is scanned for pressed digits one by one. Every
time, row and column of the key pressed is detected and the digit is displayed on LCD. As the
program starts, string ‘Enter Password’ is displayed on LCD. If all the four digits match with set
password, LCD displays ‘password is correct’ and the lock output pin goes high and the led
glows. After the led give light the door is opened and after some delay time another led glows
and the door is closed.
xi
DIGITAL DOOR LOCK SYSTEM
CHAPTER ONE
1. INTRODUCTION
qADue to the need to increase the security of life and properties in our environment,
security systems are used as selective systems to decide who has access to a given location
based on a personal distinctive trait of the user. It also serves the function of sensing or
detecting false intrusion .The term false intrusion here is used to mean any form of attempt
to gain entry without following the proper pre-designed protocol(s). From time past until
present, security locks usually includes mechanical devices made of forged metal i.e.
simple lock and bolt, the door chain, pin tumbler lock, the jam lock and padlock etc. Other
recently developed security devices are gadgets like laser beam detectors, motion detectors
and magnetic card readers. Most recent of these devices are offshoots of biometric
engineering. They include voice recognition systems, finger print readers, etc. The major
characteristic of security devices is to prevent an intruder from gaining access to a location.
Most of these devices however have lapses which give an unauthorized person access to
where they are barred i.e. the simple jam lock and pad lock can be forced open or the keys
duplicated by unauthorized persons and under certain conditions, i.e. physical changes of
the individual concerned, the biometric devices sometimes fail in recognizing the authentic
individual concerned. Hence they cannot be totally relied on. Furthermore, these devices
are very expensive; its use is restricted to only a few individuals or organizations that can
afford it.
Devices such as motion detectors, light detectors among others are susceptible to be
triggered by false signals such as noise impulses, whenever its sensitivity is increased.
They are not suitable for most outdoor security protection due to the fact that they don’t
1
DIGITAL DOOR LOCK SYSTEM
possess high discriminative capability during operation and they are fairly expensive. It is
hence imperative to provide a locking device, one which is also efficient and reliable; with
high discriminative capability, non-reliance on the physical quality of the individual
concerned, which when forced open triggers an alarm and which is by far less expensive
than their counterparts. This has led to the design and construction of a microcontroller
based electronic lock system. It includes using correct personal identification numbers to
operate the locking device, by conditioning the access based on the configuration of the
security device thereby granting access to the user with correct pin number.
The microcontroller based electronic lock finds application in homes, banks in the field of
military applications i.e. ammunition ware house, industries, ministries and government
parastatals etc. due to the above problem we select code lock system with microcontroller.
The design and construction of a programmable electronic digital code lock system
provides a sure way of ensuring this security and safety for data. Programmable digital
code lock system is a high security code lock system. This system is a combination of
hardware and software at its best. In this design, a device is locked using a four digit code
(password). The code can be set according to the user’s desire.
2. To design and enable each individual to have secured home using door security code
system.
2
DIGITAL DOOR LOCK SYSTEM
iii. To familiarize with the skills and techniques in combining software and hardware for a
system.
The issue of Security is a problem of both developed and developing countries ;it is a
serious challenge on the area of unsecured place or unprotected area like home,
government organization, public service and etc.; however this security system somewhat
decrease this problem. There are great varieties of electronic code locks. Generally
speaking, they can be classified into scores of types, such as digital lock, finger print lock,
card lock, biological lock etc. among them the most practical and the most popularized one
can come to electronic code lock. These kinds of lock can avoid the problems caused by
the copying of keys. On the premise that its safety is high, it’s another feature without key
is getting more and more favor of people. It is because the keys people carry have become
burden most of the time, but by construct people need only to remember asset of codes for
electronic locks, and don’t have to carry any key, thus freeing themselves from worries.
We all are aware of the fact that there has been a sharp increase in criminal offences like
theft, robberies, assaults, murders etc. in the recent past that is affecting our society on a
large scale. So the requirement for a well-equipped home security system is definitely on
the rise. We want to utilize the electronic technology to build an integrated and fully
customized home security system at a reasonable cost. We hope this project will be useful
in keeping thieves, dacoits and other sort of dangers at bay.
Nowadays, human always rely on electronic devices to make their lives more convenience.
The purpose of this project is to replace door key into a reliable door security system using
microcontroller. This will be the best solution for those who always forget to bring their
house or office room key before left.
3
DIGITAL DOOR LOCK SYSTEM
(In Circuit Serial Programming)for loading program, and push button as input for PIC
microcontroller. Second, this project will also focus on LCD screen display which is used
to display words and password symbols. Finally, relay driver and motor will function as
output for this system which can be applied to any daily application such as door lock.
To identify thesuitable type of PIC microcontroller for the project, to develop interfacing
link between hardware circuit and software programming.
Another advantage of a keyless door lock is the fact that you can provide entry into your
home to others at your discretion. You will not need to make copies of a key or leave keys
for someone else to get in to your home. Rather, you'll simply need to tell those people the
proper code to put into the keyless entry system in order to gain access. With the system in
place, you can also tell exactly when and how people attempted to access your home. This
gives you a good idea of how secure your house is.
4
DIGITAL DOOR LOCK SYSTEM
Just as you can forget your keys and be locked out of your home, you can also forget the
pass code to access your keyless entry system and be locked out as well. This can pose a
problem if you have a difficult time remembering things; it's safest to use a completely
random code and to avoid things like birth dates.
One final disadvantage of keyless door locks is that those systems which are powered by
electricity may not function properly in the case of a power failure. This can leave your
door completely locked throughout the failure, or it may result in the door not locking
properly and remaining open during the failure as well.in ordering to solve the proplem of
power supply failure it possiple to use Generator.
5
DIGITAL DOOR LOCK SYSTEM
CHAPTER TWO
2. LITERATURE REVIEW
When we think of locks, we think of a bolt containing a notch known as a talon(the
shoulder of a bolt against which the key presses to slide it in a lock.), which is operated by
moving the bolt backwards or forward by engaging a key in the talon. But there is more to
locks than just a bolt or latch. A lock is a mechanical device that can be used for securing
doors, cabinets, lid of brief cases or other luggage. It consists essentially of a bolt guarded
by a mechanism which can be released by a mechanical, hydraulic or electrical /electronic
actuator. The oldest known mechanical functioning lock was an Egyptian door lock used
about 2000BC, made of wood and fastened vertically on the door post, the wooden block
contained moveable pins or “pin tumblers” that dropped by gravity into openings in the
cross piece of “bolts” and locked the door. It was operated by a wooden key with pegs that
raised the number of tumblers sufficiently to clear the bolt so that it could be pulled back.
The major disadvantage with it is that it was wholly made of wood.
The Romans made an improvement on this by fabricating the first metal locks which was
later improved by Robert Bar son, an English man in 1778 and Linus Yale Jnran American
in 1861. The Yale lock consists of essentially a cylindrical plug placed in an outer barrel.
The plug is rotated and in turn moves the bolt of the lock by means of a cam. The inserted
key raises five pins of different sizes into corresponding holes in the plug. The most
common form of cylindrical lock used in homes is the so-called night latch, operated from
a key from outside and a knob from inside. In the 20th century, as machine tools and
manufacturing methods became more sophisticated, locks were produced, which are either
key operated (opened) or keyless.
In the late 20th century, electro mechanical locks were developed to trip electrical circuit
as seen in automobile ignitions. Other keyless locks include remote controlled lock,
“security card” operated and electronic code lock.
This project is about the electronic digital code lock, which is designed by microcontroller
in order open and closes the door. It is operated by putting the correct code by keypad into
6
DIGITAL DOOR LOCK SYSTEM
a microcontroller which already have a pin number in its EEPROM memory to compare
with, so that if it is correct .It activates the port to which the LED is connected the load.
U2
LM7812CT
D1
V1 LINE VREG
VOLTAGE
T1 S2 COMMON
220 Vrms S1 C2
C1
50 Hz
S3 100uF U3
0°
10:1 100uF
LINE VREG
VOLTAGE
COMMON
LM7805CT
7
DIGITAL DOOR LOCK SYSTEM
As already discussed the supply which we get is 220V A.C. supply. In order to decrease
the magnitude of the voltage we make use of step down transformer. This transformer has
more windings in the primary coil than in the secondary coil. So the voltage output at the
secondary is an A.C. supply with magnitude less than 220V as shown below in the figure.
Then in our design we should have to get 12v ac which step down by the transformer. So
to gate this the ratio should become
= 18.33
V1
U1 12V
240 Vrms
50 Hz 24V
0°
2 12V
VpIp = VsIs
8
DIGITAL DOOR LOCK SYSTEM
Diodes have two active electrodes between which the signal of interest may flow, and most
are used for unidirectional electric current property. The unidirectional most diodes exhibit
is sometime called the rectifying property. The most common function of a diode is to
allow an electric current in one direction (called the forward biased condition) and to block
the current in the opposite direction (the reverse biased condition).
As all the electronic circuits work on DC therefore this low voltage A.C. cannot be directly
fed to our circuit. Thus a process of rectification is required. In this process, A.C. voltage is
converted into DC voltage using bridge rectifying diodes (using four diodes).
Now the diodes are connected in the opposite manner; such that diode D1 and DiodeD2 are
in opposite direction with D3andD4. Therefore two of the diodes get forward biased during
the positive half of the AC input and other gets forward biased during the negative half of
the AC input. Thus during the positive half cycle rectification takes place through diode
D1 and D2(diode D3 and D4 being reverse biased, cannot rectify) and during the negative
half cycle, the rectification takes place through the diode D3 and D4(diodes D1 and D2
being reverse biased, cannot rectify). But as at least two of the diodes always remain in the
conducting mode therefore both the halves of the AC input gets rectified and hence the
name full wave rectifier
This circuit converts the transformer AC output to DC power supply. This design uses four
diodes; this arrangement is known as bridge rectification, as shown in the diagram below;
9
DIGITAL DOOR LOCK SYSTEM
When point A is positive with respect to point B (positive half cycle), current flows
through the forward biased diodes D1 and D3 while D1 and D2 are reverse biased, giving
the output wave form in (b). Conversely, when point B is positive with respect to point A
(positive half cycle), current flows through the forward biased D1 and D2 giving an output
wave form in (c).
The result of the two wave form is an output voltage whose ripple frequency is twice the
supply frequency.
Vrms = 12V
Vpeak = Vrms√ 2
= 12 √2 = 16.9V
Vdc≈ 15V
10
DIGITAL DOOR LOCK SYSTEM
=2
=½ × 1/50
=1/100
= 10ms
Hence,
C ==500×10-3×10×10-3 ⁄ 50=100µF
11
DIGITAL DOOR LOCK SYSTEM
12
DIGITAL DOOR LOCK SYSTEM
2.1.2. Microcontrollers
A microcontroller often abbreviated MCU is a single computer chip integrated circuit that
executes a user program normally for the purpose of controlling some device hence the
name microcontroller. Microcontroller includes several thousands of transistors stored into
one chip, with addition of external peripherals such as memory input-output lines, timers
built into it. Microcontrollers can be found in any products these days. For example
modern washing machine in our house that consists of timer, button and LED contains a
microcontroller. All modern cars contain microcontroller.
13
DIGITAL DOOR LOCK SYSTEM
Those are:
3) Reset circuit
4) Crystal circuit
PORT0 is open collector that’s why we are using pull-up resistor which makes PORT0 as
an I/O port. Reset circuit is used to reset the microcontroller. Crystal circuit is used for the
microcontroller for timing pluses. In this project we are not using external memory that’s
why EA/VPP pin in the microcontroller is connected to Vcc that indicates internal memory
is used for this application.
There are two input- output ports, port A and port B, and each pin of each port can be set
individually as an input or an output. The bits of each port are numbered, starting at 0. In
output mode, bit 4 of port A has an open collector (or rather open drain); the rest of the
outputs are regular CMOS. The CPU treats each port as one 8-bit byte of data even though
only five bits of port A are actually brought out as pins of the IC. PIC inputs are CMOS-
compatible; PIC outputs can drive TTL or CMOS logic chips: Each output pin can source
or sink 20mA as long as only one pin is doing so at a time.
Processor that executes programs. Processor execute program digitally. All instruction
given to the processor should be in digital form.
Program Memory to store the program that has been compiled success fully by the
programmer.
14
DIGITAL DOOR LOCK SYSTEM
( i ) PIC 16F870
( ii ) PIC 16F871
( iv ) PIC 16F873A
( v ) PIC 16F874A
( vi ) PIC 16F876A
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single
word instructions) CMOS FLASH-based 8-bit microcontroller PIC16F877A packs
Microchip's powerful PIC architecture into an 40- or 44-pin package and is upwards
compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices.
The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an
ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2
capture/compare/PWM functions, the synchronous serial port can be configured as either
3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus
and a Universal Asynchronous Receiver Transmitter (USART). All of these features make
the PIC16F877A ideal for more advanced level A/D applications in automotive, industrial,
appliances and consumer applications.
15
DIGITAL DOOR LOCK SYSTEM
Features:
2 PWM 10-bit
ICD
.Self-Programming
16
DIGITAL DOOR LOCK SYSTEM
Comparators 2
Operating Voltage Range (V) 2 to 5.5
Some may suit a particular application while others may be totally unsuitable for the same
application. The hardware features of microcontrollers in general are described in this
section.
2.1.2.3. EEPROM:
EEPROM is Electrically Erasable Programmable Read Only Memory, which is a non-
volatile memory.
These memories can be erased and also be programmed under program control. EEPROMs
are used to save configuration information, maximum and minimum values, identification
data, etc.
It is a memory used for storing important data that must not be lost if power supply
suddenly fails. The PIC16F877A is made up of up to 256 x 8 bytes of EEPROM data
memory. For instance the EEPROM stores the personal identification number which is
compared with the user input so as to activate the port to which the door relay is
connected.
2.1.2.4. RAM:
RAM means Random Access Memory. It is a general-purpose memory which usually
stores the user data used in a program. RAM is volatile, i.e. data is lost after the removal of
power. Most microcontrollers have some amount of internal RAM. 256 bytes is a common
amount, although some microcontrollers have more, some less. In general it is possible to
extend the memory by adding external memory chips.
It contains data used by a program during its execution. The PIC16F877A consists of up to
368 x 8 bytes of data memory (RAM).
17
DIGITAL DOOR LOCK SYSTEM
18
DIGITAL DOOR LOCK SYSTEM
Port A (6-pin); its pin RA4 functions as a timer; others have no additional function.
Port B( 8- pin); its pin RB0 functions as an input interrupt, RB0 functions as “clock” line
in program mode. RB7, ‘Data’ line in program mode.
Port C (8-pin): its pins are used for transmitting and receiving data from peripheral
components.
Port D (8-pin): all pins are used for parallel slave port with external peripherals.
OSC 1 & OSC2: assigned for oscillator connection, for clocking and clock out
respectively.
The clock is microcontroller’s main starter, and is obtained from an external component
called an “oscillator” the clock is divided into four; Q1, Q2, Q3 and Q4. The four together
makes up an instruction cycle during which one instruction is executed.
19
DIGITAL DOOR LOCK SYSTEM
2.1.4. Resistor:
Resistor is a component that resists the flow of direct or alternating electric circuit.
Resistors can limit or divide the current, reduce the voltage, protect an electric circuit, or
provide large amounts of heat or light. An electric current is the movement of charged
particles called electrons from one region to another. Resistors are usually placed in
electric circuits. Physicists explain the flow of current through a material, such as a
resistor, by comparing it to water flowing through a pipe. Resistors are designed to have a
specific value of resistance. Resistors used in electric circuits are cylindrical. They are
often colour coded by three or four colour bands that indicate the specific value of
resistance. Resistors obey ohm’s law, which states that the current density is directly
proportional to the electric field when the temperature is constant.
2.1.5. Potentiometer:
It is one type resister that used for LCD brightens to show every things that display on
LCD screen.
2.1.6. Capacitors:
Capacitor or electric condenser is a device for storing an electric charge. The simplest form
of capacitor consists of two metal plates separated by a non-touching layer called the
dielectric. When one plate is charged with electricity from a direct current or electrostatic
source, the other plate have induced in it a charge of the opposite sign; that is, positive if
the original charge is negative and negative if the original charge is positive. The electrical
size of the capacitor is its capacitance. Capacitors are limited in the amount of electric
20
DIGITAL DOOR LOCK SYSTEM
charge they can absorb; they can conduct direct current for only instances but function well
as conductors in alternating current circuits. Fixed capacity and variable capacity
capacitors are used in conjunction with coils as resonant circuits in radios and other
electronic equipment. Capacitors are produced in a wide variety of forms. Air, Mica,
Ceramics, Paper, Oil, and Vacuums are used as dielectrics depending on the purpose for
which the device is intended.
2.1.7. Transistors:
Transistor is a device which transforms current flow from low resistance path to high
resistance path. It is capable of performing many functions of the vacuum tube in
electronic circuits, the transistor is the solid state device consisting of a tiny piece of semi
conducting material, usually germanium or silicon, to which three or more electrical
connections are made.
21
DIGITAL DOOR LOCK SYSTEM
The BC547 transistor is an NPN bipolar transistor, in which the letters "N" and "P" refer to
the majority charge carriers inside the different regions of the transistor. Most bipolar
transistors used today are NPN, because electron mobility is higher than whole mobility in
semiconductors, allowing greater currents and faster operation. NPN transistors consist of
a layer of P-doped semiconductor (the "base") between two N-doped layers. A small
current entering the base in common-emitter mode is amplified in the collector output. In
other terms, an NPN transistor is "on" when its base is pulled high relative to the emitter.
The arrow in the NPN transistor symbol is on the emitter leg and points in the direction of
the conventional current flow when the device is in forward active mode. One mnemonic
device for identifying the symbol for the NPN transistor is "not pointing in." An NPN
transistor can be considered as two diodes with a shared anode region. In typical operation,
the emitter base junction is forward biased and the base collector junction is reverse biased.
In an NPN transistor, for example, when a positive voltage is applied to the base emitter
junction, the equilibrium between thermally generated carriers and the repelling electric
field of the depletion region becomes unbalanced, allowing thermally excited electrons to
inject into the base region. These electrons wander (or "diffuse") through the base from the
region of high concentration near the emitter towards the region of low concentration near
the collector. The electrons in the base are called minority carriers because the base is
doped p-type which would make holes the majority carrier in the base.
22
DIGITAL DOOR LOCK SYSTEM
Keypads are an excellent way of entering data into microcontroller. The keys is usually
numbered but they can also be labeled as function keys, for example in the remote control
handset of a TV to adjust the sound or color, etc. Like remote controls, keypads find
applications in burglar alarms, door entry systems, calculators and microwave ovens.
Keypads are usually arranged in a matrix format to reduce the number of input/output
connections. A 12 key-keypad is arranged in a 4 x 3 format requiring seven connections
while a 16 key-keypad is arranged in a 4 x 4 format requiring eight connections. In this
project we use 4x3 keypad. It perform two separate functions, they can serve as numeric
keys and function keys. The numeric keys are design to input numeric values into the
system, they include “0 – 9”. While the function keys “A – D” and “#”, “*” are used to
process the inputs. In the design of the keypad, there is a need for mandatory processing
unit to decipher an authentic key pressed from an unwanted noise pulse. This is known as
key de bouncing, to prevent against multiple single inputs a de bounced delay of 150ms
was chosen as a start value in the program written, this provided an advantage of reduced
hardware and flexible de bouncing period.
1
A 1 2 3
B 4 5 6
C 7 8 9
D 0 #
The output of the button pressed on the keypad is displayed on LCD screen. This help to
makes correction if a mistake is made during the typing of the codes. When the input pin is
correct it causes the microcontroller to generate the control signal to drive the lock
mechanism else the message wrong password is displayed on the LCD screen.
24
DIGITAL DOOR LOCK SYSTEM
LCD1
LM016L VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Fig 2.9 LCD
2.1.10.1.1. EN (Enable):
The EN line is called "Enable". This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should first set this line high (1)
and then set the other two control lines and/or put data on the data bus. When the other
lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to
take the data currently found on the other control lines and on the data bus and to treat it as
a command.
2.1.10.1.2. RW (Read/Write):
The RW line is the "Read/Write" control line. When RW is low (0), the information on the
data bus is being written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read
command. All others are write commands, so RW will almost be low.
25
DIGITAL DOOR LOCK SYSTEM
The LCD may be connected to the PIC microcontroller using either a 4-bit bus or an 8-bit
bus. If an 8-bit bus is used, all 8 bits must be on one port. If a 4-bit bus is used, it must be
connected to either the bottom 4 or top 4 bits of one port. Enable and Register Select may
be connected to any port pin. R/W should be tied to ground as the LCD OUT command is
write only. PICBasic assumes the LCD is connected to specific pins unless told otherwise.
In this project, the LCD is used with a 4-bit bus with data lines DB4- DB7 connected to
PIC microcontroller PORTB.4 - PORTB.7, Register Select to PORTB.4 and Enable to
PORTB.5. It is also preset to initialize the LCD to a 2 line display. Data lines D0-D3, VSS
and RW are connected to ground.VEE and VDD are connected to potentiometer.
26
DIGITAL DOOR LOCK SYSTEM
torque at low speeds and a simple, rugged construction that operates in almost any
environment.
The shaft or spindle of a stepper motor rotates in discrete step increments when electrical
command pulses are applied to it in the proper sequence.
The motors rotation has several direct relationships to these applied input pulses. The
sequence of the applied pulses is directly related to the direction of motor shafts rotation.
The speed of the motor shafts rotation is directly related to the frequency of the input
pulses and the length of rotation is directly related to the number of input pulses applied.
One of the most significant advantages of a stepper motor is its ability to be accurately
controlled in an open loop system. Open loop control means no feedback information
about position is needed. This type of control eliminates the need for expensive sensing
and feedback devices such as optical encoders. Your position is known simply by keeping
track of the input step pulses.
27
DIGITAL DOOR LOCK SYSTEM
Features
The motor has full torque at stand still(if the windings are energized)
Precise positioning and repeatability of movement since good stepper motors have an
accuracy of – 5% of a step and this error is non cumulative from one step to the next.
Very reliable since there are no contact brushes in the motor. Therefore the life of the
motor is simply dependant on the life of the bearing.
The motors response to digital input pulses provides open-loop control, making the motor
simpler and less costly to control.
It is possible to achieve very low speed synchronous rotation with a load that is directly
coupled to the shaft.
A wide range of rotational speeds can be realized as the speed is proportional to the
frequency of the input pulses
Model : 28BYJ-48
Number of Phase : 3
Frequency : 100Hz
28
DIGITAL DOOR LOCK SYSTEM
Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED and
gas discharge), line drivers, and logic buffers. From listed application we used it as relay
driver . The ULN2003A has a 2.7kΩ _series base resistor for each Darlington pair for
operation directly with TTL or 5-V CMOS devices.
Features
Relay-Driver Applications
29
DIGITAL DOOR LOCK SYSTEM
U2
9
COM
1 16
1B 1C
2 15
2B 2C
3 14
3B 3C
4 13
4B 4C
5 12
5B 5C
6 11
6B 6C
7 10
7B 7C
ULN2003A
30
DIGITAL DOOR LOCK SYSTEM
CHAPTER THREE
3. PROJECT METHODOLOGY
In the first stage of conducting the project, we are going to search for reading materials.
Since we are going to use digital devices, we are expecting to refer points on the working
principles, logical characteristics and general operation principle of these components. In
addition, we use any related materials and/or their electronic equivalents that can provide
us any help throughout the design process.Then we will start the design process by starting
to calculate values of resistors, capacitors ,center tap transformer ,diode and motor needed
for the proper operation of the components and adjustment of the working principles.
Moreover, we determine the appropriate power supply for the components. Then we will
check our preceding work and the connections before our next step. And we’ll draw the
right circuit making it ready for simulation. Then the next step is simulation of the design
with the aid one of many simulation software’s such as protest, and so on. Then we will
prepare for the final process by buying the required materials. After buying the necessary
equipment’s, we will implement the project in physically realizable form.
Proteus ISIS 8 Professional is used to design the circuit and simulate it. After completing
the circuit assembly and configuration, it’s time to verify whether the source code
compiled is virtually accurate or not.. When the simulation After all done without error, the
circuit will be packaged and the users may ready to use. Successfully runs, this means that
the circuit can be constructed and soldered on PCB board. Then, the circuit will be tested
and troubleshooting may necessary taken to overcome those circuitry problems.
The approach is by experimental modular design where each is analyzed extensively and
tested for functionality so as to prove satisfactory before joining the blocks to form the
overall circuit.
31
DIGITAL DOOR LOCK SYSTEM
Finally, the last part of our project is testing and inspecting of our work, i.e. we will put the
device in the place where it is intended to be and see if it works as proper as it was
intended to work.
LCD LED
Motor
Fig3.1 block diagram of the microcontroller based digital door lock system.
The construction of this project employs majorly the PIC16F877A microcontroller for
several reasons.
Firstly, it is operated on a +5V DC supply and draws very little current. Furthermore, it has
a very low power dissipation and high speed of operation and still maintains its data in
case of power loss. Finally it has a large storage memory.
32
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
+88.8
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A
1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B 4 5 6
9
COM
ULN2003A
C 7 8 9
D 0 #
The crystal oscillator used is 20MHz speed. The system is peculiar because of the use of
the microcontroller and the LCD. The LCD has 8 pins and uses a serial protocol which is
compatible with the microcontroller PIC16F877A with 4 pins use for communication. The
33
DIGITAL DOOR LOCK SYSTEM
motor supplied by 12V while the microcontroller is supplied with 5V.After all program of
our project load on microcontroller, the microcontroller communicate with LCD to display
WELL COME TO ASTU and DIGITAL DOOR LOCK BY ECENG STUDENTS. Then
immediately microcontroller gives command press * through LCD.
The keypad accepts digits from the user, based on the code written inside the
PIC16F877A microcontroller. The digits are simultaneously displayed on LCD screen.
The microcontroller compares the digits with the right pin number in its EEPROM
memory. If the password entered to 4x3 keypad is correct then, the “correct” is displayed
on the LCD screen, the LED1 gives yellow light and the motor rotates in the clockwise
direction which shows that the door is opened. After delay time (2000ms) LED2 gives red
light. Finally, the motor rotates anticlockwise direction and the word “door closed” is
displayed on the LCD.
The Authentic user can change the pin to another one, which is stored in the memory by
first inputting the right code. To change the old (current) password we use the master
password to keep the system security.
34
DIGITAL DOOR LOCK SYSTEM
CHAPTER FOUR
4.1.1.1. Micro C:
Micro C is powerful, feature rich development tool for PIC micros. It designed to provide
the programmer with the easiest possible for developing applications for embedded
systems, without compromising performance or control.
35
DIGITAL DOOR LOCK SYSTEM
The complex and intricate operating routine of the software is achieved by writing the
program in modules starting with the program algorithm.The software was written in
Mikrobasic language, and was written in sections for easy debugging and troubleshooting.
Each section is tailored to meet the duty that will be imposed on the corresponding
hardware unit.
36
DIGITAL DOOR LOCK SYSTEM
The software was designed in order to support the effectiveness of the hardware device.
The complex and intricate operating routine of the software is achieved by writing the
program in modules starting with the program algorithm. The software was written in
Mikro C language, and was written in sections for easy debugging and
troubleshooting. Each section is tailored to meet the duty that will be imposed on the
corresponding hardware unit.
37
DIGITAL DOOR LOCK SYSTEM
wrong
Password attempt
Check wrong
password
Wrong
password
38
DIGITAL DOOR LOCK SYSTEM
The program for the keypads was tested and buttons were discovered not working properly
due to bounce, to overcome this problem key de bounce with delay varied was done until
the bouncing disappeared. The power supply, keypads and display unit were further tested
by-employing them in the circuitry of the electronic door lock, the input into the
microcontroller was done using the keypads and it worked properly without no error of
bouncing. Also the display unit displays the output of the keypad. It was however observed
that the display (LCD) had some of its lines cut off; this is due to manufacturers fault,
because another LCD display was tested with the circuit and no such fault discovered. The
whole project was later tested by inputting the correct and wrong PINs. The
microcontroller activated the port to which the LED (which represents the load) was
connected when the correct PIN was entered. And when the wrong pin was entered the
microcontroller activated the port to which the wrong password is displayed.
All the process involves were displayed on the LCD accordingly. Hence the whole circuit
was confirmed to be working properly.
39
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
C3 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
RV1 +5v RA3/AN3/VREF+ RB6/PGC
100k 6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
+88.8
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B 4 5 6
9
COM
ULN2003A
C 7 8 9
D 0 #
40
DIGITAL DOOR LOCK SYSTEM
41
DIGITAL DOOR LOCK SYSTEM
pin. at TRISB3_bit;
extern sfr sbit Data 6 sbit
LCD_D6_Direction; direction LCD_D6_Direction
pin. at TRISB2_bit;
extern sfr sbit Data 5 sbit
LCD_D5_Direction; direction LCD_D5_Direction
pin. at TRISB1_bit;
extern sfr sbit Data 4 sbit
LCD_D4_Direction; direction LCD_D4_Direction
pin. at TRISB0_bit;
42
DIGITAL DOOR LOCK SYSTEM
Table4.2 Lcd_Init
// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
43
DIGITAL DOOR LOCK SYSTEM
Lcd_Init();
44
DIGITAL DOOR LOCK SYSTEM
45
DIGITAL DOOR LOCK SYSTEM
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 code and shows to the person to enter the
password
• The code is received by the module and checks the code availability.
Microcontroller.
LED Indicators.
4x3 keypad
Stepper motor
The functional Operation of the control Circuitry of the project is described in the
Subsection.
a. 1 x PIC16F877A
c. 1 x 4x3 keypad
d. 1 x 2X16 LCD
e. 1x 2N2222 transistor
46
DIGITAL DOOR LOCK SYSTEM
47
DIGITAL DOOR LOCK SYSTEM
CHAPTER FIVE
5.1. Reasult
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
1
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
0.00
1
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig 5.1 result show WELL TO ASTU
48
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
0.00
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig 5.2 show DIGITAL DOOR LOCK BY ECENG STUDENT
49
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
0.00
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig5.3 show press *
50
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
0.00
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig 5.4 show enter
51
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
+40.9
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig 5.5 show correct
52
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
-79.2
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
53
DIGITAL DOOR LOCK SYSTEM
LM016L
+5V
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
+5v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D1
LED-YELLOW
D2
LED-RED
Q1
BC547
C2
U1 Q2
22pf 13 33 BC547
OSC1/CLKIN RB0/INT
CRYSTAL 14 34
OSC2/CLKOUT RB1
35
RB2
100k X12 36
26%
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RV1 C1 RA2/AN2/VREF-/CVREF RB5
22pf 5 39
+5v RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
R1 RC4/SDI/SDA
23
10k 1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
3
RD1/PSP1
21
+12V RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
D 0 #
-79.1
3
10 7
7C 7B
11 6
12
6C
5C
6B
5B
5
A 1 2 3
13 4
4C 4B
14 3
3C 3B
15 2
16
2C
1C
2B
1B
1
B
4 5 6
9
COM
ULN2003A
C 7 8 9
0 #
Fig 5.7 wrong password
54
DIGITAL DOOR LOCK SYSTEM
5.2. Discusion:
After all program of our project load on microcontroller, the microcontroller communicate
with LCD to display the results on the above figure. At the first time WELL COME TO
ASTU and DIGITAL DOOR LOCK BY ECENG STUDENTS. Then immediately
microcontroller gives command press * through LCD.
The keypad accepts digits from the user, based on the code written inside the
PIC16F877A microcontroller. The digits are simultaneously displayed on LCD screen.
The microcontroller compares the digits with the right pin number in its EEPROM
memory. If the password entered to 4x3 keypad is correct then, the “correct” is displayed
on the LCD screen, the LED1 gives yellow light and the motor rotates in the clockwise
direction which shows that the door is opened. After delay time (2000ms) LED2 gives red
light. Finally, the motor rotates anticlockwise direction and the word “door closed” is
displayed on the LCD. which show that Door is closed.
55
DIGITAL DOOR LOCK SYSTEM
CHAPTER SIX
6. CONCLUSION AND RECCOMMENDATION
6.1. Conclusion
In this paper microcontroller based on Digital Door Lock System has been presented in
terms of the software algorism development and hard ware implementation. This senior
project has an attempt to design and implement the digital door lock system using
PIC16F877A microcontroller.
The simulation is performed as we expected. This digital door lock system is easy to use
and highly reliable. The system uses to keep owners property from theft. The digital door
lock system is very important and durable as when we compare with non electronic or
digital door lock system. Finally when we install in the hardware all series and parallel
push buttons (switches) arranged in the keypad form for simplicity for authorized person
and not to know the correct password to unauthorized person.
In summary, the microcontroller based Electronic lock is a security system device that
utilizes pin input as key for users’ access. Therefore, our objectives have been met, hence
the software and hardware implementation is successful undertaking.
56
DIGITAL DOOR LOCK SYSTEM
6.2. RECCOMMENDATION
In meeting the design requirements, there are several technical challenges that must be
overcome. In our project the challenging task was writing the program in MICRO C
language. In this project we face different problems and constraints in which some of them
have been met but there are different challenges that have been an obstacle to accomplish
the software and hardware of our project part.
The first challenge was being new for different software and equipment such as
microcontroller, PROTEUS and MICROC .We have never discuss these software and
equipment in our previous lessons, because of these we are forced to read and understand
every concepts, different programming languages, data sheets and other help tutorials.
The other big challenge was scarcity of materials for implementing our design in our
laboratories. As we tried to state on our proposal this project needs some materials such as
microcontroller, PIC socket, bridgeboard, keypad, LCD, relay driver, push button,
regulator, lead, iron solder, buffer or alarm indicator etc. but it was impossible to find these
equipment in our lab and as well as in the market area. We had tried to solve these
problems by our self but we face some financial problems and we forced our self to find
some substituted design of our hardware project part. It was impossible to find full version
software; this makes us to pass through a lot of cracked fake software that took our time.
Generally we recommend to our department in order to solve the above problem for the
next generation.
57
DIGITAL DOOR LOCK SYSTEM
6.3. References.
[1] Martin Bates “introduction to Microelectronic system”, The PIC16F877A
Microcontroller system security Eng.J., Vol. 3 No1, October 2000.pp4-8.
[3] Stan D’souza, “multiplexing LED drive and a 4X4 Keypad Sampling’’, Microchip
Technology Inc.,Application Note 529, DS000529E, November 1997, pp 27.
[7]A.K Theraja and B.L Theraja, A textbook of Electrical Technology, 23rd Edition, S
Chand andCompany Limited, New Delhi, 2002, pp 2364.
58
DIGITAL DOOR LOCK SYSTEM
6.4. Appendix
int i = 0, j, cnt;
int w1;
//
void code_enter(){
59
DIGITAL DOOR LOCK SYSTEM
do
while (!kp);
switch (kp){
60
DIGITAL DOOR LOCK SYSTEM
code1[i] = kp;
i++;
Delay_ms(20);
Delay_ms(20);
Delay_ms(20);
Delay_ms(20);
Delay_ms(20);
Delay_ms(20);
61
DIGITAL DOOR LOCK SYSTEM
Delay_ms(20);
Delay_ms(20);
Delay_ms(20);
void change_code(){
i = 0;
code_enter();
code_enter();
code_enter();
code_enter()
code_write();
delay_ms(20);
code_read();
delay_ms(20);
Delay_ms(5000);
62
DIGITAL DOOR LOCK SYSTEM
void main(){
ADCON1 != 0x07;
//ANSELH = 0;
//c2on_bit=0;
TRISC = 0x00;
PORTC = 0x00;
code_read();
//Lcd_Out(1, 1, msg1);
//Delay_ms(500);
delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
63
DIGITAL DOOR LOCK SYSTEM
delay_ms(2000);
cnt = 0;
L1: do{
Lcd_Cmd(_LCD_CLEAR);
i = 0;
code_enter();
if(code1[0] == 42){ // *
//delay_ms(500);
i = 0;
code_enter();
code_enter();
code_enter();
code_enter();
code_enter();
if(code1[0] == '1' && code1[1] == '2' && code1[2] == '3' && code1[3] == '4'
&& code1[4] == '5' ){ // master code
code_enter();
if(code1[5] == 35){ // #
64
DIGITAL DOOR LOCK SYSTEM
change_code();
//PORTC.f6=1;
//delay_ms(2000);
EEPROM_Read(0x21);
w1 = 1;
Delay_ms(20);
EEPROM_Write(0X21, w1);
Delay_ms(20);
EEPROM_Read(0x21);
PORTC=0x49;
Delay_ms(500);
PORTC=0x43;
65
DIGITAL DOOR LOCK SYSTEM
Delay_ms(500);
Delay_ms(5000);
PORTC=0x06;
Delay_ms(500);
PORTC=0x2C;
Delay_ms(500);
Delay_ms(5000);
//goto L1;
//PORTC.f5=1;
//delay_ms(2000);
LCD_Cmd(_LCD_CLEAR);
Lcd_out(1,4,"Door Close");
EEPROM_Read(0x21);
w1 = 0;
Delay_ms(20);
EEPROM_Write(0x21, w1);
Delay_ms(20);
EEPROM_Read(0x21);
66
DIGITAL DOOR LOCK SYSTEM
PORTC=0x0C;
Delay_ms(500);
PORTC=0x06;
Delay_ms(500);
PORTC=0x03;
Delay_ms(500);
PORTC=0x09;
Delay_ms(500);
Delay_ms(2000);
//goto L1;
else{
cnt++;
Delay_ms(2000);
//goto L1;
if(cnt>=3)
goto L1;
67
DIGITAL DOOR LOCK SYSTEM
}while(1);
68