Basic Level     Skills: Not specified    
Author email
[email protected]
Author website


Project tested and working perfectly

Digital Code Lock with LCD and Keypad using AT89C2051

A Brief Description:
This project is written in C language. Its a simple project with efficient hacking prevention from Brute Force etc. The basic user lock is of 5 Digits and Master Lock is of 10 digits so its not easy for an intruder to break the lock unless you keep the code simple.
The input is taken from a 4x3 Keypad (please see the schematic for more information) and Display the user input on a 2x16 LCD. A pin is assigned as output for activating and deactivating the lock. For demonstration i have connected an LED to that pin.

User Side working:
The user has two options either he/she can use its own 5 digit code or use the default 5 digit code. If user has to do setup his own code, then he has to enter "12345" and press '#'. After this.. controller will ask for 10 Digit master password which is preprogrammed in the controller. Entering master lock, user can enter the new 5 digit code for the lock and press '#' to save it.

Using the Keypad:
Keypad has 12 keys (4x3) starting from 1,2,3,4,5,6,7,8,9,*,0,# (please see the schematic for layout). Numeric keys are used for entering numbers. '*' is used as the Cancel key and '#' is used as the Enter key.

Download File Information:
LCD.C - 4-Bit LCD Drivers
LCD.H - LCD function prototypes and other declerations
Lock.C - code for lock functioning
LOCK.H - lock function declerations
KEYPAD.C - Keypad drivers
KEYPAD.H - Function declerations
DELAY.C - Delay Functions
DELAY.H - Function Prototypes only
MAIN.C - Main function!
Digital Code Lock Schematic - PDF file of orcad schematic

If any problem Please post in the forum
Tags Digital Code LockDigital door lock projectdoor lock keypadprogrammable door lock8051 door lock project8051 digital lock

20.16 kB





17 Jul 2014: 10:32 AM
Sir iam unable to run the code in proteus....after displaying "Enter Lock Code : " it is not taking the input from keypad and is doing nothing.
help me.
thanku and regards.
21 Jul 2014: 05:20 AM
Geethika, can you post your problem in forum with proteus schematic?
28 Aug 2014: 16:38 PM
can you please tell me what type of lock activator i can use in place of led???
29 Aug 2014: 08:31 AM
please can you tell me which type of lock activator should i connect in place of LED? can i use selenoid lock actuator
30 Aug 2014: 16:11 PM
You can make use of Solenoid lock.
12 Sep 2014: 06:02 AM
Sir iam unable to run the code(lock.hex) in proteus....after displaying "Enter Lock Code : " it is not taking the input from keypad and is doing nothing.
help me.
16 Sep 2014: 06:03 AM
sorry but at89c2051 have <5kb flash. is it possible to install the lock.hex on this ic ? sorry for my bad english.
17 Sep 2014: 05:02 AM
@Vikshit, Check your keypad connections. Try swapping Rows and Columns. If you still face issue post in forum.

@breadman, hex file always have more size than the actual binary code as hex is in ascii. Programmer software converts hex to binary before loading. You should not have any issue installing hex file in IC.
17 Sep 2014: 05:49 AM
ok, thanks for explaining. what compiler are you using for compiling main.c ?
01 Oct 2014: 06:42 AM
Code is written for Keil.
06 Oct 2014: 10:20 AM
Thank you very much sir. The program was running very well on at89s51.
12 Nov 2014: 18:41 PM
the lcd is not showing the pasword i am entering plus is not doing anything after that
14 Nov 2014: 05:16 AM
@FARYAL, check your keypad connections. if you have any doubts please post in forum.
27 Dec 2014: 16:31 PM
can we use this code in AT89S52 instead of AT89C2051 ....
06 Jan 2015: 04:39 AM
@sufyan, Yes you can use AT89S52. Just keep the same port pins.
12 Feb 2015: 11:16 AM
sir plz send the source code to my e mail.plzzzz
13 Feb 2015: 04:45 AM
@haishbhat, please use the download button.
25 Mar 2015: 12:40 PM
sir i want abstract for digital code lock using at89c2089.
29 Mar 2015: 19:31 PM
@vinothkumar, I don't think it will be hard to write few words on the project as simple as a digital lock. Please do prepare an abstract and share it with us. We will add it to this project as your contribution.
09 Apr 2015: 01:40 AM
hello sir can u please help me i need proteus code for this digital code lock
vl u pls mail me
10 Apr 2015: 18:22 PM
@Srikar, code is provided in the zip file. there is no separate code for proteus. Post in forum for further questions.
26 Jul 2015: 01:40 AM
Should I just be burning the main.c function onto the microcontroller? What are the other files for?
24 Aug 2015: 02:34 AM
could you pleas help me to create this project for our final grading @ AT89C2051
27 Aug 2015: 07:16 AM
@krizza, Please download the project and build it. I have also provided hex file incase you do not have compiler.
22 Sep 2015: 08:14 AM
admin sir please send me the source code of password based door lock system...i m trying from 2 month. still not get success on it.
so please help me sir
29 Sep 2015: 21:53 PM
@tabrej, Click on the download file button to get the zip file containing code and schematic. Post in forum if you need any help.
23 Nov 2015: 04:59 AM
its very interesting
28 Mar 2016: 13:05 PM
Can u send me the whole working of main circuit diagram
I need urgent ...plz sir
16 Aug 2016: 04:46 AM
Sir can you help me for my project? I need to have a servo motor that use for my lock. My project is like a vault.
10 Mar 2018: 12:14 PM
I am working on digital code lock project. I got the output on proteus(did not connect the pull up resistors connected to lcd.)
When I am testing on breadboard the LCD shows "Enter the codelock: " but when I press the matrix keypad nothing is displayed on LCD.
(Required; Min length 5)
(Required; will not be displayed)


Mon Nov 12 2018, 05:58 AM
i have seen your replica of I2C programming using AT89C51 but i am unable to understand the "ack_bit" variable usage ...looks like it is always 1...can you elaborate how acknowledgment is working....
Tue Nov 06 2018, 02:36 PM
kindly any one give solution for my problem
Mon Nov 05 2018, 09:48 PM
Pins high is the normal state. You need a program to set them low
Sun Nov 04 2018, 05:41 PM
hello, i am niranjoy, alll the port of my 8051 is always high, even i erase all the program. why is it so happen and what is the problem. any one please help me!
Sun Nov 04 2018, 02:16 PM
BASAVARAJ g kudamble
hi I am interfacing GSM 300 to 8051 microcontroller to receive message from mobile
Sat Sep 29 2018, 06:28 PM
Please post questions in the forum.
Sat Sep 29 2018, 11:26 AM
Ashfaq Ch
hi i have some AT89C51RC microcontrollers already programed. some one help us to how to download from AT89C51RC and after study and edit all corractions reload to AT89C51RC controller
Wed Sep 12 2018, 10:58 PM
hii!! some1 please let me know how i ll get rfid code to 8051 by WEIGAND mode
Tue Sep 11 2018, 08:09 PM
is there anyone here?
Mon Aug 27 2018, 07:30 AM
Hello everyone´╝ü



Fri Nov 16 2018, 07:44 AM
Wed Nov 14 2018, 09:25 AM
Mon Nov 12 2018, 03:14 PM
Sun Nov 11 2018, 03:36 PM
Sat Nov 10 2018, 02:52 AM
Tue Nov 06 2018, 06:35 PM
Sun Nov 04 2018, 05:36 PM
Sun Nov 04 2018, 02:27 PM


Guests: 41, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38021
Newest member: atalnet
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 19 2018, 01:11 AM
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Nov 15 2018, 06:48 PM
Unfortunately I have no experience of LabView,but ...
katherineamt Avatar
Posted By katherineamt
Mon Nov 12 2018, 03:22 PM
I have never used LabView and I have to implement ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 12 2018, 01:21 AM
wimac Avatar
Posted By wimac
Sun Nov 11 2018, 04:03 PM
bgk3678 Avatar
Posted By bgk3678
Sun Nov 11 2018, 07:25 AM
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 06 2018, 06:10 PM
bgk3678 Avatar
Posted By bgk3678
Sun Nov 04 2018, 02:52 PM
bgk3678 Avatar
Posted By bgk3678
Sun Nov 04 2018, 02:48 PM
Xuenan Avatar
Posted By Xuenan
Sat Nov 03 2018, 01:08 PM
Make the 8051 frequency exactly 11.0592 MHz in pro...