Digital Keypad Security Door Lock using Arduino
Hi everyone, welcome to another blog tutorial,in this tutorial I will teach you how tomake this password enabled entry.
Components:
- 4X4 matrix keypad
- membrane keypad
- 16X2 LCD
- Arduino
- Servo Motor
- Connecting Wires
- Potentiometer
Circuit Diagram:
Description:
I'm using as an improvised enclosure and this is the door, this is a 4X4 matrix keypad, membrane keypad, this is a 16X2 LCD.So, what this system does is this, like I said it’s a password enabled entry, so, I programmed the system with Arduino, so,when you enter the wrong password using this 4 by 4 matrix keypad the door will not open and the password you entered will be displayed on this LCD, but once you enter the right password, the door will open, then it will remain open for 5 and then close. So, the components or for the parts I usedin the design you can see here I have a motor driver this is a motor driver to drive the motor that opens and closes the door, this is a potentiometer to vary the brightness of the LCD. Here I have an Arduino Uno and I have an I2 CLCD module, I2C module, and here I have a DVD tray, so this tray is serving as the electronic door, it has a motor DC motor, It’s already closed, so, when it is working, this tray will move in this direction and open and when it is to be closed, it will go back to its previous position. I have the 4 by 4 matrix membrane keypad and a liquid crystal display. I have connected it; everything is fine all need to do now is to upload the Arduino code and we will test how the system works so to keep Reading. Alright, I have uploaded the code to the Arduino board and it's good to go, so all I will do now is to enter the password.Now I programmed it with the password 3142,3142, so, once I enter the right password, I expect this door to open and once I enterthe wrong password, I don't expect it to open. So, let me start by entering the right password first 3-1-4-2, open, you can see it’s open, access granted and then after 5 seconds it closes then, if I enter it again, 3-1-4-2, open,access granted, and then it closes, but if I enter the wrong password, let’s say3-2-5-4 access denied, enter password, 1-4-7-8, access denied, A-B-C-D, access denied, #-*-0-*,access denied, 3-6-9-8, access denied, 4-5-2-1, access denied, 7-8-0-8, anything you entered that is not that right password it will not open, but once you enter the right password,which is 3-1-4-2, Access granted So, it is working perfectly.
Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#define Password_Length 5
int signalPin1 = 10;
int signalPin2= 11;
char Data[Password_Length];
char Master[Password_Length] = "3142";
byte data_count = 0, master_count = 0;
bool Pass_is_good;
char customKey;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup(){
lcd.init();
lcd.backlight();
pinMode(signalPin1, OUTPUT);
pinMode (signalPin2, OUTPUT);
}
void loop(){
lcd.setCursor(0,0);
lcd.print("Enter Password:");
customKey = customKeypad.getKey();
if (customKey){
Data[data_count] = customKey;
lcd.setCursor(data_count,1);
lcd.print(Data[data_count]);
data_count++;
}
if(data_count == Password_Length-1){
lcd.clear();
if(!strcmp(Data, Master)){
lcd.print("Access Granted");
digitalWrite(signalPin1, LOW);
digitalWrite(signalPin2,HIGH);
delay(5000);
digitalWrite(signalPin1, HIGH);
digitalWrite(signalPin2,LOW);
}
else{
lcd.print("Access Denied");
delay(1000);
}
lcd.clear();
clearData();
}
}
void clearData(){
while(data_count !=0){
Data[data_count--] = 0;
}
return;
}
Now this is to tell you that it is very easy to deign this project, this gives you a basic understanding of how all those smart doors work, all those smart doors that use password enabled entry technology, this is basically how they work. I can scale up this design to control a normal door or a safe box, or anything I want to enable with a password I can do that withthis setup. So, this is how the system works, everythingis fine,the code is given below, visit our website you will find other projects we’ve designed that are Very Wonderful and are very educating .Someone who saw when I was designing the project asked me to incorporate a sensor here so that the sensor will monitor when there is an obstructionas the door is closing, because the door opens very fast and closes fast as well, so, if someone is caught at this end when the door is closing it might be a problem, so, the person asked me to incorporate a sensor that will monitor if there is an obstruction on the way as door is closing , and then if such is the case, then the Arduino should pick the information and tell the door to go back and then wait for another 5 seconds and then closes again, so, I’m thinking of incorporating that very part to this design, so, if you like this project share it with your friends and leave a comment. Thanks for watching and see you in the next tutorial.
Stay Home Stay Safe!!!
Thanks for your hard work
ReplyDelete