Make a keypad lock with use of embedded system is easiest project for students. Keypad lock is the device which is provide security with password. It is a security device. This embedded system is useful in door lock, locker, and on other device which is protected by password.
Used elements for this project :-
1 Arduino board
4×4 or 3×4 Keypad
Cables
Here, This embedded software has total 8 cables which are connected to the Arduino board’s digital pins. Where 4 pins are supply the power in row and other 4 pins are supply in columns.
Note :- If you are doing this project by reference from our site than note it, you need to enter password from keypad not in serial monitor.
#include
const int ROW_NUM = 4;
const int COLUMN_NUM = 4;
const String password = "8080";
String input_password;
char keys[ROW_NUM][COLUMN_NUM] =
{
{'1','2','3', 'A'},
{'4','5','6', 'B'},
{'7','8','9', 'C'},
{'*','0','#', 'D'}
};
byte pin_rows[ROW_NUM] = {9, 8, 7, 6};
byte pin_column[COLUMN_NUM] = {5, 4, 3, 2};
Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
void setup()
{
Serial.begin(9600);
input_password.reserve(32);
}
void loop()
{
char key = keypad.getKey();
if (key)
{
Serial.println(key);
if(key == '*')
{
input_password = "";
}
else if(key == '#')
{
if(password == input_password)
{
Serial.println("password is correct");
}
else
{
Serial.println("password is incorrect, try again");
}
input_password = "";
}
else
{
input_password += key;
}
}
}
Sign in to your account
There are some fascinating closing dates in this article however I don’t know if I see all of them center to heart. There is some validity but I’ll take hold opinion till I look into it further. Good article , thanks and we would like extra! Added to FeedBurner as properly