Project in progress
Keypad Entry Lock

Keypad Entry Lock

An up to six digit number code that enables you to unlock a secret container.

  • 2,989 views
  • 0 comments
  • 12 respects

Components and supplies

About this project

We wanted to design something to be able to secure any type of items that you would want to store. Our idea is to make a lock that is like a safe lock, but instead of the old school combination locks with the dial from 0 to 90, we want to use a ten digit key pad. You would have up to a six digit code. When you put the correct six digit code into the key pad then the lock mechanism would unlock so you could open the container.

The keypad lock has become a success. After working on the code and fixing many bugs due to simple mistakes, the keypad lock works with a three digit code which is 427. There are red and green led light to show if the keypad is locked or unlock. Green = open and Red = closed. When you turn on the keypad the red light will be on. You can put any three digit combination in and the keypad will stay lock unlock you put in 427. Once you place the correct combination into the keypad, then light will turn green and the box will unlock.

Some of the parts were difficult to work with. One of the SG-90 servo motors locked up in some of our first attempts. Luckily with the three of us we had extras. We use a 9V battery as our power supply so we could use the keypad lock in a real application. Due to cutting some of our jumper wires we were able to wire the keypad lock without using a bread board, which was helpful in using this in a real life application.

Code

CodeC/C++
#include <Servo.h>
#include <Keypad.h>

Servo ServoMotor;
char* password = "427";  // change the password here, just pick any 3 numbers
int position = 0;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

byte rowPins[ROWS] = { 8, 7, 6, 9 };
byte colPins[COLS] = { 5, 4, 3, 2 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int RedpinLock = 12;
int GreenpinUnlock = 13;

void setup()
{
pinMode(RedpinLock, OUTPUT);
pinMode(GreenpinUnlock, OUTPUT);
ServoMotor.attach(11);
LockedPosition(true);
}

void loop()
{
char key = keypad.getKey();
if (key == '*' || key == '#')
{
position = 0;
LockedPosition(true);
}
if (key == password[position])
{
position ++;
}
if (position == 3)
{
LockedPosition(false);
}
delay(100);
}
void LockedPosition(int locked)
{
if (locked)
{
digitalWrite(RedpinLock, HIGH);
digitalWrite(GreenpinUnlock, LOW);
ServoMotor.write(11);
}
else
{
digitalWrite(RedpinLock, LOW);
digitalWrite(GreenpinUnlock, HIGH);
ServoMotor.write(90);
}
}

Schematics

Front View
Img 9325 cboqjruqwb
Back View
Img 9326 jgn3uqjhzj

Comments

Team members

Default
camdelk
  • 2 projects
  • 2 followers
Default
mckean0
  • 2 projects
  • 2 followers
Lucas76
lucas76
  • 2 projects
  • 2 followers

Published on

April 30, 2019

Members who respect this project

DefaultImg 0179 w0txkkfv5jDefaultErospeter

and 11 others

See similar projects
you might like

Similar projects you might like

Keypad operated door lock

Project tutorial by andrea

  • 5,757 views
  • 2 comments
  • 7 respects

Arduino Keyless Door Lock System with Keypad and LCD

Project tutorial by DIY Hacking

  • 21,285 views
  • 16 comments
  • 51 respects

Push Button Combination Lock Using Arduino

Project tutorial by Asim Zulfiqar and High Voltages

  • 3,815 views
  • 8 comments
  • 18 respects

Keypad Door Lock with Changeable Code

Project tutorial by SurtrTech

  • 1,733 views
  • 0 comments
  • 24 respects
Add projectSign up / Login