This project implements a keypad lock using an AT89S52 microcontroller. A 4x4 keypad is used to enter a password, which is checked against a preset password. If correct, a green LED turns on and the lock is opened. Otherwise, a red LED turns on. The status is also displayed on a 16x2 LCD. The code includes functions for initializing peripherals like the LCD, taking input from the keypad, and checking/displaying the password.
1. In this keypad lock project I have used the AT89S52 microcontroller, one of the series of 8051 microcontroller by ATMEL corp. Here I’m using 4X4
keypad to take input from the user (to enter password) and display the corresponding results on a 16X2 LCD.
Since AT89S52 doesn’t have its own internaloscillator, thus we need to provide an externalcrystalof 11.0592 Mhz to make it function able. I am
using a 7805 voltage regulator IC to convert 9V to desired 5V output.
In this project, I have used a normal 9V DC battery but we can also connect an AC-DC adapter for longer demonstrations. (For adapter
configuration, look for the datasheet of IC 7805 voltage regulator
2 LEDs(green, red) also help us to know about status of the lock.Green led lights up when the lock is open and Red led lights up when the lock is
closed.I have also indicated the status of lock on the LCD itself, on its bottom right corner.Using a preset(potentiometer), can help us to adjust the
contrast of the text on LCD. I have used a preset of 50K.
The default password set is “000”, but user can change this password.To change the password, press “*”on the keypad followed by pressing “#”. It
will ask user for the current password, then for the new password followed by its confirmation.On confirming the password, “C HANGE SUCCESSFUL”
statement will be shown else “CHANGE UNSECCESSFUL” will appear for which current password will remain authenticated. Password related things
are hidden, rather they are shown by “*”. This is done to make password more protected/hidden (only known to user) in real world.
I have used threeuser defined headerfile:
< lcd.h>, < delay.h> and <keypad.h>
lcd.h handles with all user defined functions which are needed to operate a 16X2_8 bit LCD.
delay.h includes function like delay_msec(), which provides delay in milliseconds according to the TIMERS present in AT89S52.
keypad.h deals with the functions which is responsible for inputting values from 4X4 keypad.
· LCD data ports are connected to PORT 3 of AT89S52.
· RS, R/W and ES pins of the LCD are connected to P2^0, P2^1, P2^2 respectively.
· VEE pin of LCD is connected to a preset to adjust the contrast.
2. · Pins 15 & 16 of LCD are connected to VCC & GND respectively.
· The 8 pins of the Keypad are connected to PORT 1 of AT89S52.
· The GREEN LED is connected to P2^4 and RED LED to P2^3.
Peripherals that can be attached:
· We can use a linear actuator systemto provide a mechanical locking system
· We can also use a magnetic systemfor doing the same.
· Using a stepper motor/servo motor controlled system in also a good idea.