Download Password Door Lock

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Stepper motor wikipedia , lookup

Capacitor wikipedia , lookup

Transformer wikipedia , lookup

Spark-gap transmitter wikipedia , lookup

Ground (electricity) wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Power engineering wikipedia , lookup

Transistor wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Ohm's law wikipedia , lookup

Islanding wikipedia , lookup

Electrical ballast wikipedia , lookup

Three-phase electric power wikipedia , lookup

Electrical substation wikipedia , lookup

Mercury-arc valve wikipedia , lookup

Transformer types wikipedia , lookup

Distribution management system wikipedia , lookup

History of electric power transmission wikipedia , lookup

Power inverter wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Current source wikipedia , lookup

Stray voltage wikipedia , lookup

Schmitt trigger wikipedia , lookup

Power electronics wikipedia , lookup

Power MOSFET wikipedia , lookup

Surge protector wikipedia , lookup

Voltage regulator wikipedia , lookup

Alternating current wikipedia , lookup

Voltage optimisation wikipedia , lookup

Current mirror wikipedia , lookup

Buck converter wikipedia , lookup

Mains electricity wikipedia , lookup

Opto-isolator wikipedia , lookup

Rectifier wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Transcript
TRAINING PROJECT REPORT
University Institute of Engineering & Technology
2
Acknowledgment
It is my privilege to express my sincerest regards to my project
coordinator, Mr. Manish Kumar and Mr. Ashok Kumar, for their
valuable inputs, able guidance, encouragement, whole-hearted
cooperation and constructive criticism throughout the duration of our
project.
I deeply express my sincere thanks to my Head of Department Mr.
Anil Kumar for encouraging and allowing me to present the project on
the topic “Password Door Lock” at our department premises for the
partial fulfilment of the requirements leading to the award of B-Tech
degree.
I take this opportunity to thank all my lecturers who have indirectly
helped my project. I pay my respect and love to my parents for their
love and encouragement throughout my career. Last but not the least I
express my thanks to my friends for their cooperation and support.
Abhishek Verma
3
Certificate
This is to certify that Abhishek Verma of University Institute of
Engineering and Technology, Chandigarh, has successfully completed
a project on “Password Door Lock” during 6 weeks summer training at
National Institute of Technical Teachers Training and Research,
Chandigarh.
This report has not been submitted to any other Organisation and does
not form part of any Course undergone by then, for the award of BTech Degree.
Head of Department (ESC)
Er. Anil Kumar
4
Table of Contents
1. Type of Electronic Components………………………………………………...……….5
1.1 Active………………………………………………………………………………...5
1.2 Passive………………………………………………………...……………………..5
2. Battery……………………………………………………………………..…………….5
2.1 Lead Acid……………………………………………………………………...…….5
2.2 Lithium Ion………………………………………………………………………..…5
3. Resistor ………………………………………………………………………………….5
4. Capacitor……………………………………………………………………….….……..6
5. Inductor…………………………………………………………………….…….………6
6. Transformer……………………………………………………………………….……..7
7. Rectifier…………………………………………………………………………….……7
7.1 Half wave rectifier……………………………………………………………….…..7
7.2 Full wave rectifier……………………………………………………………….…...8
7.3 Bridge rectifier…………………………………………………………………….…8
8. Electronic voltage regulators………………………………………………………….…9
9. Regulated power supply…………………………..…………………………………....11
10.Transistor……………………………………..………………………………………...13
11.Relay…………………………………………………………………………..………..14
12.Optocoupler……………………………………………………………….……………16
13.The combined circuit of relay and optocoupler………………………………….……..18
14.Dual Power supply………………………………………………………….…………..19
15.Password Door Lock Project……………………………………………………….......23
15.1 Description……………………………………………………………….………..23
15.2 Components used………………………………………………………….………23
15.3 Source code………………………………………………………………..………27
15.4 Precautions…………………………………………………………………..….…31
15.5 Recommendations…………………………………………………………….......31
5
1. Type of Electronic Components
1.1. Active: The devices or components which require external source for their operation. These
components produce energy in the form of voltage or current. These components have gain greater than or
equal to 1.
Example: transistors, vacuum tubes, thyristors, diodes (except rectifier diode)
1.2. Passive: Passive Components do not require external source for their operation. These components
store or maintain energy in the form of voltage or current. These components do not have any gain.
Example: resistors, capacitors, inductors
2. Battery
It provides the mentioned voltage difference which is supplied to the circuit.
2.1. Lead Acid: Requires charge and discharge cycle. It provides higher power than lithium ion batteries.
2.2. Lithium Ion: Once charged, the charge can be stored for a longer time, i.e. there is no immediate need
of using up the stored charge. Power is low but can be increased by using series and parallel combination
of batteries.
3. Resistor
A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit
element. Resistors act to reduce current flow, and at the same time, act to lower voltage levels within
circuits. In electronic circuits, resistors are used to limit current flow, to adjust signal levels, bias active
elements, terminate transmission lines among other uses. High-power resistors that can dissipate many
6
watts of electrical power as heat may be used as part of motor controls, in power distribution systems, or
as test loads for generators. Fixed resistors have resistances that only change slightly with temperature,
time or operating voltage. Variable resistors can be used to adjust circuit elements (such as a volume
control or a lamp dimmer), or as sensing devices for heat, light, humidity, force, or chemical activity. [1]
To find value of a resistor refer Fig.1.
Fig.1 to find value of a resistor
4. Capacitor
A capacitor (originally known as a condenser) is a passive two-terminal electrical component used to store
energy electrostatically in an electric field The forms of practical capacitors vary widely, but all contain at
least two electrical conductors (plates) separated by a dielectric (i.e. an insulator that can store energy by
becoming polarized). The conductors can be thin films, foils or sintered beads of metal or conductive
electrolyte, etc. The nonconducting dielectric acts to increase the capacitor's charge capacity. A dielectric
can be glass, ceramic, plastic films, air, vacuum, paper, mica, oxide layer etc. Capacitors are widely used
as parts of electrical circuits in many common electrical devices. Unlike a resistor, an ideal capacitor does
not dissipate energy. Instead, a capacitor stores energy in the form of an electrostatic field between its
plates. [1]
5. Inductor
An inductor, also called a coil or reactor, is a passive two-terminal electrical component which resists
changes in electric current passing through it. It consists of a conductor such as a wire, usually wound into
a coil. When a current flows through it, energy is stored temporarily in a magnetic field in the coil. When
7
the current flowing through an inductor changes, the time-varying magnetic field induces a voltage in the
conductor, according to Faraday’s law of electromagnetic induction, which opposes the change in current
that created it. As a result, inductors always oppose a change in current, in the same way that a flywheels
opposes a change in rotational velocity. Care should be taken not to confuse this with the resistance
provided by a resistor. An inductor is characterized by its inductance, the ratio of the voltage to the rate of
change of current, which has units of henries (H). [1]
6. Transformer
A transformer is an electrical device that transfers electrical energy between two or more circuits through
electromagnetic induction. Commonly, transformers are used to increase or decrease the voltages of
alternating current in electric power applications. [1]
A varying current in the transformer's primary winding creates a varying magnetic flux in the transformer
core and a varying magnetic field impinging on the transformer's secondary winding. This varying
magnetic field at the secondary winding induces a varying electromotive force (EMF) or voltage in the
secondary winding. Making use of Faraday's Law in conjunction with high magnetic permeability core
properties, transformers can thus be designed to efficiently change AC voltages from one voltage level to
another within power networks. [1]
Rating is mentioned on transformer .For example, if written 9:230 can be deciphered as 9V is the voltage
given and 230V is the voltage obtained.
7. Rectifier
7.1 Half Wave Rectifier
Theory
In half wave rectification of a single-phase supply, either the positive or negative half of the AC wave is
passed, while the other half is blocked. Because only one half of the input waveform reaches the output,
mean voltage is lower. Half-wave rectification requires a single diode in a single-phase supply, or three in
a three-phase supply. Rectifiers yield a unidirectional but pulsating direct current; half-wave rectifiers
produce far more ripple than full-wave rectifiers, and much more filtering is needed to eliminate
harmonics of the AC frequency from the output. [4]
Circuit Diagram
8
Fig.2 Half Wave Rectifier
7.2 Full Wave Rectifier
Theory
Full wave rectifier rectifies the full cycle in the waveform i.e. it rectifies both the positive and negative
cycles in the waveform. Full wave rectifier has an advantage over the half wave rectifier i.e. it has average
output higher than that of half wave rectifier. The number of AC components in the output of the full wave
rectifier is less than that of the input. [4]
Circuit diagram
Fig.3 Full Wave Rectifier
7.3 Bridge Rectifier
Theory
In bridge rectifier four diodes are used. These are connected as shown in the circuit diagram. The four
diodes are connected in the form of a bridge to the transformer and the load as shown. In first half cycle of
the AC input, the upper portion of the transformer secondary winding is positive with respect to the lower
portion. Thus during the first half cycle diodes D1 and D4 are forward biased. Current flows through path
1-2, enter into the load RL. It returns back flowing through path 4-3. During this half input cycle, the
diodes D2 and D3 are reverse biased. Hence there is no current flow through the path 2-3 and 1-4. During
the next cycle lower portion of the transformer is positive with respect to the upper portion. Hence during
this cycle diodes D2 and D3 are forward biased. Current flows through the path 3-2 and flows back
through the path 4-1.The diodes D1 and D4 are reverse biased. So there is no current flow through the path
1-2 and 3-4.Thus negative cycle is rectified and it appears across the load. [4]
9
Circuit diagram
Fig.4 Bridge Rectifier
TABLE
I
Components Specification
required
Capacitor
No.
of
components
required
150uf,470uf,1000uf,0.5W 3
Diode
Resistance
Battery
Transformer
0.7V (threshold voltage)
1k, 1.5k
12Vdc
230:9
4
2
1
1
Observation
TABLE II
Capacitance/voltage
Voltage peak to
peak, Vp-p
Average Voltage,
Vav
RMS
Voltage,
Vrms
150uf
3.250V
470uf
212mV
1000uf
128.1mV
10.20V
11.63V
11.67V
10.20V
11.63V
11.67V
8. Electronic voltage regulators
A simple voltage regulator can be made from a resistor in series with a diode (or series of diodes). Due to
the logarithmic shape of diode V-I curves, the voltage across the diode changes only slightly due to
changes in current drawn or changes in the input. When precise voltage control and efficiency are not
important, this design may work fine.
10
Circuit diagram
Fig.5 Voltage Regulator using Zener Diode
The voltage regulator is of two types-
1. Positive Voltage Regulator (7805)
It outputs a positive constant voltage. The xx in 78xx indicates the fixed output voltage it is designed to
provide. 7805 provides +5V regulated power supply. The pinout of 7805 is as follows.
TABLE III
Pin no.
1.
2.
3.
Function
Input voltage(7V18V)
Ground(0V)
Regulated output,
5V
Name
Input
Ground
Output
2. Negative Voltage Regulator (7905)
It outputs a negative constant voltage. The xx in 79xx indicates the fixed output voltage it is designed to
provide. 7905 provides -5V regulated power supply. The pinout of 7905 is as follows.
TABLE IV
Pin no.
Function
Name
11
1.
2.
3.
Ground(0V)
Ground
Input
Input
voltage(7V-18V)
Regulated output, Output
-5V
9. Regulated power supply
A regulated power supply can convert unregulated ac (alternating current or voltage) to a constant dc
(direct current or voltage). A regulated power supply is used to ensure that the output remains constant
even if the input changes. The regulated power supply will accept an ac input and give a constant dc
output.
Circuit Diagram
Fig.6 Regulated power supply
The basic building blocks of a regulated dc power supply are as follows:
1. A step down transformer
2. A rectifier
3. A DC filter
4. A regulator
Operation of Regulated Power Supply
Step Down Transformer
A step down transformer will step down the voltage from the ac mains to the required voltage level. The
turn’s ratio of the transformer is so adjusted such as to obtain the required voltage value. The output of the
transformer is given as an input to the rectifier circuit.
12
Rectification
Rectifier is an electronic circuit consisting of diodes which carries out the rectification process.
Rectification is the process of converting an alternating voltage or current into corresponding direct (dc)
quantity. The input to a rectifier is ac whereas its output is dc. A bridge rectifier is used to rectify both the
half cycles of the ac supply (full wave rectification).
DC Filteration
The rectified voltage from the rectifier is a pulsating dc voltage having very high ripple content. But this is
not we want, we want a pure ripple free dc waveform. Hence a RC filter is used. As the instantaneous
voltage starts increasing the capacitor charges, it charges till the waveform reaches its peak value. When
the instantaneous value starts reducing the capacitor starts discharging exponentially and slowly through
the load. Hence, an almost constant dc value having very less ripple content is obtained.
Regulation
This is the last block in a regulated DC power supply. The output voltage or current will change or
fluctuate when there is change in the input from ac mains or due to change in load current at the output of
the regulated power supply or due to other factors like temperature changes. This problem can be
eliminated by using a regulator. A regulator will maintain the output constant even when changes at the
input or any other changes occur. . IC 7805 is used to obtained fixed values of voltages at the output.
Usually, coupling capacitors of values about 0.01µF to 10µF needs to be connected at the output and input
to address input noise and output transients.
Application of Regulated Power Supply
Regulated power supply is the main component of electrical, electronics and as well as automation
equipment. Mobile phone charger, oscillator, amplifier all need the regulated power supply to function. [3]
Observations
The waveform smoothened with the application of capacitor at the output.
Result
A DC wave of 5V was obtained at the output.
13
10. Transistor
Theory
Transistors are current controlled solid state devices that conduct current in proportion to an input current.
For an NPN transistor, current flowing into the base of the transistor results in proportionally larger
current to flow between the collector and emitter. Similarly, for a PNP transistor, current flowing out of
the base of the transistor results in proportionally larger current to flow between the collector and emitter.
Circuit diagram
Fig.7 Transistor
TABLE V
Components
required
Battery
Base resistance
Collector
resistance
Potentiometer
Transistor
Specification
No.
components
required
12V dc
1
Green
blue 1
brown,560 ohms
Brown
black 1
red,1kohms
1kohms
1
BC547
1
of
Observations
TABLE VI
State of Transistor
Off
On
Voltage difference across
base and emitter
0V
0.8V
Result
By adjusting the knob of the transistor the transistor switches its state from off to on.
14
11. Relay
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a
switch, but other operating principles are also used, such as solid-state relays. Relays are used where it is
necessary to control a circuit by a low-power signal (with complete electrical isolation between control
and controlled circuits), or where several circuits must be controlled by one signal. The first relays were
used in long distance telegraph circuits as amplifiers: they repeated the signal coming in from one circuit
and re-transmitted it on another circuit. Relays were used extensively in telephone exchanges and early
computers to perform logical operations. [1]
Solid-state relays control power circuits with no moving parts, instead using a semiconductor device to
perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils
are used to protect electrical circuits from overload or faults; in modern electric power systems these
functions are performed by digital instruments still called "protective relays".[1]
Relay circuit with BJT (BC547)
Circuit Diagram
Fig.8 Relay circuit with BJT
TABLE VII
Components
required
Specification
Battery
Potentiometer
Relay
12V dc
10k
HRS4HSDC12V
green
560ohms(1),
1kohms(2)
0.7V (threshold
voltage)
BC547
LED
Resistance
Diode
BJT
No.
of
components
required
1
1
1
2
3
1
1
15
OBSERVATION
TABLE VIII
Relay terminals
Voltage difference between base and emitter
Normally closed
Normally open
0.003 V
0.768 V
Result
By adjusting the knob of the potentiometer the relay switched from NC to NO so the led glowed
alternatively.
Relay circuit with MOSFET (IRF840)
CIRCUIT DIAGRAM
Fig.9 Relay circuit with MOSFET
TABLE IX
Components
required
Battery
Potentiometer
Relay
LED
Resistance
Diode
MOSFET
OBSERVATION
Specification
12V dc
10k
HRS4HS-DC12V
No. of components
required
1
1
1
2
3
560ohms(1),
1kohms(2)
0.7V
(threshold 1
voltage)
IRF840
1
16
TABLE X
Relay terminals
Normally closed
Normally open
V across base emitter
2.5 V
4.12 V
Result
By adjusting the knob of the potentiometer the relay switched from NC to NO so the LEDs glowed
alternatively
12. Optocoupler
In electronics, an opto-isolator, also called an optocoupler, photocoupler, or optical isolator, is a
component that transfers electrical signals between two isolated circuits by using light. Opto-isolators
prevent high voltages from affecting the system receiving the signal. A common type of opto-isolator
consists of an LED and a phototransistor in the same opaque package. Usually opto-isolators transfer
digital (on-off) signals, but some techniques allow them to be used with analog signals. [1]
An opto-isolator contains a source (emitter) of light, almost always a near infrared light-emitting diode
(LED), that converts electrical input signal into light, a closed optical channel (also called dielectrical
channel), and a photosensor, which detects incoming light and either generates electric energy directly, or
modulates electric current flowing from an external power supply. The sensor can be a photoresistor, a
photodiode, a phototransistor, a silicon-controlled rectifier (SCR) or a triac. Because LEDs can sense light
in addition to emitting it, construction of symmetrical, bidirectional opto-isolators is possible. An
optocoupled solid state relay contains a photodiode opto-isolator which drives a power switch, usually a
complementary pair of MOSFETs. A slotted optical switch contains a source of light and a sensor, but its
optical channel is open, allowing modulation of light by external objects obstructing the path of light or
reflecting light into the sensor. [1]
Circuit diagram
Fig.10 Optocoupler
17
TABLE XI
COMPONENTS SPECIFICATION NO.
OF
COMPONENETS
Opto coupler
4N35
1
Potentiometer
10k
1
Voltage
LM7805
1
regulator
Resistance
1k
2
Observation
TABLE XII
Measurements
Base emitter voltage
Emitter base voltage
Collector current
value
0.448V
0.458V
+-50mA
Result
By adjusting the knob of the potentiometer the led was switching its state from on to off.
13. The combined circuit of relay and optocoupler
Theory
When the input voltage is applied to the optocoupler it turns the transistor ON. This happens when the
transistor inside optocoupler drives the other transistor to saturation state which results in shifting the
mechanical arm through magnetized inductor coil from NC to NO.
When the applied power supply is removed then the magnetized inductor coil in relay will demagnetize
through freewheeling diode and the mechanical arm shifts back to NO.
Circuit diagram
18
Fig.11 The combined circuit of relay and optocoupler
TABLE XIII
Components
required
Specification
Battery
Potentiometer
Relay
12V dc
10k
HRS4HSDC12V
LED
Resistance
Diode
Fet
Optocoupler
Voltage
regulator
Resistance
560ohms(1),
1kohms(2)
0.7V
(threshold
voltage)
BC547
4N35
LM7805
1k
No.
of
components
required
1
1
1
3
3
1
1
1
1
2
Observations
TABLE XIV
Result
State of optocoupler
State of Relay
Off
On
Normally Connected
Normally Open
19
By adjusting the knob of the potentiometer the optocoupler switches its state from off to on and
correspondingly the relay switches from normally connected to normally open.
14 .Dual Power supply
Theory
The circuit given here is of a regulated dual power supply that provides +5V and -5V from the AC mains.
A regulated power supply is used to ensure that the output remains constant even if the input changes. The
regulated power supply will accept an ac input and give a constant dc output. The basic building blocks of
a regulated dc power supply are as follows:
1. A step down transformer
2. A rectifier
3. A DC filter
4. Two regulators
Circuit diagram
Fig.12 Dual Power supply
Operation of Regulated Dual Power Supply
Step Down Transformer
A step down transformer will step down the voltage from the ac mains to the required voltage level. The
turn’s ratio of the transformer is so adjusted such as to obtain the required voltage value. The output of the
20
transformer is given as an input to the rectifier circuit.
Rectification
Rectifier is an electronic circuit consisting of diodes which carries out the rectification process.
Rectification is the process of converting an alternating voltage or current into corresponding direct (dc)
quantity. The input to a rectifier is ac whereas its output is dc. A bridge rectifier is used to rectify both the
half cycles of the ac supply (full wave rectification).
DC Filtration
The rectified voltage from the rectifier is a pulsating dc voltage having very high ripple content. But this is
not we want, we want a pure ripple free dc waveform. Hence a RC filter is used. As the instantaneous
voltage starts increasing the capacitor charges, it charges till the waveform reaches its peak value. When
the instantaneous value starts reducing the capacitor starts discharging exponentially and slowly through
the load. Hence, an almost constant dc value having very less ripple content is obtained.
Regulation
This is the last block in a regulated dual DC power supply. The output voltage or current will change or
fluctuate when there is change in the input from ac mains or due to change in load current at the output of
the regulated dual power supply or due to other factors like temperature changes. This problem can be
eliminated by using a regulator. A regulator will maintain the output constant even when changes at the
input or any other changes occur.IC 7805 and 7905 are used for the purpose of voltage regulation in which
the former is a positive 5V regulator and later is a negative 5V regulator. The output of 7805 will be +5V
and that of 7905 will be -5V.Usually coupling capacitors of values about 0.01µF to 10µF needs to be
connected at the output and input to address input noise and output transients.
Application of Regulated Power Supply
A power supply like this is a very essential tool on the work bench of an electronic hobbyist. Regulated
dual power supply is the main component of electrical, electronics and as well as automation equipment. [3]
Observations
1. Wave smoothens with the application of capacitor at the output of voltage regulator.
2. Wave approaches a DC wave as the value of capacitance increases.
Result
A DC wave of +5V and -5V is observed at the output of 7805 and 7905 respectively.
21
Fig13 Regulated power supply circuit on breadboard and initial waveform
Fig.14 Waveform across 780
Fig.15 Waveform across 7905
Fig.16 Voltage across resistor parallel to 7805
22
Fig.17 Voltage across resistor parallel to 7905
Fig.18 Voltage across capacitor before 7805
Fig.19 The wave smoothens as the value of capacitor increases
23
15. Project
Title-Password door lock using 8051 microcontroller:
15.1 Description
A 4x3 matrix keypad and a 16x2 LCD have been used here. Keypad and LCD are very commonly used
input & output devices, respectively. A five digit predefined password needs to be specified by the user.
This password is stored in the system.
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 motor first rotates in clockwise direction, then stops for a
while and then rotates in anticlockwise direction for same time period.
The connections in the circuit are as following: port P2 of microcontroller AT89C51 is used as data input
port which is connected to data pins (7-14) of LCD. P0^7, P0^6 and P0^5 pins of microcontroller are
connected to control pins RS, RW and EN of LCD. Port P3 is used to take input from keypad. P1^0,P1^1
have been used as lock output pin of controller.P1^2 has been connected to red LED which glows when
gate is closed and P1^3 has been connected to green LED which glows when gate is open.
As the program starts, string ‘Enter Password’ 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 a ‘*’ is displayed on
LCD corresponding to the entered number. After the five digits are entered, if the passwords do not match,
a message is displayed to indicate ‘Access Denied’; otherwise a message is displayed to indicate ‘Access
Granted’ and the gate opens for a specified period of time. And the loop continues.
15.2 Components used
TABLE XV
Sr.No.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Name of Component
AT89C51 Microcontroller
40 pin IC Base
L293D IC Driver
16 pin IC Base
16x2 LCD
Preset
Crystal Oscillator 12MHz
Resistor 10kΩ
Resistor 1kΩ
Capacitor 33pF
Capacitor 10uF
Red LED
No. of Components
1
1
1
1
1
1
1
1
2
2
1
1
24
13.
14.
15.
16.
17.
18.
19.
20.
Green LED
DC Motor
Voltage Regulator 7805
Push Button
Batteries 9V
SIP
PCB Board
Connecting Wires
1
1
1
13
2
1
1
As per Requirement
AT89C51
Fig.20 AT89C51
AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of
Flash programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can be erased
and program to a maximum of 1000 times. In 40 pin AT89C51, there are four ports designated as P1, P2,
P3 and P0. All these ports are 8-bit bi-directional ports. Except P0 which needs external pull-ups, rest of the
ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal
pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be
accessed individually. Port P0 and P2 are also used to provide low byte and high byte addresses,
respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like
serial communication, hardware interrupts, timer inputs and read/write operation from external
memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at
different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts. [2]
Preset
25
Fig.21 Preset
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit.
The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a
small screw driver or a similar tool. The resistance does not vary linearly but rather varies in exponential
or logarithmic manner. Such variable resistors are commonly used for adjusting sensitivity along with a
sensor. The variable resistance is obtained across the single terminal at front and one of the two other
terminals. The two legs at back offer fixed resistance which is divided by the front leg. So whenever only
the back terminals are used, a preset acts as a fixed resistor. Presets are specified by their fixed value
resistance. [2]
LCD
Fig.22 16x2 LCD
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of
applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and
circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons
being: LCDs are economical; easily programmable; have no limitation of displaying special & even
custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16
characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix.
This LCD has two registers, namely, Command and Data. The command register stores the command
instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like
initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on
the LCD. [2]
Software: We have implemented the circuit in Proteus software and program in embedded C language in
Keil software for simulation before implementing the circuit on breadboard. The hex file was loaded into
the microcontroller using Wilpro software.The PCB Design has been done using ORCAD software.
26
Fig.23 Circuit Diagram in Proteus
Fig.24 Password Door Lock implemented on breadboard
27
15.3 Source code
#include <reg51.h>
#define DATA P2
void lcd_init(void);
void lcd_cmd(unsigned char);
void lcd_display(unsigned char);
void Key_Scan(void);
void DelayMs(int);
void rr();
void ww();
sbit motor1=P1^0;
sbit motor2=P1^1;
sbit red=P1^2;
sbit green=P1^3;
sbit RS = P0^7;
sbit RW = P0^6;
sbit lcd_e = P0^5;
unsigned char R,C,ch,d=0xC1;
unsigned int i=0;
unsigned char Key[4][3] = {'1','2','3',
// KEYPAD
'4','5','6',
'7','8','9',
'*','0','#'};
code unsigned char msg[] = (" ENTER PASSWORD");
code unsigned char msg1[]= (" ACCESS GRANTED");
code unsigned char msg2[]= (" ACCESS DENIED");
unsigned char arr[5];
unsigned char car[5]={'1','2','3','4','5'};
void main()
// MAIN PROGRAM
{
int z,u;
u=0; motor1=0;motor2=0;red=1;green=0;
lcd_init();
DelayMs(1);
lcd_e=0;
lcd_cmd(0xC0);
for(z=0;z<5;z++)
{
Key_Scan();
DelayMs(1);
ch=Key[R][C];
arr[u]=ch;
DelayMs(1);
lcd_display('*');
lcd_cmd(d++);
DelayMs(10);
28
P3=0xFF;
u++;
}
if(arr[0]==car[0])
{
if(arr[1]==car[1])
{
if(arr[2]==car[2])
{
if(arr[3]==car[3])
{
if(arr[4]==car[4])
{
rr();
}
else
{
ww();
}
}
else
{
ww();
}
}
else
{
ww();
}
}
else
{
ww();
}
}
else
{
ww();
}
DelayMs(1);
}
void Key_Scan(void)
{
unsigned int i = 0;
P3 = 0x0F;
while(P3 == 0x0F);
if(P3 == 0x0E)
// ACCEPT KEY
29
R = 0;
else if(P3 == 0x0D)
R=1;
else if(P3 == 0x0B)
R = 2;
else if(P3 == 0x07)
R = 3;
P3 = 0xF0;
while(P3 == 0xF0);
if(P3 == 0xE0)
C = 0;
else if(P3 == 0xD0)
C = 1;
else if(P3 == 0xB0)
C = 2;
DelayMs(10);
}
void lcd_cmd(unsigned char cmnd)
// LATCH COMMAND
{
DATA = cmnd;
RS = 0;
RW = 0;
lcd_e = 1;
DelayMs(1);
lcd_e = 0;
}
void lcd_display(unsigned char dat)
// LATCH DATA
{
DATA = dat;
RS = 1;
RW = 0;
lcd_e = 1;
DelayMs(1);
lcd_e = 0;
}
void lcd_init(void)
//INITIALISE LCD
{
unsigned char i;
lcd_cmd(0x38);
DelayMs(1);
lcd_cmd(0x0E);
DelayMs(1);
lcd_cmd(0x01);
DelayMs(1);
lcd_cmd(0x80);
DelayMs(1);
i=0;
30
while(msg[i]!='\0')
{
lcd_display(msg[i]);
i++;
}
DelayMs(1);
}
void rr()
//DISPLAY "ACCESS GRANTED"
{
int t;
lcd_cmd(0X01);
DelayMs(1);
t=0;
while(msg1[t]!='\0')
{
lcd_display(msg1[t]);
t++;
}
motor1=1; red=0; green=1;
DelayMs(5);
motor2=0;motor1=0;
DelayMs(10);
motor2=1; motor1=0;
DelayMs(5);
}
void ww()
//DISPLAY "ACCESS DENIED"
{
int g;
lcd_cmd(0X01);
DelayMs(1);
g=0;
while(msg2[g]!='\0')
{
lcd_display(msg2[g]);
g++;
}
DelayMs(10);
}
void DelayMs(int k)
//DELAY FUNCTION
{
unsigned int a,b;
for(a=0;a<=k;a++)
for(b=0;b<1275;b++);
}
//END OF PROGRAMME
31
15.4 Precautions
1.
2.
3.
4.
Wires should be insulated properly in order to avoid short circuiting.
Connections should not be loose.
The supply to the driver IC should be provided separately to avoid overloading of voltage regulator.
Care should be taken that the voltage supply to the microcontroller should not exceed 5 Volts.
15.5 Recommendations
1. Enter password when cursor starts blinking.
2. Enter inside in given time.
32
Future Work
I will like to extend this project for real life. Sensors will be used to check wheatear a person has entered
or not. Doors will only be closed after complete entry of individual. If due to some reasons door is not able
to close after a given time then an alarm will be raised. The data of entry of an individual will be sent to a
control room. Also I am thinking to add thumb scanner which will generate a different one time password
for every different individual so as to make room highly secure.
33
List of Figures
1. To find value of a resistor
2. Half Wave Rectifier
3. Full Wave Rectifier
4. Bridge Rectifier
5. Voltage Regulator using Zener Diode
6. Regulated power supply
7. Transistor
8. Relay circuit with BJT
9. Relay circuit with MOSFET
10. Optocoupler
11. The combined circuit of relay and optocoupler
12. Dual Power supply
13. Regulated power supply circuit on breadboard and initial waveform
14. Waveform across 7805
15. Waveform across 7905
16. Voltage across resistor parallel to 7805
17. Voltage across resistor parallel to 7905
18. Voltage across capacitor before 7805
19. The wave smoothens as the value of capacitor increases
20. AT89C51
21. Preset
22. 16x2 LCD
23. Circuit Diagram in Proteus
24. Password Door Lock implemented on breadboard
34
List of Tables
1. Components used in rectifier
2. Observations of rectifier
3. Pinout of 7805
4. Pinout of 7905
5. Components used in experiment of transistor
6. Observations of transistor
7. Components used in experiment of relay with BJT
8. Observations of relay with BJT
9. Components used in experiment of relay with MOSFET
10. Observations of relay with MOSFET
11. Components used in experiment of optocoupler
12. Observations of optocoupler
13. Components used in experiment of combined circuit of relay and optocoupler
14. Observations of combined circuit of relay and optocoupler
15. Components used in project
35
References
1. www.wikipedia.com
2.
www.engineersgarage.com
3. www.allaboutcircuits.com
4. www.electronicstutorial.com
5. www.google.com