One Time Programmable Password Lock using EMBEDDED

Locking and unlocking any device (or system) like locker, cupboard, automatic door, suitcase etc with the help of password is most widely used technique for providing secured access. Only the authorized person - who knows the password, can lock or unlock the system. Once device is locked, if any other person tries to unlock it and enters wrong password then system gives ALERT message or warning (or something like that).
The general operation for password lock system is
·         The system is locked by entering correct password
·         It can be unlocked by entering correct password
·         If wrong password is entered then system will not be locked or unlocked and system shows warning
·         If anyone tries to enter wrong password again and again, system becomes inactive (HANG) so that further attempts to enter password can be prohibited

There are two different varients in this system
  1. Factory programmed passward: The password is default – factory programmed. It can not be set or changed. To lock or unlock system user has to enter that default password everytime. He/she can not set his own password
  2. User Programmable password: the password can be set or changed. User can set his own password. In this type also there are two different varients. In one type password can be set or changed many times and in other type password can be set by user only once – that is called  one time programmable password system
Here the given project demonstrates one time programmable password system using micro controller AT89C51. The system has default password initially that can be changed only once. User can set his own 5 digit password once. Afterword password set button is disabled. User has to enter correct password to lock or unlock the system. Also user gets only three attempts to enter correct password. If he enters wrong password thrice, the complete system hangs. No furthur operation is possible. The only way is to press master reset
Circuit description
(Check the circuit diagram tab for complete circuit for one time programmable Password Lock)
·         The 4x3 keypad is connected to PORT3. 4 rows are connected to P3.4 – P3.7 and 3 columns are connected to P3.0 – P3.2. the keypress event is detected using row-column scanning
·         Four LEDs – two red and two green are connected to PORT2 pins P2.0 – P2.3 such that LED turns ON when pin is high
·         One buzzer is connected to pin P2.5 through npn transistor connected in switch configuration. It generates beep sound when pin is high for moment
·         Pin P2.4 drives single change over type relay through another npn type transistor. Setting pin high/low will switch ON/OFF the relay
·         Data pins D0-D7 of LCD are connected with PORT0. Control pins Rs and En are connected with pins P2.7 and P2.6 respectively. RW pin is connected to ground. One 1K pot is connected to VEE pin (3) to control LCD brightness
·         A 12 MHz crystal with two 22 pF capacitors is connected with crystal terminals as shown
·         One reset pushbutton in parallel with 0.1 uF capacitor is connected to reset pin (9) as shown to provide manual reset to the micro controller
Circuit operation:
·         When circuit is switched ON all the LEDs are OFF, relay is OFF and the message is displayed on LCD as “to lock system enter password
·         After 2 second in place of word password the blank spaces are displayed to enter user password
·         And the circuit waits for user input through keypad
·         User enters password digit by digit. It is displayed as * on LCD. After entering all digits user has to press enter key
·         When enter key is pressed, the circuit compares entered password with set password
·         If they match the system is locked. The correct LED (green) blinks, locked LED (green) turns ON, short beep sound is generated and relay switched ON
·         LCD shows message “system locked” for 2 seconds and after that again it shows message “to unlock system enter password
·         If entered password does not match, wrong LED (red) blinks, beep sound is generated twice and message is displayed on LCD as “wrong password
·         If user enters wrong password 3 times then the system HANGs and starts generating continuous beep sound till reset button is pressed. The message is displayed on LCD as “system HANG press reset
·         To set new password user presses set new password button. Immediately the message displayed on LCD as “set new password(5 digit)
·         Then by entering digits one by one user can set new password. The digits are displayed on LCD. At the end user presses enter button. This sets new password and LCD shows message as “new password is xxxxx
·         If again user presses set new password button then message is displayed as “password can be set only once
Software program:
The complete circuit operation is due to the software program embedded inside micro controller. All the functionalities are implemented using software logic and the program. The program performs all the functionalities like
·      Takes user inputs through keypad
·      Displays different messages on LCD
·      Give indications on 4 LEDs of password correct or incorrect system locked or unlocked
·      Switch ON or OFF relay to turn ON or OFF any device connected with relay
·      Give audio notification for different events
The program is written in C language. It is compiled using KEIL (IDE) cross compiler tool. It is compiled for generic 8051 micro controller platforms so it can be used for all different micro controllers of MCS51 family like 89C51 / 89C52 / 89S52 etc. after compiling the program the HEX file is generated. That HEX file is loaded into the internal FLASH (EEPROM) of micro controller using any suitable EEPROM programmer.

Next Post »