Arduino Door Lock With Password

156,934

334

97

Published

Introduction: Arduino Door Lock With Password

About: I am always making electronic stuff. I like to do Arduino projects best. more projects coming soon!

In this project I mede an door lock (or box lock) that opens when you enter your password and press "#". The servo turns back to the position it was in after some seconds.

Step 1: PARTS & TOOLS

For this project I used:

* Arduino uno ( http://store.arduino.cc/index.php?main_page=produc... )

* 4x4 matrix keypad, can also use 3x4( http://www.ebay.com/itm/4-x-4-Matrix-Array-16-Key-... )

* Arduino PCB shield ( http://www.ebay.com/itm/Prototype-PCB-for-Arduino-... )

* 2x 1k OHM resistors ( http://www.ebay.com/itm/50-Pcs-Carbon-Film-Resisto... )

* 3mm green and red LEDs ( http://www.ebay.com/itm/LOT-OF-20-50-100-3mm-Red-G... )

* Male pin header ( http://www.ebay.com/itm/3pcs-40Pin-2-54mm-Male-Hea... )

* Female pin header ( http://www.ebay.com/itm/New-4PCS-40Pin-Straight-Fe... )

* Servo ( http://www.ebay.com/itm/SG90-Mini-Gear-Micro-9g-Se... )

* Wires ( http://www.ebay.com/itm/50pcs-1007-24-color-PCB-So... )

The tools you are going to need:

* Soldering iron

* Soldering paste

* Soldering tin

* Plier

Step 2: Schematic

Follow the schematic.

Step 3: Solder the Connectors

Solder he connections for the Arduino, kaypad and servo. When you are soldering the connection for the keypad and the servo try not to have it in a place where the programing port on the Arduino UNO touches your soldered places, I did that once and I almost ended up destroying my Arduino because the 5v and the GND got connected together when they touched the programing port.

Step 4: Soldering

Solder the LEDs, resistors and the wires for them, than solder the rest of the wires, try to cut your wires so that they fit nice and smooth on the PCB like shown in the photos.

Step 5: The Door Lock

I mounted my servo on an aluminum plate with an simple lock. unfortunately I did not take any photos when making this but hopefully you will understand how to make it by the photo, its really easy.

Step 6: CODE

Download the code and import libraries. You need to download the 3 Arduino libraries if you don't have them.

* password.h

* keypad.h

* servo.h

THANKS FOR VIEWING!

Ifyou like this project than go check out my channel for more cool projects :)

If you have any questions or tips than post them in the comments.

3 People Made This Project!

Recommendations

  • Clocks Contest

    Clocks Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

97 Discussions

how can we add libraries of keypad and password during coding which aren't present in Arduino software

0
user
AhmetA38

Question 5 months ago

can ı use arduino nano

0
user
AhmetA38

Question 5 months ago

can ı use arduıno nano

Can ı use arduıno nano

hello , i made the same project , but i want to add buzzer which do a sonor signal when we enter a false password 3 times
could someone how can i do it
(am asking about the code )

1 reply
0
user
riched

11 months ago

I made this the first time round and had no problem, but i wanted to use a smaller uno bored but now every time i try to upload the code i get this "\Documents\Arduino\TEST1\TEST1.ino:7:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]" and because of this the code isnt working right on the bored, pls can anyone help as im confused to what the issue is. thanks

C:\Users\Mahmoud\Documents\Arduino\sketch_jun13a\sketch_jun13a.ino:8:38: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

Password password = Password( "0000" );

Please help , this error appeared.

This instructable is very nice and perfect .

I made it .but there
is a problem in the program .

When you enter password keys and * key
the pass is accepted , but after that whenever you press

Just only * key
and no any other key the servo acts ,unless you press another key or
rest # key .

I solved the problem by inserting this line password.reset();

by this when password is accepted the program automatically resets it .


Serial.println("Accepted");


Serial.write(254);delay(10);

//Add code to run
if it works


myservo.write(150); //deg


password.reset();


digitalWrite(11, HIGH);//turn on

delay(5000);
//wait 5 seconds

digitalWrite(11,
LOW);// turn off

VERY NICE AND PERFECT

how i connect the pins for 3x4 numpad ?

is this the full programming ???
and how the programming if i add a lcd or cctv ?
can you help me to program it ?

hello , i made the same project , but i want to add buzzer which do a sonor signal when we enter a false password 3 times
could someone how can i do it
(am asking about the code )

a little doubt here. if i press 123456789 instead of just 159 the opens. i mean the code is such that as if you press any no. having 1,5 & 9 in sequence the door opens

6 replies

I did not know that, do you have any suggestions to how I can make the code better?
Thanks

just test for code entry size, if more than 3 digits, disallow

how would i put that into the code here is the code i have i had tried to do //code entry size, if more than 3 digits, disallow... but it dint nothing and had the same problem

#include <Keypad.h>

#include <Servo.h>

Servo servo_Motor;

char* password = "123";

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 redPin = 12;

int greenPin = 13;

void setup()

{

pinMode(redPin, OUTPUT);

pinMode(greenPin, OUTPUT);

servo_Motor.attach(11);

setLocked(true);

}

void loop()

{

char key = keypad.getKey();

if (key == '*' || key == '#')

{

position = 0;

setLocked(true);

}

if (key == password[position])

{

position ++;

}

if (position == 3)

{

setLocked(false);

}

delay(100);

}

void setLocked(int locked)

{

if (locked)

{

digitalWrite(redPin, HIGH);

digitalWrite(greenPin, LOW);

servo_Motor.write(11);

}

else

{

digitalWrite(redPin, LOW);

digitalWrite(greenPin, HIGH);

servo_Motor.write(90);

}

}

hello , i made the same project , but i want to add buzzer which do a sonor signal when we enter a false password 3 times
could someone how can i do it
(am asking about the code )

hello , i made the same project , but i want to add buzzer which do a sonor signal when we enter a false password 3 times
could someone how can i do it
(am asking about the code )
which and how can i do it please

can you make the schematic with fritzing? thanks. by the way great project.