Automatic door lock system using 8051(89c51,89c52) microcontroller

Automatic door locks are becoming popular in industry and many companies and industries are using automatic door locks systems for the safety of their rooms. They are popular in banks. Banks use automatic lock systems to keep security of their money stored in a single room. These automatic door lock systems are also used in hotels,airports prison areas, hospitals and in homes.Automatic door lock system using 8051(89c51,89c52) microcontroller

In this project i am designing a same automatic door lock system using 8051(89c51,89c52) microcontroller. The 8051(89c51,89c52) is my intelligent unit that checks whether the password entered is correct or not. Off course you need an intelligent unit that can make decisions on the input by the user. This intelligent unit must be a microcontroller of any type (pic,8051(89c51,89c52),arduino,AVR). But be sure the microcontroller has enough memory to store the code. 16×2 lcd is used to display messages to tell the user whether he entered the right password or not, whether the access to room is granted or not. 4×3 numeric keypad is used to take input from the user. The password consists of numeric data only and no alphabet is used in the password.Other

Project requirements

  • 8051(89c51,89c52) microcontroller
  • 16×2 lcd
  • 4×3 keypad
  • Lock
  • crystal (11.0592 MHz)
  • Bread board(on which circuit is designing)   
  • reset circuitry(capacitor(10uf) and resistor(8.2Kohm))  
  • power supply
Connect port 1 of microcontroller to the data pins of lcd. Connect port 3 pin no 5 to rs(register select) pin of lcd. Connect port 3 pin no 6 to en(enable) pin of 16×2 lcd. Connect port 3 pin no 7 to rw(read-write) pin of 16×2 lcd. Attach your lock to port 3 pin no 0. The lock designing is explained below. 4×3 Keypad is attached to port 2, keypad rows are attached to port 2 pins(0,1,2,3) and coulombs to pins(5,6,7). Other connections are for driving the microcontroller connect crystal with pins 18 and 19. Ground pin 20. Apply 5 volts to pins 40 and 31. Attach your reset circuitry to pin 9.
The lock system is some thing challenging but it is not as much hard to design as it look likes. Below is the circuit that describes the lock system.
 A small dc motor is attached to the transistor at the source.Dc motor is operating on 9 volts. The transistor gate is connected to port 3 pin 0. So when the user inputs the correct password the transistor becomes on and our dc motor rotates and move back lock needle, which opens the lock. To lock the door again manually pull up the lock needle.
The code is simple and easy to understand it is written in c language. First of all the necessary header file reg51.h is included. This header file must be included in every project made using keil as the software tool to write the code. Then the keypad rows and coulombs are declared. 16×2 lcd controlling pins and lock controlling pin is defined. All the upper described pins are declared individually because they are used in our code individually. Data pins for lcd are not defined because whole port1 is dedicated for data pins of lcd, and data is send parallel in 8-bit form.
Automatic door lock system using 8051(89c51,89c52) microcontroller schematich
Then some character arrays are defined. These character arrays contains the messages that are displayed on the 16×2 lcd when every certain condition is met or their is some wrong input.The password is manually set in the code it is “1234”. You can change it according  to your desire but be sure that the password length should not be greater than 4 characters. The lock controlling pin is also defined as lock at port3 pin 0.
various functions and their working
  • void delay() Generating variable delay.
  • void cmd()   Sending commands to 16×2 lcd.
  • void lcddata() Sending data to 16×2 lcd.
  • void lcdint()  Initializes 16×2 lcd.
  • char keypad()  Scaning keypad keys and taking input from user.
  • void main()    Main function.



For more detail: Automatic door lock system using 8051(89c51,89c52) microcontroller

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: