89C51 Security Access Control System

95
MANOHAR PHALKE MEMORIAL FOUNDATION’S POLYTECHNICS Sion, Mumbai – 400 022 -o0o- P ROJECT R EPORT O N -o0o- 89C51 Micro-controller Based Security Access Control System P ROJECT GUIDE : - Er. Santosh A. Kamble. -o0o- WORKED BY -o0o- 1. Abu Sufiyan M. Kalam. 2. Jadhav Santosh Dhondu. 3. Chetan Suresh Tulaskar. 4. Vishnu Gopal Shelar. -o0o- Y EAR & C OURSE -o0o-

Transcript of 89C51 Security Access Control System

Page 1: 89C51 Security Access Control System

MANOHAR PHALKE MEMORIAL FOUNDATION’S POLYTECHNICS

Sion, Mumbai – 400 022

-o0o- P ROJECT R EPORT O N -o0o-

89C51 Micro-controller

Based

Security Access Control System

P ROJECT GUIDE : -Er. Santosh A. Kamble.

-o0o- WORKED BY -o0o-

1. Abu Sufiyan M. Kalam.

2. Jadhav Santosh Dhondu.

3. Chetan Suresh Tulaskar.

4. Vishnu Gopal Shelar.

-o0o- Y EAR & C OURSE -o0o-

THIRD YEAR DIPLOME IN ELECTRONICS AND TELECOMMUNICATION ENGINEERING

-o0o- 2005 - 2006 -o0o-

Page 2: 89C51 Security Access Control System

SION, MUMBAI – 400 022

CERTIFICATE

This is to certify that the following students of Third Year

Diploma in ELECTRONICS AND TELECOMMUNICATION

ENGINEERING has satisfactorily carried out the project work

entitled, “89C51 Micro-controller based Security Access

Control System” as a partial fulfillment of their Diploma

Engineering during academic year of 2005 – 2006.

1. Abu Sufiyan M. Kalam.

2. Jadhav Santosh Dhondu.

3. Chetan Suresh Tulaskar.

4. Vishnu Gopal Shelar.

_____________ ________________ ___________________ (PRINCIPAL) (H.O.D) (PROJECTGUIDE)

___________________

Page 3: 89C51 Security Access Control System

(DATE)

Page 4: 89C51 Security Access Control System

AcknowledgementAcknowledgement

We are pleasured to submit this presentation studied out inWe are pleasured to submit this presentation studied out in

manohar phalke memorial foundation’s polytechnic. We would likemanohar phalke memorial foundation’s polytechnic. We would like

for humble attempt to thank all those people who helped us to makefor humble attempt to thank all those people who helped us to make

this project.this project.

First it is our pleasure to First it is our pleasure to Prof. Ashok D. Chavan (Prof. Ashok D. Chavan (Principal OfPrincipal Of

M.P.M.F.P.M.P.M.F.P.) ) & & Er. Parmeshwar Manegopale (Er. Parmeshwar Manegopale (H.O.D ET/EXH.O.D ET/EX)) for for

granting us the opportunity to present our project – granting us the opportunity to present our project –

“Micro-controller based Security Access Control System”

We express our heart filled gratitude to honorable sir,We express our heart filled gratitude to honorable sir,

EEr. Santosh A. Kamble (r. Santosh A. Kamble (college project in-charge and internalcollege project in-charge and internal

guideguide)), who offered us all the, who offered us all the possible assistance during our possible assistance during our

developing period and for the interest he took in sorting ourdeveloping period and for the interest he took in sorting our

difficulties and offering us guidance, constant encouragement anddifficulties and offering us guidance, constant encouragement and

help.help.

Finally we wish to extend our gratitude to all the Finally we wish to extend our gratitude to all the M.P.M.F.P.M.P.M.F.P.

Staff that all made our developing period a great experience for us.Staff that all made our developing period a great experience for us.

Abu Sufiyan M. Kalam.

Jadhav Santosh Dhondu.

Chetan Suresh Tulaskar.

Vishnu Gopal Shelar.

Page 5: 89C51 Security Access Control System

Index

Sr.no. Topic Page no.

1 Introduction

2 Block Diagram and Description

3 Circuit Diagram and Description

4 PCB Layout

5 Project hardware

6 Project Software

7 Applications and Advantages

8 Future Modifications

9 Conclusion

10 Bibliography

11 Data sheets

Page 6: 89C51 Security Access Control System

CHAPTER 1

INTRODUCTION

Page 7: 89C51 Security Access Control System

1.0 INTRODUCTION

Security is prime concern in our day-today life. Every one

wants to be as much as secure as to be possible. An access control

system forms a vital link in security chain. The micro controller based

digital lock present here is an access control system that allows only

authorized persons to access a restricted area. The system comprises a

small electronics unit with a numeric keypad, which is fixed out side

the entry door to control a magnetic lock. When an authorized person

enters predetermined number (password) via the keypad, the relay

operated for a limited time to unlatched the magnetic lock so the door

can be pushed/pulled to open. At the end of present delay, the relay

reenergizes and the door gets locked again. If the entered password is

correct the display displays that “ Code is correct – access allowed.”

And if the entered password is wrong it gives three beep signals and

display will displays “Code is in-correct – Access is denied”.

When the code has been incorrectly entered five times, the code

lock will switch to alarm relay are turned off after entering a valid

user Access code. This function thwarts any attempt by hackers to

quickly try a large number of codes in a sequence. The secret code can

be changed any time after entering the current code (Master code)

Page 8: 89C51 Security Access Control System

CHAPTER 2

BLOCK DIAGRAM

AND DESCRIPTION

Page 9: 89C51 Security Access Control System

2.0 Block Diagram

Page 10: 89C51 Security Access Control System

2.1 Block Diagram Description

89C51 Micro-controller based Security Access Control System

has following blocks.

1. Key Pad

2. Micro-controller 89C51

3. LCD display

4. Relay Driver

5. Buzzer

6. Power supply

1. Key Pad:

There are total 12 keys. These are normally open push buttons.

When button is normal i.e. not pressed then it gives logic zero. And

when button is pressed then it gives logic high i.e +5 Volt i.e. 1.

2. Micro-controller 89C51 :

It is a low-power, high-performance CMOS 8-bit

microcomputer with 4K bytes 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 MCS-51™ instruction set and pin-out. The on-

Page 11: 89C51 Security Access Control System

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 so many embedded control

applications

3. LCD display :

This display contains two internal byte wise resisters, One for

the commands (RS=0) and second for character to be displayed

(RS=1). It also contains a user programmed RAM area (the character

RAM) that can be programmed to generate any desired character that

can form using a dot matrix. To distinguish between these two data

areas, the hex command byte 80H will be used to signify that display

RAM address 00H is chosen. Port 1 is used to furnish the command or

data byte, and ports 3.2 to 3.4 furnish register select and read/write

levels. The display takes varying amounts of time to accomplish the

functions. LCD bit 7 is monitored for logic high (Busy) to ensure the

display is not overwritten.

This LCD display is used to display the code, error message

etc.

Page 12: 89C51 Security Access Control System

4. Relay Driver :

Output of micro-controller is not sufficient to drive the relay

directly. Therefore to drive the relay we are using relay driver block

by using transistor as switch.

5. BUZZER:

This is output device. When wrong code is pressed then buzzer

will turn ON.

6. Power supply:

This block converts 230 Vac into +5 volt dc and +12 volts dc.

+5 volts is required for key pad, Micro-controller 89C51 board

and LCD display.

+ 12 Volts are required for Relay driver circuit and Buzzer.

Page 13: 89C51 Security Access Control System

CHAPTER 3

CIRCUIT DIAGRAM

AND DESCRIPTION

Page 14: 89C51 Security Access Control System

3.0 Circuit Diagram

Page 15: 89C51 Security Access Control System

3.1 Circuit Diagram Description

Microcontroller 89C51 is heart of our project. It has four ports,

port 0, port1, port2, port 3. In our project we are using switch to enter

the number. The switches are normally open and normally it gives

logic one output. When we press the button switch will become close,

and it gives logic zero to microcontroller. Through program

microcontroller will check the digit.

Relay is used as magnetic lock. Normally relay is energized

therefore it is magnetized. When we press the right code then the relay

will become de-energized i.e. de magnetize.

When we press wrong code then the buzzer will turn on and

relay remains energized for latch. LCD is used to display the code

entered. The operating frequency of the microcontroller is 12 MHz.

Page 16: 89C51 Security Access Control System

CHAPTER 4

PCB Layout

Page 17: 89C51 Security Access Control System

4.1 PCB Layout

Page 18: 89C51 Security Access Control System
Page 19: 89C51 Security Access Control System

CHAPTER 5

PROJECT

HARDWARE

Page 20: 89C51 Security Access Control System

5 Project Hardware:

In our project we uses following hardware

5.1 Microcontroller 89C51

5.2 Voltage Regulator 78XX series

5.3 Relay

5.4 Capacitors

5.5 Diodes

5.6 Light Emitting Diodes (LEDs)

5.7 Buzzer and Bleeper

5.8 Presets

5.9 Transistors

Page 21: 89C51 Security Access Control System

5.1 Microcontroller 89C51

The AT89C51 is a low-power , high-performance CMOS 8-bit

microcomputer with 4K bytes 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 pin

out. 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 applications.

The AT89C51 is designed with static logic for operation down

to zero frequency and supports 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.

Page 22: 89C51 Security Access Control System

Features of 89C51

Following are the features of 89C51 Microcontroller as per

the datasheet given by Atmel-

Compatible with MCS-51TM Products.

4K Bytes of In-system Reprogrammable Flash Memory Endurance

1,000 Write / Erase Cycles.

Fully Static Operation : 0 Hz to 24 MHz

Three-level Program Memory Lock

128 x 8-bit Internal RAM

32 Programmable I / O Lines.

Two 16-bit Timer / Counters

Six Interrupt Sources

Programmable Serial Channel

Low-power Idle and Power-down Modes

Pin Diagram of 89C51 Microcontroller

Page 23: 89C51 Security Access Control System
Page 24: 89C51 Security Access Control System

Pin Description

VCC:- Supply Voltage

GND:- Ground

Port 0:- Port 0 is an 8-bit open-drain bi-directional I /O port. As

an output port, each pin can sink eight TTL inputs. When 1s are

written to port 0 pins, the pins can be used as high impedance inputs.

Port 0 may also be configured to be the multiplexed low order address

/ data bus during accesses to external program and data memory. In

this mode P0 has internal pull-ups. Port 0 also receives the code bytes

during Flash programming, and outputs the code bytes during

program verification. External pull-ups are required during program

verification.

Port 1:- Port 1 is an 8-bit bi-directional I / O port with internal

pull-ups. The port 1output buffers can sink/source four TTL inputs.

When 1s are written to port 1 pins they are pulled high by the internal

pull-ups and can be used as inputs. As inputs , Port 1 pins that are

externally being pulled low will source current (IIL) because of the

internal pull-ups. Port 1 also receives the low-order address bytes

during Flash programming and verification.

Page 25: 89C51 Security Access Control System

Port 2:- Port 2 is an 8-bit bi-directional I / O port with internal

pull-ups. The port 2 output buffers can sink / source four TTL inputs.

When 1s are written to Port 2 pins they are pulled high by the internal

pull-ups and can be used as inputs. As inputs, Port 2 pins that are

externally being pulled low will source current (IIL) because of the

internal pull-ups. Port 2 emits the high-order address byte during

fetches from external program memory and during accesses to

external data memory that uses 16-bit addresses (MOVX @ DPTR).

In this application, it uses strong internal pull-ups when emitting 1s.

During accesses to external data memory that uses 8-bit addresses

(MOVX @ RI), Port 2 emits the contents of the P2 Special Function

Register. Port 2 also receives the high-order address bits and some

control signals during Flash programming and verification.

Port 3:- Port 3 is an 8-bit bi-directional I /O port with internal

pull-ups. The Port 3 output buffers can sink / source four TTL inputs.

When 1s are written to Port 3 pins they are pulled high by the internal

pull-ups and can be used as inputs. As inputs, Port 3 pins that are

externally being pulled low will source Current (IIL) because of the

pull-ups.

Page 26: 89C51 Security Access Control System

Port 3 also serves the functions of various special features of

the AT89C51 as listed below ,Port Pin Alternate Functions –

P3.0 RXD (Serial input port)

P3.1 TXD (Serial output port)

P3.2 INT0 (External Interrupt 0)

P3.3 INT1 (External Interrupt 1)

P3.4 T0 (Timer 0 external input)

P3.5 T1 (Timer 1 external input)

P3.6 WR (External data memory write strobe)

P3.7 RD (External data memory read strobe)

RST:- Reset input , A high on this pin for two machine cycles

while the oscillator is running resets the device.

ALE / PROG:- Address Latch Enable output pulse for latching the

low byte of the address during accesses to external memory. This pin

is also the program pulse input (PROG) during Flash programming. In

normal operation ALE is emitted at a constant rate 1 / 6 the oscillator

frequency, and may be used for external timing or clocking purposes.

Note, however , that one ALE pulse is skipped during each access to

external Data Memory. If desired, ALE operation can be disabled by

setting bit 0 of SFR location 8EH. With the bit set, ALE is active only

Page 27: 89C51 Security Access Control System

during a MOVX or MOVC instruction. Otherwise, the pin is weakly

pulled high. Setting the ALE-disable bit has no effect if the

Microcontroller is in external execution mode.

PSEN:- Program Store Enable is the read strobe to external

program memory. When the AT89C51 is executing code from

external program memory, PSEN is activated twice each cycle, except

that two PSEN activations are skipped during each access to external

data memory.

EA / VPP:- External Access Enable. EA must be strapped to

GND in order to enable the device to fetch code from external

program memory locations starting at 0000H up to FFFFH. Note,

however , that if lock bit 1 is programmed , EA will be internally

latched on reset. EA should be strapped to VCC for internal program

executions. The pin also receives the 12-volt programming enable

voltage (VPP) during Flash programming, for parts that require 12-

volt VPP.

XTAL1:- Input to the inverting oscillator amplifier and input to the

internal clock operating circuit.

XTAL2:- Output from the inverting oscillator amplifier.

Page 28: 89C51 Security Access Control System

5.2 Three Terminal Voltage Regulator: -

General Features: -

A three terminal voltage regulator is a

regulator in which the output voltage is set

at some predetermined value. Such

regulators do not require an external

feedback connection. Hence, only three terminals are required for

device of such types, input (Vin) output (Vo) and a ground terminal.

Since the regulator operates at a preset output voltage the current

limiting resistor is also internal to the device. The main advantages of

such regulators are the simplicity of connections to the external circuit

and the minimum of external components. Fig. Shows the basic circuit

configuration of the three terminal voltage regulator. Although, the

three terminal regulators offers only fixed output voltages, there are

wide variety of voltages available, both +Ve and – Ve. The output

current range from 100 m A to 3 A.

LM 78 MXX series 3 terminal positive voltage regulators.

General description: -

The LX78MXX series of three terminal regulators is available

with several fixed output voltages making them useful in a wide range

Page 29: 89C51 Security Access Control System

of applications. The voltage available allow these regulators to be

used in logic system, instrumentation, Hi – Fi and other solid state

electronic equipment. Although designed primarily devices can be

used with external component to obtain adjustable voltage and

current.

Features:

1) Internal thermal overload protection.

2) NO external components required.

3) Output transistor safe area protection.

4) Internal short circuit current limit.

5) Circularity allows start up even if output is pulled to negative

voltage (I supplies)

Absolute maximum rating:

Input voltage 35 V

internal power dissipation Internally limited.

Operating temperature range 00 to 700 c

Maximum junction temperature + 1250c

Storage temperature range - 650v to 1500c

Lead temperature + 2300c

Page 30: 89C51 Security Access Control System

5.3 Relay:

A relay is an electrically

operated switch. Current flowing

through the coil of the relay

creates a magnetic field, which

attracts a lever and changes the

switch contacts. The coil current

can be on or off so relays have two switch positions and they are

double throw (changeover) switches.

Relays allow one circuit to switch a second circuit, which can

be completely separate from the first. For example a low voltage

battery circuit can use a relay to switch a 230V AC mains circuit.

There is no electrical connection inside the relay between the two

circuits; the link is magnetic and mechanical.

The coil of a relay passes a relatively large current, typically

30mA for a 12V relay, but it can be as much as 100mA for relays

designed to operate from lower voltages. Most ICs (chips) cannot

provide this current and a transistor is usually used to amplify the

small IC current to the larger value required for the relay coil. The

Page 31: 89C51 Security Access Control System

maximum output current for the popular 555 timer IC is 200mA so

these devices can supply relay coils directly without amplification.

Relays are usually SPDT or DPDT but they can have many

more sets of switch contacts, for example relays with 4 sets of

changeover contacts are readily available. For further information

about switch contacts and the terms used to describe them please see

the page on switches.

Most relays are designed for PCB mounting but you can solder

wires directly to the pins providing you take care to avoid melting the

plastic case of the relay.

The supplier's catalogue should show you the relay's

connections. The coil will be obvious and it may be connected either

way round. Relay coils produce brief high voltage 'spikes' when they

are switched off and this can destroy transistors and ICs in the circuit.

To prevent damage you must connect a protection diode across the

relay coil.

The animated picture shows a working relay with its coil and

switch contacts. You can see a lever on the left being attracted by

magnetism when the coil is switched on. This lever moves the switch

Page 32: 89C51 Security Access Control System

contacts. There is one set of contacts (SPDT) in the foreground and

another behind them, making the relay DPDT

Page 33: 89C51 Security Access Control System

Choosing a relay

You need to consider several features when choosing a relay:

Physical size and pin arrangement.

If you are choosing a relay for an existing PCB you will need to

ensure that its dimensions and pin arrangement are suitable. You

should find this information in the supplier's catalogue.

Coil voltage :

The relay's coil voltage rating and resistance must suit the

circuit powering the relay coil. Many relays have a coil rated for a

12V supply but 5V and 24V relays are also readily available. Some

relays operate perfectly well with a supply voltage which is a little

lower than their rated value.

Coil resistance

The circuit must be able to supply the current required by the

relay coil. You can use Ohm's law to calculate the current:

Relay coil current   =supply voltagecoil resistance

For example: A 12V supply relay with a coil resistance of 400

passes a current of 30mA. This is OK for a 555 timer IC (maximum

output current 200mA), but it is too much for most ICs and they will

require a transistor to amplify the current.

Page 34: 89C51 Security Access Control System

Switch ratings (voltage and current)

The relay's switch contacts must be suitable for the circuit they

are to control. You will need to check the voltage and current ratings.

Note that the voltage rating is usually higher for AC, for example:

"5A at 24V DC or 125V AC".

Switch contact arrangement (SPDT, DPDT etc)

Most relays are SPDT or DPDT which are often described as

"single pole changeover" (SPCO) or "double pole changeover"

(DPCO). For further information please see the page on switches.

Protection diodes for relays

Transistors and ICs (chips) must be protected from the brief

high voltage 'spike' produced when the relay coil is switched off. The

diagram shows how a signal diode (eg 1N4148) is connected across

the relay coil to provide this protection. Note that the diode is

connected 'backwards' so that it will normally not conduct.

Conduction only occurs when the relay coil is switched off, at this

moment current tries to continue flowing through the coil and it is

harmlessly diverted through the diode. Without the diode no current

could flow and the coil would produce a damaging high voltage 'spike'

in its attempt to keep the current flowing.

Page 35: 89C51 Security Access Control System

Relays and transistors compared

Like relays, transistors can be used as an electrically operated

switch. For switching small DC currents (< 1A) at low voltage they

are usually a better choice than a relay. In these cases a relay will be

needed, but note that a low power transistor may still be needed to

switch the current for the relay's coil! The main advantages and

disadvantages of relays are listed below:

Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.

Relays can switch high voltages, transistors cannot.

Relays are a better choice for switching large currents (> 5A).

Relays can switch many contacts at once.

Disadvantages of relays:

Relays are bulkier than transistors for switching small currents.

Relays cannot switch rapidly (except reed relays), transistors can

switch many times per second.

Relays use more power due to the current flowing through their coil.

Relays require more current than many chips can provide, so a low

power transistor may be needed to switch the current for the relay's

coil.

Page 36: 89C51 Security Access Control System

5.4Capacitors

Capacitors store electric charge. They are used to smooth

varying DC supplies by acting as a reservoir of charge. They are also

used in filter circuits because capacitors easily pass AC (changing)

signals but they block DC (constant) signals.

Polarised capacitors (large values, 1µF +)

      Electrolytic capacitors are polarized and they

must be connected the correct way round, at

least one of their leads will be marked + or -.

They are not damaged by heat when

soldering.

There are two designs of electrolytic capacitors; axial where the

leads are attached to each end (220µF in picture) and radial where

both leads are at the same end (10µF in picture). Radial capacitors

tend to be a little smaller and they stand upright on the circuit board.

It is easy to find the value of electrolytic capacitors because

they are clearly printed with their capacitance and voltage rating. The

voltage rating can be quite low and it should always be checked when

selecting an electrolytic capacitor.

Page 37: 89C51 Security Access Control System

Unpolarised capacitors (small values, up to 1µF)

Small value capacitors are

unpolarised and may be connected

either way round. They are not damaged by heat when soldering,

except for one unusual type

(polystyrene). It can be difficult to

find the values of these small capacitors because there are many types

of them and several different labeling systems.

Many small value capacitors have their value printed but

without a multiplier, so you need to use experience to work out what

the multiplier should be!

5.5 Diodes

Diodes allow electricity to

flow in only one direction. The

arrow of the circuit symbol shows the direction in which the current

can flow. Diodes are the electrical

version of a valve and early diodes

were actually called valves.

Page 38: 89C51 Security Access Control System

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the

diode, rather like a person pushing through a door with a spring. This

means that there is a small voltage across a conducting diode, it is

called the forward voltage drop and is about 0.7V for all normal

diodes which are made from silicon. The forward voltage drop of a

diode is almost constant whatever the current passing through the

diode so they have a very steep characteristic (current-voltage graph).

Reverse Voltage

When a reverse voltage is applied a perfect diode does not

conduct, but all real diodes leak a very tiny current of a few µA or

less. This can be ignored in most circuits because it will be very much

smaller than the current flowing in the forward direction. However, all

diodes have a maximum reverse voltage (usually 50V or more) and if

this is exceeded the diode will fail and pass a large current in the

reverse direction, this is called breakdown.

Ordinary diodes can be split into two types: Signal diodes

which pass small currents of 100mA or less and Rectifier diodes

which can pass large currents. In addition there are LED (which have

their own page) and Zener diodes (at the bottom of this page).

Page 39: 89C51 Security Access Control System

5.6 Light Emitting Diodes (LEDs)

LEDs emit light when an electric current passes through them.

Colours of LEDs

LEDs are available in red, orange, amber, yellow, green, blue

and white. Blue and white LEDs are much more expensive than the

other colours.

Page 40: 89C51 Security Access Control System

The colour of an LED is determined by the semiconductor

material, not by the colouring of the 'package' (the plastic body).

LEDs of all colours are available in uncoloured packages which may

be diffused (milky) or clear (often described as 'water clear'). The

coloured packages are also available as diffused (the standard type) or

transparent.

Page 41: 89C51 Security Access Control System

Bi-colour LEDs

A bi-colour LED has two LEDs wired in

'inverse parallel' (one forwards, one backwards)

combined in one package with two leads. Only one

of the LEDs can be lit at one time and they are less

useful than the tri-colour LEDs described above.

Calculating an LED resistor value

An LED must have a resistor connected in series to limit the

current through the LED, otherwise it will burn out almost instantly.

The resistor value, R is given by:

R = (VS - VL) / I

VS = supply voltage

VL = LED voltage (usually 2V, but 4V for blue and white LEDs)

I = LED current (e.g. 20mA), this must be less than the maximum

permitted

If the calculated value is not available choose the nearest

standard resistor value which is greater, so that the current will be a

little less than you chose. In fact you may wish to choose a greater

resistor value to reduce the current (to increase battery life for

example) but this will make the LED less bright.

Page 42: 89C51 Security Access Control System

For example

If the supply voltage VS = 9V, and you have a red LED (VL =

2V), requiring a current I = 20mA = 0.020A,

R = (9V - 2V) / 0.02A = 350 , so choose 390 (the nearest standard

value which is greater).

5.7 Buzzer and Bleeper

These devices are output

transducers converting electrical energy

to sound. They contain an internal

oscillator to produce the sound, which

is set at about 400Hz for buzzers and

about 3kHz for bleepers.

Buzzers have a voltage rating but it is only approximate, for

example 6V and 12V buzzers can be used with a 9V supply. Their

typical current is about 25mA.

Bleepers have wide voltage ranges, such as 3-30V, and they

pass a low current of about 10mA.

Buzzers and bleepers must be connected the right way round,

their red lead is positive (+).

Page 43: 89C51 Security Access Control System
Page 44: 89C51 Security Access Control System

5.8 Presets

These are miniature versions of the

standard variable resistor. They are

designed to be mounted directly onto the

circuit board and adjusted only when the

circuit is built. For example to set the frequency of an alarm tone or

the sensitivity of a light-sensitive circuit. A small screwdriver or

similar tool is required to adjust presets.

Presets are much cheaper than standard variable resistors so

they are sometimes used in projects where a standard variable resistor

would normally be used.

Multiturn presets are used where very precise adjustments must

be made. The screw must be turned many times (10+) to move the

slider from one end of the track to the other,

Transistors amplify current, for example

they can be used to amplify the small output

current from a logic chip so that it can operate a

lamp, relay or other high current device. In

Page 45: 89C51 Security Access Control System

many circuits a resistor is used to convert the changing current to a

changing voltage, so the transistor is being used to amplify voltage.

A transistor may be used as a switch (either fully on with

maximum current, or fully off with no current) and as an amplifier

(always partly on). The amount of current amplification is called the

current gain, symbol hFE.

Types of transistor

There are two types of standard

transistors, NPN and PNP, with different

circuit symbols. The letters refer to the

layers of semiconductor material used to make the transistor. Most

transistors used today are NPN because this is the easiest type to make

from silicon. If you are new to electronics it is best to start by learning

how to use NPN transistors.

The leads are labelled base (B), collector (C) and emitter (E).

These terms refer to the internal operation of a transistor but they are

not much help in understanding how a transistor is used, so just treat

them as labels!

Page 46: 89C51 Security Access Control System

CHAPTER 6

SYSTEM

SOFTWARE

Page 47: 89C51 Security Access Control System

6. Program:

ORG 0000H ;START

CLR P2.5

SETB P2.4

MOV DPTR,#COMM1 ; LCD INITILISATION

UP1: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',COMMAND11

UP772: ACALL LOCKDISPLAY

ACALL COLLAGEDISPLAY

MOV A,P2 ;CHECK FOR FINAL SET

ANL A,#04H

JNZ UP772

UP22: MOV R0,#7EH ;LSB

MOV R1,#7EH

MOV R2,#7EH ;MSB

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R2,A

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R1,A

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R0,A

UP012: ACALL SETDISPLAY ;DISPLAY CODE

MOV A,P2

ANL A,#0CH

CJNE A,#0CH,PRGORFIX

AJMP UP012

Page 48: 89C51 Security Access Control System

PRGORFIX:

CJNE A,#08H,UP22

MOV 30H,R0 ;SAVE LSB

MOV 31H,R1

MOV 32H,R2 ;SAVE MSB

MOV 46H,#00H

MOV 45H,#02H

UP223: ACALL SAVEDISPLAY

DJNZ 45H,UP223

SKAGAIN:

MOV R0,#0FFH ;LSB

MOV R1,#0FFH

MOV R2,#0FFH ;MSB

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R2,A

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R1,A

ACALL LCDDISPLAY ;DISPLAY CODE

ACALL SWREAD

MOV R0,A

UP0122: ACALL SETDISPLAY ;DISPLAY CODE

MOV A,P2

ANL A,#0CH

CJNE A,#0CH,PRGORFIX2

AJMP UP0122

PRGORFIX2:

CJNE A,#08H,SKAGAIN

Page 49: 89C51 Security Access Control System

MOV A,R0

CJNE A,30H,DENIED

MOV A,R1

CJNE A,31H,DENIED

MOV A,R2

CJNE A,32H,DENIED

MOV 45H,#05H

MOV 46H,#00H

CLR P2.4

UP2232:ACALL ALLOWDISPLAY

DJNZ 45H,UP2232

SETB P2.4

SJMP SKAGAIN

COMMAND11:

ACALL COMMAND ; CALL COMMAND REGISTER OF LCD

AJMP UP1

DENIED:MOV 45H,#03H

MOV A,46H

CJNE A,#03H,DDDD1

SETB P2.5

YAHA: LCALL HANG

SJMP YAHA

DDDD1: INC 46H

SETB P2.5

DENIED1:ACALL DENIEDISPLAY

DJNZ 45H,DENIED1

CLR P2.5

SJMP SKAGAIN

Page 50: 89C51 Security Access Control System

LOCKDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

P225: ACALL DELAY ;DELAY

DJNZ R0,P225

MOV DPTR,#LINE72 ;DISPLAY DATA ON LINE1.

UP072: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY072

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE73 ;DISPLAY DATA ON LINE1.

UP73: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY73

MOV R0,#02H

UP525:ACALL DELAY ;DELAY

DJNZ R0,UP525

RET

DISPLAY072:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP072

DISPLAY73:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP73

Page 51: 89C51 Security Access Control System

LINE72: DB 'SECURITY ACCESS$'

LINE73: DB 'CONTROL SYSTEM.$'

COLLAGEDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

P5225: ACALL DELAY ;DELAY

DJNZ R0,P5225

MOV DPTR,#LINE572 ;DISPLAY DATA ON LINE1.

UP5072: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY5072

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE573 ;DISPLAY DATA ON LINE1.

UP573: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY573

MOV R0,#02H

UP5525:ACALL DELAY ;DELAY

DJNZ R0,UP5525

RET

DISPLAY5072:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP5072

Page 52: 89C51 Security Access Control System

DISPLAY573:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP573

LINE572: DB 'MANOHAR PHALKE.$'

LINE573: DB ' POLYTECHNIC $'

SAVEDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

P2251: ACALL DELAY ;DELAY

DJNZ R0,P2251

MOV DPTR,#LINE721 ;DISPLAY DATA ON LINE1.

UP0721: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY0721

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE731 ;DISPLAY DATA ON LINE1.

UP731: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY731

MOV R0,#02H

UP5251:ACALL DELAY ;DELAY

DJNZ R0,UP5251

RET

LINE721: DB ' NEW PASSWARD $'

LINE731: DB ' SAVED. $'

Page 53: 89C51 Security Access Control System

DISPLAY0721:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP0721

DISPLAY731:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP731

ALLOWDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

P02251: ACALL DELAY ;DELAY

DJNZ R0,P02251

MOV DPTR,#LINE0721 ;DISPLAY DATA ON LINE1.

UP00721: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY00721

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE0731 ;DISPLAY DATA ON LINE1.

UP0731: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY0731

MOV R0,#02H

UP05251:ACALL DELAY ;DELAY

DJNZ R0,UP05251

RET

Page 54: 89C51 Security Access Control System

LINE0721: DB 'CODE IS CORRECT.$'

LINE0731: DB ' ACCESS ALLOWED $'

DISPLAY00721:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP00721

DISPLAY0731:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP0731

COMMAND1:

ACALL COMMAND ; CALL COMMAND REGISTER OF LCD

AJMP UP1

DISPLAY1:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP2

DISPLAY2:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP32

DELAY: MOV R7,#0FAH ;DELAY OF 1 SECOND

LOOP1: MOV R5,#0FFH

LOOP: DEC R5

MOV A,R5

JNZ LOOP

DEC R7

MOV A,R7

JNZ LOOP1

RET

Page 55: 89C51 Security Access Control System

LCDDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE1 ;DISPLAY DATA ON LINE1.

UP2: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY1

UP1234: MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE2 ;DISPLAY DATA ON LINE1.

UP32: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY2

MOV A,#20H

ACALL DISPLAY

MOV A,R2 ;DISPLAY MINITE

ORL A,#30H ;CONVERT IT TO ASCII

ACALL DISPLAY

MOV A,R1 ;DISPLAY MINITE

ORL A,#30H ;CONVERT IT TO ASCII

ACALL DISPLAY

MOV A,R0 ;DISPLAY MINITE

ORL A,#30H ;CONVERT IT TO ASCII

ACALL DISPLAY

MOV A,#0A1H ;DISPLAY MINITE

ACALL DISPLAY

RET

Page 56: 89C51 Security Access Control System

SETDISPLAY:

ACALL DELAY ;DELAY

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE11 ;DISPLAY DATA ON LINE1.

UP123: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY123

AJMP UP1234

DISPLAY123:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP123

LINE11: DB 'PRESS EN2FIX/PRG$'

COMMAND:

ACALL READY ;Write when display is not busy

MOV P1,A ;Command Character in Port P1

CLR P3.2 ;Command resister chosen

CLR P3.3 ; write enable

SETB P3.4 ; Strobe Character to display CLR P3.4

RET ;Return

DISPLAY:

ACALL READY

MOV P1,A ;take data to be displayed

SETB P3.2 ;RS=P3.2= 1 to select data register

CLR P3.3 ;write enable

SETB P3.4 ;strobe character to be displayed

CLR P3.4

RET ; Return

Page 57: 89C51 Security Access Control System

READY: CLR P3.4 ;strobe display

MOV P1,#0FFH ;configure P1 for input

CLR P3.2 ;Select command register

SETB P3.3 ;read enabled

WAIT: CLR P3.4 ;strobe display

SETB P3.4

JB P1.7,WAIT ;Read busy status (BF=0)

CLR P3.4 ;end display strobe.

RET ;Return

SWREAD:

MOV R6,#00H ;INPUT NO IS 0

MOV A,P0

CJNE A,#0FFH,CHECKSW

MOV A,P2

ANL A,#03H

CJNE A,#03H,CHECKSW1

AJMP SWREAD

CHECKSW:

RRC A

JNC DOWN111

INC R6

AJMP CHECKSW

DOWN111:

MOV A,P0

CJNE A,#0FFH,DOWN111

MOV A,R6

RET

CHECKSW1:

MOV R6,#08H

Page 58: 89C51 Security Access Control System

CHECKSW11:

RRC A

JNC DOWN1111

INC R6

AJMP CHECKSW11

DOWN1111:

MOV A,P2

ANL A,#03H

CJNE A,#03H,DOWN1111

MOV A,R6

RET

COMM1: DB 3CH,0EH,06H,01H,'$'

LINE1: DB 'SECURITY SYSTEM.$'

LINE2: DB 'ENTER CODE =$'

DENIEDISPLAY:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

PK02251: ACALL DELAY ;DELAY

DJNZ R0,PK02251

MOV DPTR,#LINE0721K ;DISPLAY DATA ON LINE1.

UP00721K: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY00721K

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE0731K ;DISPLAY DATA ON LINE1.

Page 59: 89C51 Security Access Control System

UP0731K: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY0731K

MOV R0,#02H

UP05251K:ACALL DELAY ;DELAY

DJNZ R0,UP05251K

RET

LINE0721K: DB 'CODE IN-CORRECT.$'

LINE0731K: DB ' ACCESS DENIED. $'

DISPLAY00721K:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP00721K

DISPLAY0731K:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP0731K

HANG:

MOV A,#01H ;CLEAR LCD DISPLAY

ACALL COMMAND

MOV A,#80H ; STARTING ADDRESS OF LINE 1 OF LCD RAM

ACALL COMMAND

MOV R0,#02H

P22517: ACALL DELAY ;DELAY

DJNZ R0,P22517

MOV DPTR,#LINE7217 ;DISPLAY DATA ON LINE1.

UP07217: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY07217

Page 60: 89C51 Security Access Control System

MOV A,#0C0H ; STARTING ADDRESS OF LINE 2 OF LCD RAM

ACALL COMMAND

MOV DPTR,#LINE7317 ;DISPLAY DATA ON LINE1.

UP7317: CLR A

MOVC A,@A+DPTR

INC DPTR

CJNE A,#'$',DISPLAY7317

MOV R0,#02H

UP52517:ACALL DELAY ;DELAY

DJNZ R0,UP52517

RET

LINE7217: DB 'System is Hanged$'

LINE7317: DB ' Press Reset. $'

DISPLAY07217:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP07217

DISPLAY7317:

ACALL DISPLAY ; CALL DATA REGISTER OF LCD FOR DISPLAY

AJMP UP7317

Page 61: 89C51 Security Access Control System

CHAPTER 7

APPLCATIONS

AND

ADVANTAGE

Page 62: 89C51 Security Access Control System

7.1 Applications:

Digital card access in telephone exchange.

Electrical application access.

Door locking system.

Password protected access to PC.

Access to electronic circuit.

Locker in bank.

Antitheft system design.

7.3 Advantages:

The system used is microcontroller based.

Too little space is required for it to set for any operation

at any location.

Used of keyboard matrix for entering password in simple

way.

LCD display which makes very easy to understand the

operation taking place.

Reset button is available for resetting the system.

There is also facility of changing password.

Simple circuit which can easily be understood.

Moderate price.

Page 63: 89C51 Security Access Control System

CHAPTER 8

FUTURE

MODIFICATIONS

Page 64: 89C51 Security Access Control System

8.0 Future Modifications:

In future from our point of view we will not make use of

password instead of that we shall be able to make use of detecting

finger print or again in any advance technology detecting face or eyes,

etc.

Page 65: 89C51 Security Access Control System

CHAPTER 9

CONCLUSION

Page 66: 89C51 Security Access Control System

9. 0 CONCLUSION

It was are pleasure that we deal with our project “89C51 Micro-

controller based Security Access Control System””

Thus we can say that with this project we can automatically control

the lock just by giving the password, for security purpose.So only the

user can access it by entering the correct password.

Page 67: 89C51 Security Access Control System

CHAPTER 10

BIBLIOGRAPHY

Page 68: 89C51 Security Access Control System

10.0 BIBLIOGRAPHY

1. The 8051 Microcontroller

- Kenneth J. Ayala

2. Microcontroller 89C51 data Manual

-Intel

3. Web site : www.google.com

4. web site : www.geocities.com/sk_instru

Page 69: 89C51 Security Access Control System

CHAPTER 11

DATA SHEETS