PROJECT Report On Digital Code Lock
PROJECT Report On Digital Code Lock
PROJECT Report On Digital Code Lock
Apart from the efforts of me, the success of this project depends largely on the encouragement and guidance of many others. I take this opportunity to express my gratitude to the people who have been instrumental in the successful completion of this project. I would like to show my greatest appreciation to Er.Vishu rover from Innovation !esearch and "evelopment. I can#t say thank you enough for their tremendous support and help. I feel motivated and encouraged every time. $ithout their Encouragement and have materiali%ed. &he guidance and support received from my friend 'name( who contributed and are contributing to this project, was vital for the success of the project. I am grateful for their constant support and help. uidance this project would not
DECLARATION $e hereby declare that the project work entitled ')!obotic Arm*( is an authentic records of my own work carried out at innovation research and "evelopment. Internship +roject for the award of "egree of ,.&E-./E-E, 'college name( under the guidance of VI0.1 !2VE!, during 3uly to "ecember 4565
A,0&!A-&
0ecurity is a prime concern in our day/today life. Everyone wants to be as much secure as possible. An access control for doors forms a vital link in a security chain. &he microcontroller based "oor locker is an access control system that allows only authori%ed persons to access a restricted area. &he system is fully controlled by the 9 bit microcontroller A&9:-45;6 which has a 4<bytes of !2= for the program memory. &he password is stored in the E+!2= so that we can change it at any time. &he system has a <eypad by which the password can be entered through it. $hen the entered password e>uals with the password stored in the memory then the relay gets on and so that the door is opened. If we entered a wrong password for more than three times then the Alarm is switched on. $hen we go inside and come back then the microcontroller will sense the person using the ?aser light, the microcontroller will automatically open the door for you
SUMMARY:
An electronic lock is a device which has an electronic control assembly attached to it. &hey are provided with an access control system. &his system allows the user to unlock the device with a password. &he password is entered by making use of a keypad. &he user can also set his password to ensure better protection. &he major components include a keypad, ?-" and the controller A&9:-;6 which belongs to the 95;6 series of microcontrollers. &his article describes the making of an electronic code lock using the 95;6 microcontroller.
I7&!2"1-&I27
)+assword ,ased "oor 0ecurity 0ystem using =icrocontroller* is used in the places where we need more security. It can also used to secure lockers and other protective doors. &he system comprises a number keypad and the keypads are connected to the 9 bit microcontroller A&9:-45;6. &his is one of the popular =icrocontroller. It has only 45 pins and there are 6; input@output lines. &he microcontroller has a program memory of 4 <ilobytes. &he microcontroller continuously monitor the keypad and if somebody enters the password it will check the entered password with the password which was stored in the memory and if it they are same then the microcontroller will switch on the corresponding device. &he system will allow the person who knows the password and it will not allow who don#t know the password and the system will also show the persons who try to break the protection barrier. =ain concept behind this project is of a door/latch opening using a password entered through keypad. As well as sending this data to a computer through serial port. 1ser can change this password anytime he@she wish using a keypad.
It mainly consists of following blocks 6. =icrocontroller8 &his is the -+1 'central processing unit( of our project. $e are going to use a microcontroller of 95;6 family. &he various functions of microcontroller are like8 I. !eading the digital input from <eypad II. 0ending this data to ?-" so that the person operating this project should read the password III. 0ensing the password using keypad and to check whether it is a correct password or a wrong password and rotate the stepper motor if the password entered is a correct password. IV. 0ending the data to the computer using serial port. &his data consist of the status of entered password '-orrect@wrong( 4. ?-"8 $e are going to use 6Ax4 alphanumeric ?i>uid -rystal "isplay '?-"( which means it can display alphabets along with numbers on 4 lines each containing 6A characters.
B. +- Interfacing8 $e are going to use max 4B4 I- for pc interfacing, the values of number of persons inside the room and the status of entered password '-orrect@wrong( will be sent to pc. C. <eypad8 1ser will enter the password using the keypad. Various keys of keypad are as following, I. 5 to : II. Enter III. Escape -entral +rocessing 1nit &he -+1 is the brain of the microcontrollers reading userDs programs and executing the expected task as per instructions stored there in. Its primary elements are an 9 bit Arithmetic ?ogic 1nit 'A?1(, Accumulator 'Acc(, few more 9 bit registers, , register, 0tack +ointer '0+(, +rogram 0tatus $ord '+0$( and 6A bit registers, +rogram -ounter '+-( and "ata +ointer !egister '"+&!(. &he A?1 'Acc( performs arithmetic and logic functions on 9 bit input variables. Arithmetic operations include basic addition, subtraction, multiplication and division. ?ogical operations are A7", 2!, Exclusive 2! as well as rotate, clear, complement and etc. Apart from all the above, A?1 is responsible in conditional branching decisions, and provides a temporary place in data transfer operations within the device. , register is mainly used in multiply and divide operations. "uring execution, , register either keeps one of the two inputs and then retains a portion of the result. Eor other instructions, it can be used as another general purpose register.
Timers/Counters 95;6 has two 6A bit &imers@-ounters capable of working in different modes. Each consists of a F.ighD byte and a F?owD byte which can be accessed under software. &here is a mode control register and a control register to configure these timers@counters in number of ways.&hese timers can be used to measure time intervals, determine pulse widths or initiate events with one microsecond resolution upto a maximum of A; millisecond 'corresponding to A;, ;BA counts(. 1se software to get longer delays. $orking as counter, they can accumulate occurrences of external events 'from "- to ;55<.%( with 6A bit precision. In our project we are using 9 bit microcontroller A&9:-45;6, it is the advanced 9 bit microcontroller from A&=E?, which incorporates Elash !om, and &imer etc.
Description:
A CxB matrix keypad and a 6Ax4 ?-" have been used here. <eypad and ?-" are very commonly used input G output devices, respectively. A four digit predefined password needs to be specified the user. &his password is stored in the system. $hile unlocking, if the entered password from keypad matches with the stored password, then the lock opens and a message is displayed on ?-". Also an output pin is made high to be used for further purpose. &he connections in the circuit are as following8 port +4 of microcontroller A&9:-;6 is used as data input port which is connected to data pins 'H/6C( of ?-". +BI5, +BI6 and +BI4 pins of microcontroller are connected to control pins !0, !$ and E7 of ?-". +ort +5 is used to take input from keypad. +5IH has been used as lock output pin of controller. As the program starts, string JEnter +assword# is displayed on ?-". &he keypad is scanned for pressed digits one by one. Every time, row and column of the key pressed is detected and a JK# is displayed on ?-" corresponding to the entered number. After the four digits are entered, the user is prompted to J-onfirm +assword# and again the input is taken through ?-". If the passwords do not match, a message is displayed to indicate J$rong +assword#L otherwise the user is prompted to unlock the device. &o unlock, user needs to JEnter +assword# through keypad. Again the keypad is scanned for pressed keys and corresponding digits are identified. &he passkey is displayed as JKKKK# on the ?-" screen. After the four digits are entered, they are compared with the pre/set password. If all the four digits match with set password, ?-" displays J?ock 2pen# and the lock output pin goes high. If the security code is wrong, J$rong +assword# is sent to be displayed on ?-". &he system gets locked if more than three attempts are made with wrong password to open the electronic lock. &he system needs to be reset in such a case.
Sc em!tic Di!"r!m
Components:
+reset A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. &he resistance is varied by adjusting the rotary control over it. &he adjustment can be done by using a small screw driver or a similar tool. &he resistance does not vary linearly but rather varies in exponential or logarithm...
1,039-Reads
A&9:-;6 or 9:-;6 microcontroller A&9:-;6 is an 9/bit microcontroller and belongs to AtmelDs 95;6 family. A&9:-;6 has C<, of Elash programmable and erasable read only memory '+E!2=( and 649 bytes of !A=. It can be erased and program to a maximum of 65...
3,331-Reads
?-" ?-" '?i>uid -rystal "isplay( screen is an electronic display module and find a wide range of applications. A 6Ax4 ?-" display is very basic module and is very commonly used in various devices and circuits. &hese modules are preferred over seven segments and other multi segment ?E"s. &he reasons being8 ?-"s are economicalL easily programmableL have no limitation of displaying special G even...
1,701-Reads
COM#ONENTS DETAILS
Resistor !esistor is a component that resists the flow of direct or alternating electric circuit. !esistors can limit or divide the current, reduce the voltage, protect an electric circuit, or provide large amounts of heat or light. An electric current is the movement of charged particles called electrons from one region to another. !esistors are usually placed in electric circuits. C!p!citor
-apacitor or electric condenser is a device for storing an electric charge. &he simplest form of capacitor consists of two metal plates separated by a non touching layer called the dielectric. $hen one plate is charged with electricity from a direct current or electrostatic source, the other plate have induced in it a charge of the opposite signL that is, positive if the original charge is negative and negative if the original charge is positive. &he electrical si%e of the capacitor is its capacitance. -apacitors are limited in the amount of electric charge they can absorbL they can conduct direct current for only instances but function well as conductors in alternating current circuits. Eixed capacity and variable capacity capacitors are used in conjunction with coils as resonant circuits in radios and other electronic e>uipment. -apacitors are produced in a wide variety of forms. Air, =ica, -eramics, +aper, 2il, and Vacuums are used as dielectrics depending on the purpose for which the device is intended. Tr!nsistor &ransistor is a device which transforms current flow from low resistance path to high resistance path. It is capable of performing many functions of the vacuum tube in electronic circuits, the transistor is the solid state device consisting of a tiny piece of semi conducting material, usually germanium or silicon, to which three or more electrical connections are made. Dio$e "iode is a electronic device that allows the passage of current in only one direction. &he first such devices were vacuum/tube diodes, consisting of an evacuated glass or steel envelope containing two electrodes M a cathode and an anode. &he diodes commonly used in electronic circuits are semiconductor diodes. &here are different diodes used in electronic circuits such as 3unction diode, Nener diode, +hoto diodes, and tunnel diode. Inte"r!te$ Circuits Timer IC %&&&' :( &he ?=;;; is a highly stable device for generating accurate time delays or oscillation. Additional terminals are provided for triggering or resetting if desired. In the time delay mode of operation, the time is precisely controlled by one external resistor and capacitor. Eor astable operation as an oscillator, the free running fre>uency and duty cycle are accurately controlled with two external resistors and one capacitor. &he circuit may be triggered and reset on falling waveforms, and the output circuit can source or sink up to 455mA or drive &&? circuits.
Re"u)!tor IC '?= H95;( &he ?=H95; monolithic B/terminal positive voltage regulators employ internal current/limiting, thermal shutdown and safe/area compensation, making them essentially indestructible. If ade>uate heat sinking is provided, they can deliver over 6.5A output current. &hey are intended as fixed voltage regulators in a wide range of applications including local 'on/card( regulation for elimination of noise and distribution problems associated with single/point regulation. Re)!* Dri+er %ULN ,--.' &he 1?7455B are high voltage, high current darlington arrays each containing seven open collector darlington pairs with common emitters. Each channel rated at ;55mA and can withstand peak currents of A55mA. 0uppression diodes are included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout. EE#ROM %AT,/C-,' &he A&4C-54 provides 45C9 bits of serial electrically erasable and programmable read/only memory 'EE+!2=( organi%ed as 4;Awords of 9 bits each. &he device is optimi%ed for use in many industrial and commercial applications where low/power and low/voltage operation are essential.
Ke*p!$ Inter0!cin"
<eypads are a part of .=I or .uman =achine Interface and play really important role in a small embedded system where human interaction or human input is needed. =artix keypads are well known for their simple architecture and ease of inter0!cin" 1it any microcontroller. In this part of tutorial we will learn how to interface a CxC matrix 2e*p!$ 1it AV! and 3-&4 microcontroller. Also we will see how to program then in Assembly and -.
-onstructing a =atrix Ke*p!$ -onstuction of a 2e*p!$ is really simple. As per the outline shown in the figure below we have four rows and four columns. In between each overlapping row and column line there is a key.
0o keeping this outline we can constuct a 2e*p!$ using simple 0+0& 0witches as shown below8
7ow our 2e*p!$ is ready, all we have to do is connect the rows and columns to a port of microcontroller and program the controller to read the input. 0canning a =atrix Ke*p!$ &here are many methods depending on how you connect your 2e*p!$ 1it your controller, but the basic logic is same. $e make the coloums as i@p and we drive the rows making them o@p, this whole procedure of reading the keyboard is called scanning. In order to detect which key is pressed from the matrix, we make row lines low one by one and read the coloums. ?ets say we first make !ow6 low, then read the columns. If any of the key in row6 is pressed will make the corrosponding column as low i.e if second key is pressed in !ow6, then column4 will give low. 0o we come to know that key 4 of !ow6 is pressed. &his is how scanning is done.
0o to scan the 2e*p!$ completely, we need to make rows low one by one and read the columns. If any of the button is pressed in a row, it will take the corrosponding column to a low state which tells us that a key is pressed in that row. If button 6 of a row is pressed then -olumn 6 will become low, if button 4 then column4 and so on...
?-" I7&E!EA-I7
Most projects you create with the 8051 CPU require some form of display. The most common way to accomplish this is with the C! " iquid Crystal !isplay#. to )0 characters %y 1 to * lines. C!s ha$e %ecome a cheap and easy way to &et te't display for an em%edded system Common displays are set up as 1(
UNDERSTANDING LCD
#inout
+ 8 data pins D7:D0 ,i-directional data.command pins. /lphanumeric characters are sent in /0C11 format. + RS: Register Select 20 3 0 -4 Command 2e&ister is selected 20 3 1 -4 !ata 2e&ister is selected + R/W: Read or Write 0 -4 5rite6 1 -4 2ead + E: Enable (Latch data) Used to latch the data present on the data pins. / hi&h-to-low ed&e is needed to latch the data. + VEE : contrast control 78T9: 5hen writin& to the display6 data is transferred only on the hi&h to low transition of this si&nal. ;owe$er6 when readin& from the display6 data will %ecome a$aila%le shortly after the low to hi&h transition and remain a$aila%le until the si&nal falls low a&ain.
1n the a%o$e memory map6 the area shaded in %lac= is the $isi%le display ">or 1(') display# . >or first line addresses for first 15 characters is from 00h to 0>h. ,ut for second line address of first character is *0h and so on up to *>h for the 1(th character.
0o if you want to display the te't at specific positions of C! 6 we require to manipulate address and then to set cursor position accordin&ly .
Re"isters
The ;!**@80 has two 8-%it re&isters6 an instruction re&ister "12# and a data re&ister "!2#. The 12 stores instruction codes. The !2 temporarily stores data to %e written into !!2/M or C?2/M and temporarily stores data to %e read from !!2/M or C?2/M. !ata written into the !2 is automatically written into !!2/M or C?2/M %y an internal operation. . These two re&isters can %e selected %y the re&ister selector "20# si&nal. 0ee the ta%le %elow:
Register Selection !0 0 0 1 1 !@$ 2peration 0 1 0 1 12 write as an internal operation "display clear6 etc.# 2ead %usy fla& "!,@# and address counter "!,0 to !,(# !2 write as an internal operation "!2 to !!2/M or C?2/M# !2 read as an internal operation "!!2/M or C?2/M to !2#
LCD Co!!ands
The C!As internal controller accept se$eral commands and modify the display accordin&ly. These commands would %e thin&s li=e: B Clear screen B 2eturn home
Instr"ction >unction set "8-%it interface6 ) lines6 5<@ Pi'els# >unction set "8-%it interface6 1 line6 5<@ Pi'els# >unction set "*-%it interface6 ) lines6 5<@ Pi'els# >unction set "*-%it interface6 1 line6 5<@ Pi'els# 9ntry mode set 0croll display one character ri&ht "all lines# 0croll display one character left "all lines# ;ome "mo$e cursor to top.left character position# Mo$e cursor one character left Mo$e cursor one character ri&ht Turn on $isi%le underline cursor Turn on $isi%le %lin=in&-%loc= cursor Ma=e cursor in$isi%le ,lan= the display "without clearin&# 2estore the display "with cursor hidden# Clear 0creen 0et cursor position "!!2/M address# 0et pointer in character-&enerator 2/M "C? 2/M address# Entry !ode set
This command sets cursor mo$e direction and display shift 87.8>>. There are * possi%le function set commandsE0*6 056 0(6 and 0@. This command chan&es the direction the cursor mo$es %y settin& the address counter to increment or decrement. This command is $ery important. 1f you do not understand it you may not see anythin& or what you actually wanted to see on C! screen. 1 ha$e created * animated &ifs to demonstrate what the function set command is all a%out. Set c"rsor position (DDRAM address) /s said earlier if we want to display the te't at specific positions of C! 6 we require to manipulate address and then to set cursor position accordin&ly. 1 want to display FM/;90;F in messa&e F;i M/;90;F at the ri&ht corner of first line then 1 should start from 10th character. 0o referrin& to ta%le 80hD0/h3 8/h.
&he CCH95 standard re>uires B control lines as well as either C or 9 I@2 lines for the data bus. &he user may select whether the ?-" is to operate with a C/bit data bus or an 9/bit data bus. If a C/bit data bus is used, the ?-" will re>uire a total of H data lines.If an 9/bit data bus is used, the ?-" will re>uire a total of 66 data lines.&he three control lines are EN, RS, and RW
1f the C! ne$er come out from F%usyF status %ecause of some pro%lems 6The pro&ram will Fhan&6F waitin& for !,@ to &o low. 0o in a real applications it would %e wise to put some =ind of time limit on the delay--for e'ample6 a ma'imum of 100 attempts to wait for the %usy si&nal to &o low. This would &uarantee that e$en if the C! hardware fails6 the pro&ram would not loc= up.
C&DE E$AM+LE
1t is easy "and clean tech. # to ma=e different su%routines and then call them as we need.
,"sy la- chec.inready: set% P1.@ E!@ as input clr PC.( E2030 cmd
Data /rite Ro"tine data: mo$ P16 / Emo$e acc. data to port set% PC.( E2031 data
set% PC.5 E2531 for read again: set% PC.@ E;-4 pulse on 9 clr PC.@ j% P1.@6 a&ain ret
clr PC.5 E2530 for write set% PC.@ E;-4 pulse on 9 clr PC.@ lcall ready ret
Initiali0ation initiali0ation1 mo$ /6 HC8; E 1nitialiIe6 )-lines6 5J@ matri'. lcall Command mo$ /6 H09; E C! on6 cursor on lcall Command mo$ /6 H01; E Clear C! 0creen lcall Command mo$ /6 H0(; E 0hift cursor ri&ht lcall Command
Display clear clear: set% pC.@ Eena%le 97 clr C.( E2030 for cmd. mo$ !/T/6H01h clr pC.@ Edisa%le 97 lcall ready 29T 7ote- /s we need to clear the C! frequently and not the whole initialisation 6 it is %etter to use this routine separately.
etKs now try code for displayin& te't at specific positions. 1 want to display FM/;90;F in messa&e F;i M/;90;F at the ri&ht corner of first line then 1 should start from 10th character.
SSE!"L# L $%& %E
lcall 1nitialiIation lcall clear mo$ a6HK;K lcall data mo$ a6HK1K lcall data
'o( a)*8ah lcall co''and mo$ a6HKMK lcall data mo$ a6HK/K lcall data mo$ a6HK;K lcall data mo$ a6HK9K lcall data mo$ a6HK0K lcall data mo$ a6HK;K lcall data
Leil de$elopment tools for the 8051 Microcontroller /rchitecture support e$ery le$el of software de$eloper from the professional applications en&ineer to the student just learnin& a%out em%edded software de$elopment. The industry-standard Leil C Compilers6 Macro /ssem%lers6 !e%u&&ers6 2eal-time Lernels6 0in&le-%oard Computers6 and 9mulators support all 8051 deri$ati$es and help you &et your projects completed on schedule.
The Leil 8051 !e$elopment Tools are desi&ned to sol$e the comple' pro%lems facin& em%edded software de$elopers. 5hen startin& a new project6 simply select the microcontroller you use from the !e$ice !ata%ase and the MNision 1!9 sets all compiler6 assem%ler6 lin=er6 and memory options for you. 7umerous e'ample pro&rams are included to help you &et started with the most popular em%edded 8051 de$ices. The Leil MNision !e%u&&er accurately simulates on-chip peripherals "1OC6 C/76 U/2T6 0P16 1nterrupts6 1.8 Ports6 /.! Con$erter6 !./ Con$erter6 and P5M Modules# of your 8051 de$ice. 0imulation helps you understand hardware confi&urations and a$oids time wasted on setup pro%lems. /dditionally6 with simulation6 you can write and test applications %efore tar&et hardware is a$aila%le. 5hen you are ready to %e&in testin& your software application with tar&et hardware6 use the M87516 M87CP06 M87/!16 or >lashM8751 Tar&et Monitors6
Tool 8$er$iew
the 10!51 1n-0ystem !e%u&&er6 or the U 17L U0,-QT/? /dapter to download and test pro&ram code on your tar&et system
Re0erences
P6Q =a%idi =.A., =c<inlay !.". and -ausey "., )+I- =icrocontroller and Embedded, 1sing Assembly and - for +I-69*, 6st ed., +rentice/.all, 455A P4Q 0edra A.0. and 0mith <.-., )=icroelectronic -ircuits*, ;th ed., 4559 PBQ =... !ashid, )+ower Electronics8 -ircuits, "evices and Applications,* Brd Edition, 455C. +earson Education, Inc PCQ "orin 2. 7eacsu, )+ower 0witching -onverters*, 455A by &aylor G Erancis roup, ??P;Q 0imone ,uso and +aolo =attavelli,*"igital -ontrol in +ower Electronics*, 455A by =organ G -laypool PAQ,imal .<. ,ose, )=odern +ower Electronics and A- "rives,* 4554, +earson Education PHQ 7. =ohan &. =. 1ndeland and $. +. !obbins, )+ower Electronics8 -onverters, P9Q =uhammad .. !ashid, )+ower Electronics .andbook8 "evices, -ircuits and Applications*, 4nd Edition, Academic +ress, 7ew Rork, 455A. P:Q http8@@en.wikipedia.org@wiki@,uckSconverter P65Q http8@@en.wikipedia.org@wiki@battery'electrical( P66Q +roteus V0= official website, http8@@www.labcenter.co.uk P64Q --0 -ompiler official website, http8@@www.ccsinfo.com@ P6BQ =icrochip official website, http8@@www.microchip.com@