{"id":16104795,"url":"https://github.com/kmhmubin/password-based-doorlock-system-in-8051-microprocessor","last_synced_at":"2025-03-18T08:31:29.363Z","repository":{"id":100296842,"uuid":"300206206","full_name":"kmhmubin/Password-based-doorlock-system-in-8051-microprocessor","owner":"kmhmubin","description":"Password-based door lock system using 8051/PIC microcontroller","archived":false,"fork":false,"pushed_at":"2024-05-23T01:12:50.000Z","size":724,"stargazers_count":20,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T08:19:23.228Z","etag":null,"topics":["8051-projects","circuit-simulation","door-lock","password-based-door-lock"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kmhmubin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-01T08:33:55.000Z","updated_at":"2024-12-04T07:24:41.000Z","dependencies_parsed_at":"2024-10-27T17:27:02.855Z","dependency_job_id":"18619a91-0bac-4f9e-b86d-d29f0c36079e","html_url":"https://github.com/kmhmubin/Password-based-doorlock-system-in-8051-microprocessor","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"609a6fbdfb6afe4795831c0f864492aa9f75b17a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmhmubin%2FPassword-based-doorlock-system-in-8051-microprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmhmubin%2FPassword-based-doorlock-system-in-8051-microprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmhmubin%2FPassword-based-doorlock-system-in-8051-microprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmhmubin%2FPassword-based-doorlock-system-in-8051-microprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmhmubin","download_url":"https://codeload.github.com/kmhmubin/Password-based-doorlock-system-in-8051-microprocessor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910750,"owners_count":20367545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["8051-projects","circuit-simulation","door-lock","password-based-door-lock"],"created_at":"2024-10-09T19:06:30.601Z","updated_at":"2025-03-18T08:31:29.350Z","avatar_url":"https://github.com/kmhmubin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Password-based-doorlock-system-in-8051-microprocessor\n\n### software requirements\n\n- Proteus (for circuit diagram and simulation)\n- Keil uVision5 IDE (for c code)\n\n### Hardware requirements:\n- 8051 microcontroller (80C51)\n- Phone keypad\n- LCD – LM016L\n- DC Motor (re-present as a door-lock motor)\n  \n### Objective: \n\n\u003cp\u003e Safety is the most crucial concern of human. We always try to keep our things between ourselves. For this reason, we still use various methods to lock our precious items like a locked diary. And when it comes to our daily life, we are more serious. In the modern age, there are so many ways to lock the door; one of them is password-based lock system—a system where you are the only one to know how to access it. It saves our daily life from the various malicious problem like a thief. This system will give us the security that we want. To make our life more secure, we are going to build the password-based door lock system. This system is easy to assemble and very easy to use in our daily life. Anyone can use it to secure themselves.\u003c/p\u003e\n\n\n### Applications: \n\n\u003cp\u003eThe password-based lock system can install any door of any rooms. This system also can be integrated with the existing system. This electric combination lock system uses a five-digit password. The system collects five-digit user input and compares the user input with the preset password inside the program. If the password matches, access will be granted, and if not match the entry will be denied. The system can be used at residential places to ensure better safety. It can be used at organizations to ensure authorized access to highly secured places.\u003c/p\u003e\n\n### Block Diagram:\n\n![Block Diagram](https://i.imgur.com/uV6oYkP.png)\n\n\u003cp\u003eFig: System Block Diagram\u003c/p\u003e\n\n\n### Working Procedures:\n1.\tThe main component in the circuit is 8051 microcontrollers. This control everything in the device.\n2.\tWe connect the 4x3 keypad with the microcontroller. In the keypad there is 4 rows which is indicated the letters (A-D) and the 3 columns which is indicated the number (1-3).\n3.\tIn the 8051 controller, pin P2.0 to P2.3 are connected to the keypad rows and pin P3.0 to P3.2 are connected to the keypad columns.\n4.\tThen we connect the door lock motor pins in the P3.3 and P3.4. This motor only work when the password is right.\n5.\tLCD’s points are connected with P3.5 to P3.7 in 8051.  LCD help us to show the inputs and error messages.\n6.\tAll devices are connected with each other. In the simulation we use the hex code to run the program. The hex code is generated from the embedded C code. This code only works on any 8051-microcontroller system. \n7.\tTo run the simulation, we set the clock frequency at 11.0592 MHZ for 8051. This is allowed us to run the simulation without getting any errors.\n8.\tWe pre-define the password 12345 for the program.\n9.\tIf user input wrong password it will give another chance to input the password again with an error message. When the password is right it will show the welcome message and lock motor will move to open the door.\n\n\n\n### Schematic Circuit Diagram:\n\n![Schematic Circuit Diagram](https://i.imgur.com/stAXULK.png)\n\n\u003cp\u003eFig: Schematic Circuit Diagram\u003c/p\u003e\n\n\n### Project Code:\n\n```c\n\n// password based door lock system in 8051 microprocessor\n\n#include \u003creg51.h\u003e\n\n// connected pins\n// keypad rows\nsbit keyrow1 = P2 ^ 0;\nsbit keyrow2 = P2 ^ 1;\nsbit keyrow3 = P2 ^ 2;\nsbit keyrow4 = P2 ^ 3;\n//keypad column\nsbit keycolumn1 = P3 ^ 0;\nsbit keycolumn2 = P3 ^ 1;\nsbit keycolumn3 = P3 ^ 2;\n\n// motor pins\nsbit motorpin1 = P3 ^ 3;\nsbit motorpin2 = P3 ^ 4;\n\n// led pins\nsbit rs = P3 ^ 5;\nsbit rw = P3 ^ 6;\nsbit en = P3 ^ 7;\n\n//functions\nvoid lcdcmd(unsigned char);\nvoid lcddat(unsigned char);\nvoid lcddisplay(unsigned char *q);\nchar keypad();\nvoid check();\nvoid delay(unsigned int);\nunsigned char pin[] = {\"12345\"};\nunsigned char Epin[5];\n\n// main function\nvoid main()\n{\n    lcdcmd(0x0F); //decimal value: 15\n    lcdcmd(0x38); //decimal value: 56\n    lcdcmd(0x01); //decimal value: 1\n\n    while (1)\n    {\n        unsigned int i = 0;\n        lcdcmd(0x80); //decimal value: 128\n        lcddisplay(\"ENTER PIN NUMBER\");\n        delay(1000);\n        lcdcmd(0xc0); //decimal value: 192\n        while (pin[i] != '\\0')\n        {\n            Epin[i] = keypad();\n            delay(1000);\n            i++;\n        }\n        check();\n    }\n}\n\n//delay function\nvoid delay(unsigned int j)\n{\n    int a, b;\n    for (a = 0; a \u003c j; a++)\n    {\n        for (b = 0; b \u003c 10; b++)\n            ;\n    }\n}\n\n// lcd commands functions\nvoid lcdcmd(unsigned char A)\n{\n    P1 = A;\n    rs = 0;\n    rw = 0;\n    en = 1;\n    delay(1000);\n    en = 0;\n}\n\n//lcd data function\n\nvoid lcddat(unsigned char i)\n{\n    P1 = i;\n    rs = 1;\n    rw = 0;\n    en = 1;\n    delay(1000);\n    en = 0;\n}\n\n//lcd display charecters function\n\nvoid lcddisplay(unsigned char *q)\n{\n    int k;\n    for (k = 0; q[k] != '\\0'; k++)\n    {\n        lcddat(q[k]);\n    }\n    delay(10000);\n}\n\n// assign keypad character value function\n\nchar keypad()\n{\n    int x = 0;\n    while (x == 0)\n    {\n        // assign values for first row\n        keyrow1 = 0;\n        keyrow2 = 1;\n        keyrow3 = 1;\n        keyrow4 = 1;\n        if (keycolumn1 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '1';\n        }\n        if (keycolumn2 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '2';\n        }\n        if (keycolumn3 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '3';\n        }\n        // assign values for second row\n        keyrow1 = 1;\n        keyrow2 = 0;\n        keyrow3 = 1;\n        keyrow4 = 1;\n\n        if (keycolumn1 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '4';\n        }\n        if (keycolumn2 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '5';\n        }\n        if (keycolumn3 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '6';\n        }\n\n        // assign values for third row\n        keyrow1 = 1;\n        keyrow2 = 1;\n        keyrow3 = 0;\n        keyrow4 = 1;\n        if (keycolumn1 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '7';\n        }\n        if (keycolumn2 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '8';\n        }\n        if (keycolumn3 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '9';\n        }\n\n        // assign values for forth row\n        keyrow1 = 1;\n        keyrow2 = 1;\n        keyrow3 = 1;\n        keyrow4 = 0;\n\n        if (keycolumn1 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '*';\n        }\n        if (keycolumn2 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '0';\n        }\n        if (keycolumn3 == 0)\n        {\n            lcddat('*');\n            delay(1000);\n            x = 1;\n            return '#';\n        }\n    }\n}\n\n// password check function and run the door motor\n\nvoid check()\n{\n    //  compare the input value with the assign password value\n    if (pin[0] == Epin[0] \u0026\u0026 pin[1] == Epin[1] \u0026\u0026 pin[2] == Epin[2] \u0026\u0026 pin[3] == Epin[3] \u0026\u0026 pin[4] == Epin[4])\n    {\n        delay(1000);\n        lcdcmd(0x01); //decimal value: 1\n        lcdcmd(0x81); //decimal value: 129\n        // show pin is correct\n        lcddisplay(\"PIN CORRECT\");\n        delay(1000);\n        // door motor will run\n        motorpin1 = 1;\n        motorpin2 = 0;\n        lcdcmd(0xc1); //decimal value: 193\n        // show the door is unlocked\n        lcddisplay(\"DOOR OPENED\");\n        delay(10000);\n        motorpin1 = 1;\n        motorpin2 = 0;\n        lcdcmd(0x01); //decimal value: 1\n    }\n    else\n    {\n        lcdcmd(0x01); //decimal value: 1\n        lcdcmd(0x80); //decimal value: 128\n        lcddisplay(\"WRONG PIN\");\n        delay(1000);\n        lcdcmd(0x01); //decimal value: 1\n    }\n}\n\n// end\n```\n\n### Discussion:\n\n\u003cp\u003eIn the program first we import the 8051-family header file which contain all the necessary classes. Then we assign every connected pin to the variables. \nIn keypad we assign variable as keyrow1 to keyrows4 for keypad rows and keycolumn1 to keycolumn3 for keypad columns. Then we connected the motor pins and lcd pins in the variable called motor pins and rs, rw and en.\u003c/p\u003e\n\n\u003cp\u003eAfter assign all the connected pins to the variables. We declare functions for every single task. The main function calls the other functions for execute the program.\u003c/p\u003e\n\n\u003cp\u003eDelay function is used for delay the program execution for few seconds. It helps us to execute the program smoothly. We delay the execution for only 1000ms = 1secs. \u003c/p\u003e\n\n\u003cP\u003eThe lcdcmd function is help us to control the lcd. It will control the current flow for the lcd screen and also help to perform Read/Write Operation. \nThe lcddat function control the lcd data pins. In the LCD there is total 8 pins D0 to D7 Pins used to send Command or data to the LCD.\u003c/P\u003e\n\n\u003cp\u003eThe lcddisplay function is used for display user input characters and also assign the values for every keypad character values. First, we select a single keypad row and assign the values for the key. Also encoded with the asterisk (*) character, for pin protection.\u003c/p\u003e\n\n\u003cp\u003eThe check function is used for compare the user input with the assign password number. If the user input match the assign password, it will show the “pin correct” message and give the signal to run the lock motor. After lock motor will run, again it will show the “door open” message. On the other hand, if the user input password is wrong, it will show the “wrong pin” message. Then it will delay few second and give another chance to input the password again.\u003c/p\u003e\n\n\u003cp\u003eThe main function is the mother function of the program. Main function will call other function in other to perform the task. At first it will call the lcdcmd function to control the lcd, then it will call the lcddisplay function for display the messages in the lcd screen. It will delay for few seconds. After that it will run loop until the correct pin enter. To check the password is correct it will call check function, then execute the program.\u003c/p\u003e\n\n\u003cp\u003eTo simulate the program circuit, we use the proteus simulation. All the code is written in embedded C code, which is not directly executed by the 8051 microcontrollers. To run the program first we need to build the program and convert the program in hex file. The hex file is supported by the 8051 microcontrollers.  Every 8051 controller has a clock frequency for perform the task. To run the program, we use 11.0592 MHZ clock frequency. It will run the simulation smoothly without any kind of errors.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmhmubin%2Fpassword-based-doorlock-system-in-8051-microprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmhmubin%2Fpassword-based-doorlock-system-in-8051-microprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmhmubin%2Fpassword-based-doorlock-system-in-8051-microprocessor/lists"}