You are on page 1of 27

PREFACE

It is mandatory for an individual to prepare a Major

Project with the given guideline and submit Major Project

Report to check the validity, functionality of Project

awareness of the student.

This Mini Project Report SIMPLE ELECTRONIC CODE

LOCK provides a full spectrum to harden space of

Electronics, including new material, analysis and

reconfigurable hardware techniques.

0
CONTENT

PREFACE

INTRODUCTION

TECHNICAL SPECIFICATION

CIRCUIT DIAGRAM

SIMPLE CODE LOCK CKT

DATA SHEET

CONNECTION DIAGRAM

TRUTH TABLE

OPRATING INSTRUTION

COMBINATION LOCK

CIRCUIT DESCRIPTION

CONCLUSIONS

REFERENCES

1
INTRODUCTION

Here is a project called Simple Code Lock using

AT89C2051. LCD is used for display and a keyboard is used to

input the keys. This project source code is written in C.

This a simple project with efficient hacking

prevention from Brute Force etc. The basic user lock is of 5 Digits

and Master Lock is of 10 digits so its not easy for an intruder to

break the lock unless you keep the code simple.

The input is taken from a 43 Keypad (please see the

schematic for more information) and Display the user input on a

216 LCD. A pin is assigned as output for activating and

deactivating the lock. For demonstration an LED is connected to

that pin.

The user has two options either he/she can use its own 5 digit

code or use the default 5 digit code. If user has to do setup his own

2
code, then he has to enter 12345 and press #. After this...

controller will ask for 10 Digit master passwords which are

preprogrammed in the controller. Entering master lock, user can

enter the new 5 digit code for the lock and press # to save it.

Keypad has 12 keys (43) starting from 1,2,3,4,5,6,7,8,9,*,0,#

(please see the schematic for layout). Numeric keys are used for

entering numbers. * is used as the Cancel key and # is used as

the Enter key.

3
RELATED WORK

This section brings to light the historical development of the lock,

the types and functions of locks. A brief review of electronic

combination locks and a discussion of major components that are used

in electronic locks are presented.

Historical Development

The earliest lock in existence is the Egyptian lock, made of wood,

found with its key in the palace ruins in Nineveh, in ancient Assyria

[4-5]. In the 19th century, level locks, cylinder locks and keyless locks

were invented and improved upon [3]. The first successful metal

key changeable combination lock was invented by James Sargent

in 1857 [6]. This lock was the prototype of those being used in

contemporary bank vaults. In 1958, the first electronic combination lock

was invented [3,7]. As subsequent developments were along the lines,

the locks were improved upon by the improvement of materials

4
and increasing complexity of the working mechanisms including

the increasing use of automatic electronic alarm and safety devices

[2,8].

Types and Functions of Locks

There are many types of lock that are in existence in our

world today of which the main types are: (1) Mechanical

Key locks, (2) Magnetic locks, and (3) Electronic locks.

1. Mechanical Key Locks: these are locks that consist of

a bolt that may be slid to and fro, or rotated by a key

(e.g. Padlock). In these types of locks, there are

obstacles called wards or tumblers that permit only

the right key to be turned on. This is mostly

applicable in doors, gates and windows of houses,

stores etc.

2. Magnetic Lock: These are locks that are operated

based on the theory of magnetism. These types of

locks consist of bolts connected with magnets to

5
ensure that they are locked. The key (which is usually

a ferrous metal foil) when inserted pulls the bolts

thereby releasing the lock to ensure it is opened (e.g.

Solenoid). It is mainly used in residential as well as

administrative areas (e.g. Offices).

3. Electronic locks: these are the most sophisticated of

all the locks . This is because unlike the two other

types that require a sort of key to open them, this

doesnt require a key so that the issue of keys

getting missing does not come into play. These types

of locks are driven basically by electronic means and

they are used mostly in industrial areas and areas

where a high level of security is needed. Some of the

electronic locks are:

i. DNA Sensor Locks: these are electronic locks

that compute into their memories, the genetic

make-up of the individual such that only

6
individuals that have their DNA computed into

its memory would be allowed to enter. This is

used in foreign countries in places like the

Pentagon where a high level of security is

needed.

ii. Card sensor Locks: These are electronics locks

that use the cards as keys such that when the

card if inserted, it generates voltage by closing

the circuit and energizing the relay which then

opens the lock. These are used in industrial areas.

7
TECHNICAL SPECIFICATION

COMPONENTS

Resistors 5%:

4M7 yellow, violet, green 5

18K brown, grey, orange 1

Capacitors:

100 nF monoblock 104 1

220uF electrolytic 1

Dual D flip-flop 4013 IC 2

14 pin IC socket 2

BC557 1

9V Battery snap 1

5 mm LED 1

Diode 1N4004 1

12V Relay 1

8
K29 main PCB 1

K29 keypad PCB 1

10 pin box header 2

10 strand flat cable & sockets 2 feet

Hookup wire 12

9
CIRCUIT DIAGRAM

SIMPLE CODE LOCK CIRCUIT


10
This simple code lock circuit described here is of an electronic

combination lock for daily use. It responds only to the right sequence of

four digits that is keyed in remotely. If a wrong key is touched, it resets

the lock. The lock code can be set by connecting the line wires to the

pads A, B, C and D in the figure. For example, if the code is 1756,

connect line 1 to A, line 7 to B, line 5 to C, line 6 to D and rest of the

lines-2,3,4,8 and 9 to the reset pad as shown by dotted lines in the

schematic.

Code lock circuit schematic

11
The code lock circuit is built around two CD4013 dual-D flip-flop ICs.

The clock pins of the four flip-flops are connected to A, B, C and D

pads. The correct code sequence for energisation of relay RL1 is realized

by clocking points A, B, C and D in that order. The five remaining

switches are connected to reset pad which resets all the flip-flops.

Touching the key pad switch A/B/C/D briefly pulls the clock input pin

high and the state of flip-flop is altered. The Q output pin of each flip-

12
flop is wired to D input pin of the next flip-flop while D pin of the first

flip-flop is grounded.

Thus, if correct clocking sequence is followed then low level appears at

Q2 output of IC2 which energizes the relay through relay driver

transistor T1. The reset keys are wired to set pins 6 to 8 of each IC.

(Power-on-reset capacitor C1 has been added at EFY during testing as

the state of Q output is indeterminate during switching on operation.)

This simple code lock circuit can be usefully employed in cars so that

the car can start only when the correct code sequence is keyed in via the

key pad. The code lock design can also be used in various other

applications.

4013 datasheet
13
4013 dual D-type flip-flop is a monolithic complementary MOS

(CMOS) integrated circuit constructed with N- and P- channel

enhancement mode transistors. Each flip-flop has independent data, set,

reset, and clock inputs. Setting or resetting is independent of the clock

and is accomplished by a high level on the set or reset line respectively .

Connection Diagram

Truth Table

14
COMBINATION LOCK

15
This Kit gives a cheap, easily understandable and adaptable combination

lock. The relay will only respond to the right sequence of four numbers

keyed in on the remote keypad. Touching any other key will reset the

lock. The key combination can be easily changed on the main mother

board. The kit is constructed on a single-sided printed circuit board

(PCB). Protel Autotrax and Schematic were used.

Magic is like a combination lock. If each tumbler falls into place, the

lock will open. Seldom are any two locks the same. Their physical

appearance might be identical, but the combination of numbers

necessary to open each is different. So it is with both individual magical

working and those who attempt them. Goals may appear identical in

nature, and magicians similar in training and outward characteristics, but

there similarity stops.

No one can teach another a combination that is his own, for it would not

work. Each person possesses his own inclinations, his own Gestalt, and

so he must ascertain what works best for him. There is nothing

intrinsically esoteric about any combination which will lead to an


16
ultimately successful working unless one considers the keeping of the

secret combination esoteric, for it is literally that. If the truth is to be

known, Greater (ceremonial) magic is simply a means of formalizing

acts which in and of themselves would elicit no attention were they to be

carried out without ritualistic trappings. Hence a ritual chamber is

necessary to make the practitioner feel like a magician, intensifying

awareness of his own potential (if any exists). Once one understands his

potential, reinforcement supplied by the trappings of a ritual chamber

can be superfluous. It's only then when one can get down to brass tacks:

the Combination.

Spatial concepts contribute three dimensions to the Combination. The

fourth dimension exists in time. If the other three dimensions are placed

in correct combination, then the fourth dimension, hence in each

instance the spatial or physical boundaries of three dimensions must be

present in suitable combination to effect said phenomena. Every

occurrence happens somewhere. It is that "somewhere," in combination

with the magician serving as a catalyst, which makes the untoward

occur. "Somewheres" need not be specialized enclosures in the obvious


17
sense, but can be fields, cliffs, streets, woods and rivers, as well as

structures.

Just as a rainbow is composed of harmonics of light, it is "somewhere"

relative to our vantage point; though were we to enter into its apparent

field, it would no longer visibly exist. The only way to see a rainbow is

from afar -- yet it still exists. The fable of the rainbow, with its pot of

gold waiting at it's base, is the story of man's delusion and

disappointment. The magician must realize that his search does not end

at the base of the rainbow -- he must bypass it for the "somewhere" over

the rainbow. There are no curricula for such a search. The combination

needed for a controlled working might place the magician not only in

diverse places, but in diverse positions and acts. He might need to read a

certain book at a certain time in a certain place. Each acts to drop a

tumbler in the combination lock.

ASSEMBLY INSTRUCTIONS

Components may be added to the PCB in any order. It is usually easiest

to add the lowest height components first; the resistors. Make sure you

18
get the diode, electrolytic capacitor and LED around the correct way.

The short lead of the LED is the cathode. The bar on the overlay shows

the hole for the LED cathode. There are 3 links to add to the main PCB.

These are short links - use some of the wire cut off the resistor legs for

them. They are shown by the 3 lines next to three 4M7 resistors. The

overlay shows how to solder the two box headers to each PCB.

CONNECTING THE WIRE CABLE

We have supplied the cable connected to 10 pin sockets at both ends.

Check that pin 1 on both sockets (marked by a triangle on the body of

the socket) are electrically connected together. Pin 1 is the cable strand

marked in red. It is connected to the pin marked with a triangle on the

plastic body of the socket. Check that when you connect the two PCBs

together that pad 1 on the main PCB connects to pad 1 on the keypad

PCB. (Use a multi-meter to do this.)

OPERATING INSTRUCTIONS

19
Choose four numbers you want to be the secret combination. The

numbers must be different. Let us choose 1357. That is, we want to

touch 1 then 3 then 5 then 7 on

The Remote Keypad for the relay to trigger. Touching any other number

we want to reset the unit. On the main PCB connect Pad A to one of the

pads on line 1 using some of the hookup wire provided. Connect Pab B

to a pad on line 3, pad C to a pad on 5, pad D to a pad on line 7. Now

connect the five remaining numbers to the five pads on the RESET pad.

Connect a 9 to 12V power supply. The Combination Lock is now ready.

A mains-rated 12V relay is provided with the Kit. It can switch a main

powered device such as a light. The 4013 IC's will work from 3V to 18V

so the unit is quite flexible and can be adapted to many situations.

CIRCUIT DESCRIPTION

20
The circuit is built around two 4013 dual D flip-flop (FF.) Each 4013

contains two D flip-flops. The four FF are connected to A, B, C and D

pads. ABCD gives the 4 digits which must be keyed in in sequence for

the relay to trigger. The five remaining digits may be connected to the

RESET PAD. If one of these digits is keyed in during the ABCD

sequence then the circuit will reset.

The circuit diagram and the block diagram of the 4013 show how the

lock works. The ABCD touch pads are connected to the Clock input pins

3 and 11 of each 4013. ABCD pads are normally tied low by the 4M7

resistors. Touching the pads of each keypad briefly pulls the input high

and the state of the FF is altered. The output Q pins (1 and 13) are wired

so that when the correct sequence is keyed in then pin 13 of IC2 turns on

the transistor. The reset keys are all wired to the Set pins (6 and 8) of

each IC.

WHAT TO DO IF IT DOES NOT WORK

21
Poor soldering is the most likely reason that the circuit does not work.

Check all solder joints carefully under a good light. Next check that all

components are in their correct position on the PCB - the IC's, and the

electrolytic capacitors. Thirdly, follow the track with a voltmeter to

check the voltage at various parts of the circuit.

Did you add the 3 links? Did you check the cable? Use a continuity

tester or resistance meter to check the cable connections. Insert the cable

into both PCB's and use the meter to check that pad 1 connects to pad 1

on the other PCB. Check for all 9 pads and the high voltage pad. If you

are satisfied that the lock is assembled correctly then use the DC range

on your voltmeter and connect it to pin 1 of IC1. Touch a reset pin then

the pad number that Pad A is connected to. The state of pin 1 should

change. If it does not change then that FF is not working for some

reason. Similarly check pins 13 of IC1. Then move to pins 1 and 13 of

IC2.

CONCLUSIONS

22
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. As such, we design a cheap and

effective security system for buildings, cars, safes, doors and gates, so

as 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. The system works by

combination lock which was divided into units and each unit

designed separately before being coupled to form a whole

functional system. Twenty tests were conducted to ascertain the

reliability of the design with the first eight combinations being four in

number, the next seven tests being five and the last five combinations

being six. This was done because of the incorporation of 2 dummy

switches in the combinations. From the result obtained, combinations

8, 11, 13 gave the correct output combination. However, 8 as the

actual combination gave the required output. The general operation

of the system and performance is dependent on the key


23
combinations. The overall system was constructed and tested and it

works perfectly.

24
REFERENCES

Graw-Hill, M.C. (1985), Encyclopedia of Science and

Technology (5th Edition), Cambridge

University Press 1985, ISBN 042507843, pp. 2-253.

Weber, & Thad-L. (1985), Alarm Systems and Theft

Protection, 2nd edition,Stoncham, MA:

Uutterworth, pp. 7-8.

Koenig, J.A., & Taylor, L. (1998), Perimeter Security Sensor

Technology Handbook,

Electronic Security Systems Engineering Division, North

Charleston, U.S.A, pp. 67-86.

Theraja, B. L., & Theraja, B.K (2002), A textbook of

Electrical Technology, S. Chand and

Company Ltd. New Delhi, India 2002, pp. 220, 920, 924, 1712

1716.

Mehta, V.K., & Mehta, S. (1993), Principles of Electronics, S.

25
Chand and Company Ltd. New

Delhi, India 2002, pp. 149-166.

Rashid, M.A. (1986), Power Electronic Circuits, Devices and

Applications, Longman, 1986,

pp. 245-248

Zungeru, A..M., Kolo, J.G., & Olumide, I. (2012), A Simple

and Reliable Touch sensitive

security System, International Journal of Network Security & Its

Applications (IJNSA), 4(5), pp.

149165.

Zungeru, A.M. et al. (2012), Design and Implementation of

a Low Cost Digital Bus

Passenger Counter, Innovative Systems Design and Engineering,

3(4), pp. 2941.

26