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

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


This article describes an automatic door lock system designed using an 8051 microcontroller (89C51/89C52) for enhanced security in banks, hotels, and homes. The system allows users to enter a numeric password via a 4x3 keypad. Upon correct entry, the microcontroller activates a DC motor to unlock the door, with status messages displayed on a 16x2 LCD. The project emphasizes the use of C language programming within the Keil environment to manage input scanning, display output, and control the locking mechanism.

Parts used in the Automatic Door Lock System:

  • 8051(89c51,89c52) microcontroller
  • 16x2 LCD
  • 4x3 numeric keypad
  • Lock mechanism
  • Crystal oscillator (11.0592 MHz)
  • Breadboard
  • Reset circuitry (capacitor 10uf and resistor 8.2Kohm)
  • Power supply
  • DC motor (9 volts)
  • Transistor

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

Quick Solutions to Questions related to Automatic Door Lock System:

  • Which microcontrollers can be used for this intelligent unit?
    The project supports any microcontroller type such as PIC, 8051(89c51,89c52), Arduino, or AVR, provided it has enough memory to store the code.
  • What type of data is allowed in the password?
    The password consists of numeric data only; no alphabets are used.
  • How does the system open the lock physically?
    When the correct password is entered, the transistor turns on, causing the DC motor to rotate and move the lock needle back to open the lock.
  • What is the default password set in the code?
    The password is manually set to "1234" in the code, though it can be changed.
  • What is the maximum length allowed for the password?
    The password length should not be greater than 4 characters.
  • Which software tool is required to write the code for this project?
    The code must be written using Keil software, which requires including the reg51.h header file.
  • How are the data pins for the LCD connected to the microcontroller?
    Port 1 of the microcontroller is connected to the data pins of the LCD to send data in parallel 8-bit form.
  • At what voltage does the DC motor operate?
    The small DC motor attached to the transistor operates on 9 volts.

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:
LinkedinTwitter