Introduction: Arduino Door Locking System

Picture of Arduino Door Locking System

In this project I made an door lock (or box lock) that opens when you enter your password and press "*".

Step 1: Material Needed....

Picture of Material Needed....

1. Arduino uno

2. Standard Servo

3. Red And Green LED

4. Male And Female Pin Headers

5. Door Lock

6. 4X4 Keypad

7.PCB

Step 2: Make PCB ....

Picture of Make PCB ....

Solder all the connection as shown above in the pics.

Or use frtizing file attached below

Step 3: Make Door Opening System....

Picture of Make Door Opening System....

Using Double tape Stick servo And Using A thick metal wire make a system that can open the lock when servo moves my pics above will help you..

Step 4: Put Every Thing Together

Picture of Put Every Thing Together

Put everything in order as shown in pics above

Step 5: Upload the Code on Arduino ..

Picture of Upload the Code on Arduino ..

Code Link :- https://drive.google.com/file/d/0B-ucVP7iDSacOTd3d...

Code :-

#include //http://playground.arduino.cc/uploads/Code/Password.zip //tells to use password library
#include //http://www.arduino.cc/playground/uploads/Code/Keypad.zip //tells to use keypad library #include //tells to use servo library

Servo myservo; //declares servo Password password = Password( "0000" ); //password to unlock, can be changed

const byte ROWS = 4; // Four rows const byte COLS = 4; // columns // Define the Keymap char keys[ROWS][COLS] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'*','0','#'} }; // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins. byte rowPins[ROWS] = { 9, 8, 7, 6 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins. byte colPins[COLS] = { 5, 4, 3 };

// Create the Keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){ Serial.begin(9600); Serial.write(254); Serial.write(0x01); delay(200); pinMode(11, OUTPUT); //green light pinMode(12, OUTPUT); //red light myservo.attach(13); //servo on digital pin 9 //servo keypad.addEventListener(keypadEvent); //add an event listener for this keypad }

void loop(){ keypad.getKey(); myservo.write(180); } //take care of some special events void keypadEvent(KeypadEvent eKey) { switch (keypad.getState()){ case PRESSED: Serial.print("Enter:"); Serial.println(eKey); delay(10); Serial.write(254); switch (eKey) { case '*': checkPassword(); delay(1); break; case '#': password.reset(); delay(1); break; default: password.append(eKey); delay(1); } } } void checkPassword(){ if (password.evaluate()) { //if password is right open Serial.println("Accepted"); Serial.write(254);delay(10); //Add code to run if it works myservo.write(0); //deg digitalWrite(11, HIGH);//turn on delay(10000); //wait 5 seconds digitalWrite(11, LOW);// turn off } else { Serial.println("Denied"); //if passwords wrong keep locked Serial.write(254);delay(10); //add code to run if it did not work myservo.write(180); digitalWrite(12, HIGH); //turn on delay(5000.); //wait 5 seconds digitalWrite(12, LOW);//turn off } }

Step 6: Run the Device ..

Picture of Run the Device ..

Power The Arduino And test everything...

Default password is 0000

Step 7: How to Change Password

Picture of How to Change Password

As Shown in Pic Above Change the Highlighted Number ...

and upload the code.....

Frtizing file :-https://drive.google.com/file/d/0B-ucVP7iDSacSnpZR...

or

https://drive.google.com/file/d/0B-ucVP7iDSaccDdGV...

Comments

lolo1261 (author)2017-07-09

Hello,

Good job, i used the code for another project.

Just a tips :
If you don't reset the password when it's accepted, it still in memory.
So, if you just press the validate key, it's OK and that opens the door.
Better to use password.reset() after each time it's validate

SuhasA3 (author)2016-08-24

When i execute program i m getting like this please help

Arduino: 1.6.11 (Windows 7), Board: "Arduino/Genuino Uno"

sketch_aug24a:1: error: #include expects "FILENAME" or <FILENAME>

#include //http://playground.arduino.cc/uploads/Code/Password.zip //tells to use password library

^

sketch_aug24a:2: error: #include expects "FILENAME" or <FILENAME>

#include //http://www.arduino.cc/playground/uploads/Code/Keypad.zip //tells to use keypad library #include //tells to use servo library

^

exit status 1

#include expects "FILENAME" or <FILENAME>

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

SuhasA3 (author)2016-08-24

HI SIR,

Should I include #include //http://playground.arduino.cc/uploads/Code/Password.zip //tells to use password library while programming ????

seamster (author)2016-06-01

Cool! This is a nice looking little locking system. Thanks for sharing!

VaibhavC1 (author)seamster2016-06-06

Welcome My Pleasure...

About This Instructable

4,273views

24favorites

More by VaibhavC1:Arduino Door Locking System
Add instructable to: