Microcontroller Based Digital Lock System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 40

Preface

Engineering is not only a theoretical study but it is an implementation of all we study for creating something new and making things more easy and useful through practical study. It is an art, which can be gained with systematic study, observation and practice. In the college curriculum we usually get the theoretical knowledge of industries and a little bit of implementation knowledge that how it works? But how can we prove our practical knowledge to increase the productivity or efficiency of the industry? To overcome such problem I the student of Govt. vit(east),jaipur am supposed to deliver a project on Microcontroller Based Digital Lock

System.

-1-

INTRODUCTION
Security is a prime concern in our day-to-day life. Everyone wants to be as much secure as possible. The building security is being designed to reduce the amount of stolen equipment from the building. As we know that theft and robbery are increasing day by day because manual lock are quit safe and easily be broken by the thief. So a new approach is needed to overcome the problem. It makes use of password for user authentication along with a locking system on the doors to allow entry authentication along with a locking system on the doors to allow entry only to authorized person. The doors open from the inside without authentication for compliance with fire codes and for an acceptable level of usability. For ease of application the authentication is transmitted wirelessly throughout the building from door unit to authentication unit. Digital lock is one of a way to solve this kind of problem. The microcontroller based digital lock for doors is an access control system control system that allows only authorized persons to access a restricted area. The system is fully controlled by the 6bit microcontroller AT89C51 which has a 4KB of ROM for the program memory. The password is stored in the microcontroller so that we can change it at any time. The person who wants to enter has to enter the correct password. Digital lock which incorporates a digital programmable micro processing interface capable of user programming whereby a programmed combination opens the lock. According to one embodiment of the lock, there can be as many as approximately 720 possible different combinations which may be entered by the user. The operation of the lock is driven by an electrical signal derived from the combination and that electrical signal is sent to a motor assembly inside the lock body in response to which there is a disengagement of a set of locking bar assistance of a springing mechanism causes the locking device to open automatically. The doors open from the inside without authentication for compliance with fire codes and for n acceptable level of usability.

-2-

Front Panel Diagram

-3-

Block Diagram

-4-

Overview of Project
In our project (Microcontroller Based Digital Door Lock) we are going to lock the door digitally in which a digital programmable micro processing inter face capable of user programming where by a programmed combination opens the lock. Here we use assembly language for coding in microcontroller IC 89C51. by using this circuit and coding we can also control the electrical equipments to turn ON and OFF for a fixed time. This project has two control sections which are microcontroller section and relay section.

Microcontroller Section:This section includes the coding of the circuit in which the codes or password is already stored in it which is known by the owner. This section also provides the delay timing and number of attempts which can further be changed any time in the programming.

Derive Section:This section includes a motor driven IC L293D. It will drive the motor in clockwise or in anticlockwise direction so that the door will open and closed respectively with the motion of the motor.

-5-

Circuit Diagram

-6-

Working
Power supply should always on for this device & connection of alarm is also required. Firstly enter the valid 6 bit digital codes with the help of 4X3 matrix keyboard. The LCD will not show the digit which will enter by the owner in place of the 6 bit code it will display (******), so can no one will see the code entered.

If we press a wrong digit then * button is there in the 4X3 matrix keyboard to change this particular digit. After entering the perfect code press # key which work as enter key to give the code. If the code is correct as the password stored in the microcontroller IC then the motor will turn on and this motor will rotate anticlockwise and hence the door will open. After a specific delay time the door will automatically closed.

If we dial a code which is not fully matched with code stored in the microcontroller IC, the LCD will display wrong code and a alarm will ringing. Near the micro controller one reset switch (a tactile switch) is given which will reset all the systems in digital door lock system or we say that a digitalized security system

-7-

List of Components Used


Quantity 1. Microcontroller IC 89C51 2. Motor Drive IC L293D 3. Regulator IC 7805 4. Crystal Oscillator 12 MHz 5. Bridge Rectifier 6. Transistor BC 547/548 NPN 7. 4 X 3 Matrix Keypad 8. 16 X 2 Matrix LCD Display 9. Resistors a. Preset 10K b. Resistor Array 10K c. 8.2K, 4.7K, 1K (Ceramic 10. Capacitors a. Electrolytic 33pf .01f b. Ceramic 10f 1000f 11. Transformer 12V (-6V to 6V) 12. Geared Motor 45 rpm 13. Buzzer 14. Tactile Switch 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

-8-

Details of Components
(1) Microcontroller IC 89C51
DESCRIPTION The 89C51/89C52/89C54/89C58 contains a non-volatile FLASH program memory that is parallel programmable. For devices that are serial programmable (In System Programmable (ISP) with a boot loader), see the 89C51RC+/89C51RD+ datasheet. Both families are Single-Chip 8-bit Microcontrollers manufactured in advanced CMOS process and are derivatives of the 80C51 microcontroller family. All the devices have the same instruction set as the 80C51.

FEATURES

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

80C51 Central Processing Unit On-chip FLASH Program Memory Speed up to 33 MHz Full static operation RAM expandable externally to 64 k bytes 4 level priority interrupt 6 interrupt 8-bit I/O ports Full-duplex enhanced UART Framing error detection Automatic address recognition Power control modes Clock can be stopped and resumed Idle mode Power down mode Programmable clock out Second DPTR register Asynchronous port reset Low EMI (inhibit ALE) 3 16-bit timers Wake up from power down by an external interrupt

-9-

Block Diagram of IC 89C51

- 10 -

Pin Diagram of IC 89C51

- 11 -

PIN DISCRIPTION
Ground: 0 V reference. Power Supply: This is the power supply voltage for normal, idle, and power-down operation. Port 0: Port 0 is an open-drain, bidirectional I/O port. Port 0 pins that have 1s written to them float and can be used as high-impedance inputs. Port 0 is also the multiplexed low-order address and data bus during accesses to external program and data memory. In this application, it uses strong internal pull-ups when emitting 1s. Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port 1 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins that are externally pulled low will source current because of the internal pull-ups. T2 (P1.0): Timer/Counter2 external count input/clock out (see Programmable Clock-Out). T2EX (P1.1): Timer/Counter2 reload/capture/direction control. Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. Port 2 pins that have 1s written to them 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 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 use 16-bit addresses. In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses port 2 emits the contents of the P2 special function register. Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 pins that have 1s written to them 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 because of the pull-ups. Port 3 also serves the special features of the 89C51/89C52/89C54/89C58, as listed below: RxD (P3.0): Serial input port TxD (P3.1): Serial output port INT0 (P3.2): External interrupt INT1 (P3.3): External interrupt T0 (P3.4): Timer 0 external input T1 (P3.5): Timer 1 external input WR (P3.6): External data memory writes strobe RD (P3.7): External data memory read strobe

- 12 -

Reset: A high on this pin for two machine cycles while the oscillator is running, resets the device. An internal diffused resistor to VSS permits a power-on reset using only an external capacitor to VCC. Address Latch Enable: Output pulse for latching the low byte of the address during an access to external memory. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency, and can be used for external timing or clocking. Note that one ALE pulse is skipped during each access to external data memory. ALE can be disabled by setting SFR auxiliary.0. With this bit set, ALE will be active only during a MOVX instruction. Program Store Enable: The read strobe to external program memory. When executing code from the external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. PSEN is not activated during fetches from internal program memory. External Access Enable/Programming Supply Voltage: EA must be externally held low to enable the device to fetch code from external program memory locations 0000H to the maximum internal memory boundary. If EA is held high, the device executes from internal program memory unless the program counter contains an address greater than 0FFFH for 4 k devices, 1FFFH for 8 k devices, 3FFFH for 16 k devices, and 7FFFH for 32 k devices. The value on the EA pin is latched when RST is released and any subsequent changes have no effect. This pin also receives the 12.00 V programming supply voltage (VPP) during FLASH programming. Crystal 1: Input to the inverting oscillator amplifier and input to the internal clock generator circuits. Crystal 2: Output from the inverting oscillator amplifier.

- 13 -

FLASH EPROM MEMORY


General Description The 89C51/89C52/89C54/89C58 FLASH reliably stores memory contents even after 100 erase and program cycles. The cell is designed to optimize the erase and programming mechanisms. In addition, the combination of advanced tunnel oxide processing and low internal electric fields for erase and programming operations produces reliable cycling. Features 1. FLASH EPROM internal program memory with Chip Erase 2. Up to 64 k byte external program memory if the internal program memory is disabled (EA = 0) 3. Programmable security bits 4. 100 minimum erase/program cycles for each byte 5. 10 year minimum data retention 6. Programming support available from many popular vendors. OSCILLATOR CHARACTERISTICS XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier. The pins can be configured for use as an on-chip oscillator. To drive the device from an external clock source, XTAL1 should be driven while XTAL2 is left unconnected. There are no requirements on the duty cycle of the external clock signal, because the input to the internal clock circuitry is through a divide-by-two flip-flop. However, minimum and maximum high and low times specified inthe data sheet must be observed. RESET A reset is accomplished by holding the RST pin high for at least two machine cycles (24 oscillator periods), while the oscillator is running. To insure a good power-on reset, the RST pin must be high long enough to allow the oscillator time to start up (normally a few milliseconds) plus two machine cycles. At power-on, the voltage on VCC and RST must come up at the same time for a proper start-up. Ports 1, 2, and 3 will asynchronously be driven to their reset condition when a voltage above VIH1 (min.) is applied to RESET. The value on the EA pin is latched when RST is disserted and has no further effect.

- 14 -

(2) Motor Derive IC L293D Introduction


One of the first realizations in robotics is that making something move isnt an easy task. You simply cant take a brain circuit and connect it to motor and expect anything to happen. The motor will simply say HAH! at the puny output signal from the brains, and stay stationary. What the brain needs is an enforcer. Muscle. Something to convince the motor to do things the way the brains want it to be done. There are many ways to strengthen (buffer) a signal so its strong enough to drive a large load like a motor. Transistors Hebrides circuit, buffer chips, and dedicated motor driving chips are all suitable candidates, with their own benefits and limitations. For our Secret motor driver, we wanted something that would take standard TTL (well, CMOS too) inputs and make a standard servo our slave. You see, standard servos use a Pulse Width Modulated (PWM) signal to tell a servo where to rotate to. PWM works by sending a rapid train of high/low signals to the servos regular driver brains, and depending on how different the high signal is from the low signal, the servo moves to the according position. PWM is great if you dont want to rotate much more than 180, which is fine for actuators, but not for driving wheels. With our Secret motor driver and a bit of servo hacking, were going to lobotomize and turn a standard servo into something more useful - a small, compact, powerful gear motor! Itll be something you can use very simple input signals to control its rotation. Well even throw in a 5V regulator hack if you want to clamp the voltage right at the servo. Or, modify it for use on a breadboard, which will make good use of the drivers indicator LEDs to show direction of rotation.

- 15 -

Description
The L293D is a 16-pin chip with a little notch cut out of the front of it (that last bit is for you non-experts). Orient the chip so its notch matches the notch in the shape of the chip on the PCB. Carefully drop the chip into the gold-plated (pretty uptown, eh?) pads, and solder it into place from the other side. To avoid any nasty punctures, clip off any excess pins that poke through the pads on the solder side.

Usage
So you want to know how to use it? It aint too difficult. Heres the long and short of it: Red Vcc (+) Blue - Gnd (-) (on the opposite side of the cable) Orange & Green - D1 & D2 (direction power flow of motor outputs) Yellow - Enable (turns the chip off - connect to gnd to turn it off). Connect the red (+) and blue (-) to power. Leave the yellow line alone, unless if you want to turn the chip off, or pulse it to slow the motor down (a technique called Pulse Width Modulation). Connect D1 to 5V, D2 to gnd, and the motor will turn one way. Connect D1 to gnd, and D2 to 5V, and the motor turns the way. Connect D1 D2 to either 5V or gnd, and the motor is in brake mode (try turning it - hard to do, eh?). Connect the yellow line to gnd, and it doesnt matter what D1 and D2 are connected to, as the motor is in coast mode, as if it werent connected to the motor driver board at all!

- 16 -

SGS Thompson Datasheet Characteristics Logic / Motor supply maximum voltage . . . . . . . . . . . . . . . . . . . . . . 4.5V to 36V Input & enable line voltage range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7V Peak output current (no repetitive), t <=100S (per 2 channels) . . . . . . . . . 2.4A Continuous output current (per 2 channels) . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2A Total continuous heat dissipation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4W Maximum switching frequency (ie: PWMapplications). . . . . . . . . . . . . . . . 5kHz

- 17 -

(3) Regulator IC 7805


Description Avoltage regulator (also called a regulator) with only three terminals appears to be a simple device, but it is in fact a very complex integrated circuit. It converts a varying input voltage into a constant regulated output voltage. Voltage regulators are available in a variety of outputs like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are designed for positive input. For applications requiring negative input, the LM79XX series is used. the pin configuration of a 5V 7805 regulator. The output voltage of a regulator circuit can be increased DR MAHESH N. JIVANI AND DR NIKESH A. SHAH S.C. DWIVEDI by using a pair of voltage-divider resistors. It is not possible to obtain a voltage lower than the stated rating. You cannot use a 12V regulator to make a 5V power supply, but you can use a 5V regulator to make a 12V supply. Voltage regulators are very robust. These can withstand over-current draw due to short circuits and also over-heating. In both cases, the regulator will cut off before any damage occurs. The only way to destroy a regulator is to apply reverse voltage to its input. Reverse polarity destroys the regulator almost instantly. The circuit for increasing the output voltage of a regulator circuit using a pair of voltage-divider resistors. Lets assume the value of R1 as 470 ohms, which means that a constant current of 10.6 mA will be available between terminals 2 and 3 of 7805. This constant current plus the regulator standby current of about 2.5 mA will flow through R2 to ground regardless of its value. Because of this constant 13.1mA current, R2 can now be set to a value that will give constant 7 volts across resistor R2. A resistor value of 533 or 510 ohms (standard value) will give the necessary 7 volts. With 5 volts across R1 and 7 volts across R2, a total of about 12 volts (regulated) will appear across terminal 2 and ground. If a variable resistor is used as R2, the output voltage can be easily fine-tuned to any value greater than 5 volts. The standby current will vary slightly in the regulator 7805, but 2.5 mA will yield good results in the calculations. If an exact voltage (within 0.3 volt) is needed, R2 must be a variable resistor. To make any fixed regulator adjustable, use the following formula: where Vout is the desired output voltage, Vfixed is the fixed voltage of the IC regulator (5 volts) and Istandby is the standby current of the0 regulator (2.5 mA). For resistor R1, use any value from 470 ohms to 1 kilo-ohm for best results. For variable resistor R2, put any value from the table given here for desired voltage operation the circuit of a 6V- 12V variable power supply using a 5V regulator. The 220V AC mains voltage is stepped down by transformer X1 to 9 volts, rectified by Pin configuration of 7805 regulator. Circuit for increasing the output voltage Circuit of variable power supply using a 5V regulator

- 18 -

Features
1. Output Current up to 1A 2. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V 3. Thermal Overload Protection 4. Short Circuit Protection 5. Output Transistor Safe Operating Area Protection

FIGURE 34 :VARIOUS ICS

- 19 -

(4) Crystal Oscillator 12 MHz Description


A simplified schematic of the oscillator circuit used in Chrontel products. Note that the typical 2-pin crystal has been replaced by its equivalent circuit model. Co is the pin-to-pin capacitance. Its value is associated with the crystal electrode design and the crystal holder. Rs is the motion resistance. Its value is specified by the crystal manufacturer. Cs is the motion capacitance and Ls is the motion inductance, which are not specified, and are functions of the crystal frequency. Rbias is a feedback resistor, implemented on-chip in Chrontel products, which provides DC bias to the inverting amplifier. C1 and C2 are total capacitance-to-ground at the input and output nodes of the amplifier, respectively. If external capacitance is not added, the values of the internal capacitance C1 and C2, including pin parasitic capacitance, are each approximately 15pF to 20pF.

- 20 -

Crystal Specifications
The reference frequencies for Chrontel's products are derived from an on-chip Pierce oscillator with an external crystal. The oscillator has been designed to function reliably with crystals that conform to the following specifications:

Series and Parallel Resonance


here is no such thing as a series cut crystal as opposed to a parallel cut crystal. The same crystal can be made to oscillate in series resonance mode or parallel resonance mode. The frequency of oscillation of a crystal is usually specified by the manufacturer as either the series resonance frequency or the parallel resonance frequency. A crystal can oscillate in series resonance, meaning that Ls is resonating with Cs, and the resonance frequency. Some oscillator circuits are designed for series resonance and the oscillation frequency shall equal the specified series resonance value. These series mode oscillators, however, are more sensitive to temperature and component variations. In fact, most crystals oscillators in today's ICs are of the parallel resonance type. The oscillation frequency of a parallel mode oscillator is always higher than fseries. The actual oscillation frequency of a parallel mode oscillator is dependent on the equivalent capacitance seen by the crystal. At parallel resonance, the crystal behaves inductively and resonates with capacitance shunting the crystal terminals. Depending on the application, especially in microprocessors where Pierce oscillators are used predominantly, a crystal manufacturer may specify parallel resonance frequency instead of series resonance frequency. Since fparallel is a function of the load capacitance Ceq, it should also be specified along with fparallel. For PC CPU clock and VGA clock applications, the frequency accuracy required is usually not very stringent and can easily be satisfied with a 14.318 MHz crystal that has been specified for operation in either series or parallel resonance modes.

- 21 -

Crystal Power Dissipation


This is one of the more important specifications for a crystal. In operation, if the power dissipated in the crystal exceeds the specified drive level, the crystal may have long term reliability problems. The oscillation frequency may shift from the desired value, and in extreme cases the crystal may crack and stop oscillating altogether. For the circuit, crystal dissipation is given by Using typical values for Rs, Ceq and V equals 5V, P equals approximately 876 W. Since increasing the value of C1 and C2 would result in increased power dissipation in the crystal, it is not recommended that extra capacitance be added to pins XTAL1 and XTAL2 of the clock chip unless it is absolutely necessary to tune the frequency to a desired value. In the case that additional capacitances are added, a crystal with a higher drive level should be chosen according to the above equation.

Pullability and Cs
Most crystal manufacturers do not specify Cs explicitly. However, one can measure Cs indirectly by measuring the change in frequency for a given change in load capacitance. Cs is related to the crystal pullability by the following equation. One can reduce the frequency of oscillation by adding external capacitance to C1 and C2 in equal amounts. The oscillation frequency is given by equation 2. Again, by increasing the value of C1 and C2, power dissipation of the crystal increases according to (4).

Oscillator Startup Time and PLL Lock Time


Oscillator start-up time is primarily a function of the size of the inverting amplifier. Measured oscillator startup time is about 1 ms for Chrontels clock chips. PLL lock time is a function of the PLL unity gain frequency and the frequency spanned in the measurement. Lock time for Chrontels PLL with internal loop filter is typically in the range of 5 to 20 ms for frequency to span from 0 Hz to 100 MHz. PLLs with external loop filters will have a longer lock time, depending on the external filter capacitor value. By adding the oscillator start-up time and PLL lock time, Chrontels clock chips typically reach their final stable frequency in less than 20 ms. In PC applications, this total start-up time is much less than the time required for the system to reach Power Good, which is well over 100 ms.

- 22 -

(5) Bridge Rectifier


A bridge rectifier can be made using four individual diodes, but it is also available in special packages containing the four diodes required. It is called a full-wave rectifier because it uses all the AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in the diagram below. Bridge rectifiers are rated by the maximum current they can pass and the maximum reverse voltage they can withstand (this must be at least three times the supply RMS voltage so the rectifier can withstand the peak voltages). Please see the Diodes page for more details, including pictures of bridge rectifiers. Alternate pairs of diodes conduct, changing over the connections so the alternating directions of AC are converted to the one direction of DC.

BRIDGE RECTIFIER

OUTPUT WAVEFORM

- 23 -

Smoothing
Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

OUTPUT WAVEFORM Note that smoothing significantly increases the average DC voltage to almost the peak value (1.4 RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value giving 1.4 4.6 = 6.4V smooth DC. Smoothing is not perfect due to the capacitor voltage falling a little as it discharges, giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. A larger capacitor will give fewer ripples. The capacitor value must be doubled when smoothing half-wave DC. Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output voltages. They are also rated by the maximum current they can pass. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs has 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. They include a hole for attaching a heatsink if necessary.

- 24 -

(6) Transistor BC 547/548 NPN

The transistor performs two basic functions. It acts as a switch turning current on and off. It acts as a amplifier. This makes an output signal that is a magnified version of the input signal. Transistors come in several sizes depending on their application. It can be a big power transistor such as is used in power applifiers in your stereo, down to a surface mount (SMT) and even down to .5 microns wide (I.E.: Mucho Small!) such as in a microprocessor or Integrated Circuit. NPN Transistor: Bipolar junction perform the function of amplifications where a small varying voltage or current applied to the base (the lead on the left side of the symbol) is proportionately replicated by a much larger voltage or current between the collector and emitter leads. Bipolar junction refers to sandwich construction of the semiconductor, where a wedge of "P" material is placed between two wedges of "N" material. In this NPN construction a small base current controls the larger current flowing from collector to emitter (the lead with the arrow). The useful dynamic range extends to 100 mA as a switch and to100 MHz as an amplifier.

Absolute Maximum Ratings

- 25 -

Electrical Characteristics

- 26 -

(7) 4 X 3 Matrix Key Board

Description
Once you add a keyboard for your system, you allow the user to input information to the microcontroller in real time. In this tutorial, you will learn how to connect a keyboard to your microcontroller and the basic principle to decode keyboard input. In general, keyboards are organized as a matrix of rows and columns; two side of this matrix are connected to Vcc through resistors while the third side is connected to the microcontroller port and configured as an output; and the last side is connected to the microcontroller port and configured as an input as shown in fig. 1. Microcontroller keep scanning the keyboard, when all inputs are high ("ones") that mean no key is pressed; if one bit is low ("zero") that mean there is a pressed key. System designer setup a Look-Up Table contain the ASCII code for each key, in this project we will use 16 keys to represent the hex number from 0 to F arranged according to keyboard arrangement. To detect which key is pressed; microcontroller ground all rows, then reads all columns, if all the columns=1's no key is pressed, if one columns=0 it's indicate that a key is pressed. To

- 27 -

identify the exact pressed key, microcontroller will start with the top row by grounding it; then read the columns. If the data read is all ones, no key that row activated, and the process will move to the next row, until reach the row that has a pressed key. At this stage, microcontroller knows the row that has a pressed key, and can setup the starting address in the look-up table for that row. The last step is finding the column that has a pressed key by rotating the columns bits; one bit at a time to locate a low bit, the most efficient way is rotating column bits through the carry flag by using RRC instruction. When the 0 bit found, microcontroller pulls the corresponding code from the look-up table. To be sure that no key is still down from the previous session, microcontroller send 0's to all rows at on time and check the columns, if all columns are high then the normal scanning start, otherwise, it will wait until all columns become high. At the left, you will find the assembly code for scanning 4x4 keyboards, assuming that the input data will be a hex number form 0 to F, ports P1.0 to P1.3 of the 8051 microcontroller connected to rows, P2.0 to P2.3 connected to columns. The pressed key ASCII code will be stored in A. At the right is the flowchart that describes the code

- 28 -

(8) 16 X 2 LCD Display

- 29 -

Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Symbol GND Vcc VEE RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7

I/O I I I/O I/O I/O I/O I/O I/O I/O I/O I/O

Description Ground +5V power supply Contrast control command/data register selection write/read selection Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus

Vcc, Vss, and VEE While Vcc and Vss provide +5V and ground, respectively, VEE is used for controlling LCD contrast. RS - register select: There are two very important registers inside the LCD. The RS pin is used for their selection as follows. If RS = 0, the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc. If RS = 1 the data register is selected, allowing the user to send data to be displayed on the LCD. R/W - read/write:

- 30 -

R/W input allows the user to write information to the LCD or read information from it. R/W = 1 when reading; R/W =0 when writing. E - enable: The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide. D0 D7: The 8 bit data pins, D0 D7, are used to send information to the LCD or read the contents of the LCDs internal registers. To display letters and numbers, we send ASCII codes for the letters A Z, a z, and numbers 0 9 to these pins while making RS = 1. There are also instructions command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. Table below lists the instruction command codes. Code (hex) 1 2 4 5 6 7 8 A C E F 10 14 18 1C 80 C0 38 Command to LCD Instruction Register Clear display screen Return home Shift cursor to left Shift display right Shift cursor to right Shift display left Display off, Cursor off Display off, Cursor on Display on, cursor off Display on, cursor blinking Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to the left Shift the entire display to the right Force cursor to beginning of 1st line Force cursor to beginning of 2nd line 2 lines and 5x7 matrix

We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W =1 and RS = 0, as follows: if R/W =1, RS =0. When D7 = 1(busy flag = 1), the LCD busy taking care of internal operations and will not accept any new information. When D7 = 0, the LCD is ready to receive new information. Note: It is recommended to check the busy flag before writing any data to the LCD.

(9)
- 31 -

Resistors
There are three resistors of ceramic type is used in this system i.e. 8.2K, 4.7K & 1K. According to the circuit requirements we used these resistors in the circuit. One with Microcontroller in the reset mechanism. A preset of 10K is also used in the circuit which is used to control the intensity of the words display on the LCD display. A resistor array is used with the output port of the microcontroller used in the LCD data cable is used to make low signal high at the output. This array is of 10K i.e. 10K resistance each.

(10) Capacitors
In this system we used two types of capacitors one is ceramic type and another is electrolytic type. In ceramic type we used two 33pf and two .01f capacitors. .01f capacitors are used with regulator IC as standard circuit components. 33pf capacitors are used with Crystal Oscillator. In electrolytic type we used 10f and 1000f capacitors. 1000f capacitor is used as filter capacitor. 10f capacitor is used with microcontroller IC.

(11) Transformer
In this circuit we used a transformer which is step down type of 12Vpp (i.e. -6V 0 6V). Because we used a mains power supply for our project so that we need 12V dc to operate our project, so thats why we used this transformer.

(12)
- 32 -

Geared Motor

Specifications
High efficiency, high quality low cost DC motor with gearbox for robotics applications. Very easy to use and available in standard size. Nut and threads on shaft to easily connect and internal threaded shaft for easily connecting it to wheel.

Features
45 RPM 12V DC motors with Gearbox 5kgcm torque 3000RPM base motor 6mm shaft diameter with internal hole 125gm weight Same size motor available in various rpm No-load current = 60 mA(Max), Load current = 300 mA(Max)

(13) Buzzer
It is simple buzzer which is used in vehicles as a side indicator. It is look like as follows And operates at 5V via transistor output.

- 33 -

(14) Tactile Switch


It is a push switch which is used to reset the whole system it is place between the Vcc supply and the reset pin of the microcontroller. It will directly reset the reset pin when the user required the dimensional representation of the switch is shown here as follows.

- 34 -

Soldering & Soldering Procedure


Soldering off by ensuring that all parts you are connecting are clean from dirt and grease also ensure that the mechanical connection are secure before you apply solder and the parts should not be able to move in relation to each other. Another important point to note is that parts of the joint to be made must be the same temperature. To actually solder a joint first apply heat by applying the top of the soldering iron against the thing you are joining immediately apply solder to the point where the iron is contacting. Remember you should be heating the joints not the solder. Feed solder only until there is enough to fill the gap and leave s slight swell. Dont apply too much solder as it can overflow into other place and cause short circuit. Remove the solder and the iron smoothly. The whole process should only take two or three second at most avoid touching the joint until it is cooled A good solder joint will look shiny and smooth while bad joint always starts from scratch. Remove the solder you just put on and clean the surface before you start the process again.

- 35 -

Programming Flow Chart

- 36 -

- 37 -

FEATURES
1. You can control up to 14 devices. It may be any electric or electronic appliances or devices with simple to heavy appliances. Each device is given a unique code. 2. It makes accurate switching; any false switching will not open the door. 3. This circuit require microcontroller IC, so any one with little knowledge of programming can construct this circuit. 4. This system reads the entered password which is already present in programming of microcontroller IC and than open the door. 5. This circuit switches OFF after a delay time (you can change this Time in programming of IC). 6. Before changing the state of the device we can confirm the present status of the device. 7. This circuit gives an acknowledgement tone after switching ON the devices to confirm the status of the device. 8. You can control devices from local telephone. It can also be controlled by mobile.

- 38 -

ADVANTAGES
1. THERE IS NO NEED OF ANY TYPE OF HARMFUL RADIATIONS. 2. NO NEED OF LIGHT SOURCE LIKE AS LASER. 3. THERE IS NO PROBLEM OF RANGE. 4. THER IS NO NEED OF SPECIFIED PHONE , WE CAN USE EITHER MOBILE OR BASIC PHONE. 5. BY USING THIS WE CAN ALSO DETECT THE STATUS OF CONNECTED DEVICES. 6. HERE WE USED DIFFERENT KEYS FOR SIGNALING PURPOSE BY WHICH WE CAN TRANSMIT ADDITIONAL INFORMATION. 7. THERE IS NO NEED OF EXTERNAL CLOCK BECAUSE THIS HAS IN BUILT CLOCK. 8. HERE WE HAVE DISPLAY UNIT ALSO. 9. BY USING THIS WE CAN SAVE MONEY.

DRAWBACKS
1. Easily accessed by person who knows the password of lock which is already present in the programming. 2. This is entirely depend on mobile or telephone network. 3. Power supply for local control circuit should always on either circuit is in working condition or not.

- 39 -

CONCLUSION
This project is very useful in organizations where a particular device or system is needed to be confined to only a few people so that the security of the organization is maintained. Our project which enables the users to prevent the misuse of the device or system. This project is made for users and one administrator; parting them no one else will be able to use the device of 220V. User has his own password. The device is always available for authentic user. users can enable the system. Now when a user wishes to make a device run, he will have to give the particular password accepting which the system will enable him to make a use. In case the user gives a wrong password three times, the system will display access denied and start buzzing so user will know that someone is trying to misuse the device. The administrator only can change the password. This project is also useful at homes where one does not want their children or servants to unnecessarily use the device of 220V.

APPLICATION
Used for security of high professionals computer. This device can also used for security of person by attaching this device at home. This device can provide security of any system or instrument which work on 220v (ac). It can be used in the homes also for locking of television so that children cannot use it without permission

- 40 -

You might also like