Introduction: Access Control With Arduino + Keypad 4x4 + Servo (UPDATE)

Hi guys, I bring a new instructable for arduino, the control access with password, 4x4 keypad and a servo.

We will use the Password and Keypad librarie for arduino, besides using the servo library, but this project can also be modified by changing the servo, a motor reley or motor stepper, or any other ideas ...

This project can be used in different cases, for doors, Servo action, etc.. Here is the link of the video on youtube to see how it works, then explain step for the armed : D

Step 1: The Parts for the Project

We will need this parts for the proyect:

Arduino UNO or similar ($29.95)
http://www.sparkfun.com/products/11021

Servo motor - Large ($12.95)
http://www.sparkfun.com/products/9064

KEYPAD 4X4 (or similar) ($7.79)
http://www.ebay.com/itm/DATA-KEYPAD-4X4-BLACK-BLACK-KEYS-4-4-Switch-Key-x-/270347954381?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item3ef1fe68cd#ht_2720wt_1037

Proto Board  ($9.58)
http://www.olimex.cl/product_info.php?currency=USD&products_id=170&product__name=Proto_Board_Bread_board

Breadborad jumper wire pack ($10.59)
http://www.olimex.cl/product_info.php?cPath=21_138&products_id=872&product__name=Breadborad_jumper_wire_pack

Four resistor of 910 ohm

One resistor of 1k





Step 2: Preparing the Keypad

Well, now we must put the resistors,remember the potion of the pins of the keypad.

Output pins of keypad:

1 pin = col 1
2 pin = col 2
3 pin = col 3
4 pin = col 4

5 pin = row 1
6 pin = row 2
7 pin = row 3
8 pin = row 4

(look at the second image)

Now they must put three 910 ohm resistors on pin 1, 2 and 3 of the keypad, then put in the arduino digital pins of the NEXT form:

pins keypad  |  pins arduino
---------------------------------------
          1           |           8
          2           |           7
          3           |           6
          4           |           9        
          5           |           5
          6           |           4
          7           |           3
          8           |           2

Step 3: Preparing the Servo

You need put the servo of the next form :

Step 4: Connecting the LEDs

You need put Accepted LED (green) and Denied LED (red) in this way:

Step 5: (UPDATE) and Now, the Programming

You need this libraries:

Password librarie

Keypad librarie

Well, this is the code for arduino, you only need to change that write in bold and put your password.

And this is my new instructable, enjoy it :D

¡ Good luck !

Comments

author
bugwr made it! (author)2017-06-21

hi

how do I use an electromagnetic lock for this project

author
uNKNoWND3 made it! (author)2017-02-20

how to add 16x2 lcd
pleasse help me.. thanks

author
abdooooo made it! (author)2017-02-03

i want to control 360 servo such that when you press A1 the srvo rotate 60 degrees and A2 it rotate 120 and so on
i tried using many codes but none of them is working probably
the code is this
#include <Keypad.h>

#include <Servo.h>

Servo myservo;

int pos = 0;

const byte ROWS = 4; //four rows

const byte COLS = 4; //four columns

//define the cymbols on the buttons of the keypads

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}; //connect to the row pinouts of the keypad

byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad

Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup(){

Serial.begin(9600);

myservo.attach(10);

}

void loop(){

int position;

char customKey = customKeypad.getKey();

if (customKey){

Serial.println(customKey);

}

if(customKey=='1'){

// myservo.write(pos);

myservo.write(60); // Tell servo to go to 90 degrees

delay(3000);

}

author
PrashanthN6 made it! (author)2017-01-31

Will u please tell me

author
PrashanthN6 made it! (author)2017-01-31

Use of resitors in this project

author
abdooooo made it! (author)2017-01-21

Hello, can i want to connect 2 continuous rotational servos with 4*4 keypad, the keypad determine the angle each servos goes to
could you help me with the code please?

author
harshil_kapadia made it! (author)2016-11-12

its showing this error

what to do?

IMG_20161112_231721600.jpg
author
mohammad2314 made it! (author)2016-10-25

hi , where is theschematic project

author
ilhama9 made it! (author)2016-03-02

Can you give me a sketch of keypad 4x4?

author
kau_cinta_ku made it! (author)kau_cinta_ku2016-04-10

#include <Keypad.h>

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] = {2, 3, 4, 5}; //connect to row pinouts
byte colPins[COLS] = {6, 7, 8, 9}; //connect to column pinouts

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

void setup() {
Serial.begin(9600);
}

void loop() {
char key = keypad.getKey();

if (key != NO_KEY) {
Serial.println(key);
}
}

author
Raj Barhate made it! (author)Raj Barhate2016-05-10

it is saying there is no keypad.h

author
JoãoS86 made it! (author)JoãoS862016-05-14

you problably dont have that library installed... download that library... then go to arduino's folder and put the library inside a folder called libraries

author
MehmeteminP made it! (author)2016-04-13

CODE?

author
LindimV made it! (author)2016-03-08

How does it work if i have a 3x4 keypad is it the same but instead of using 8 pins i use 7 ?

author
kau_cinta_ku made it! (author)kau_cinta_ku2016-04-10

you will have to redefine the keymap to fit your keypad

author
athomsen3 made it! (author)2016-04-06

So if I want to make the arduino open a garage door when pushing the right password followed by "A" and turning on and off alarm by pushing the right password followed by "B". Can anyone help me do that. Thank you in advance

author
KeinToast made it! (author)2016-03-10

Sup, i tried to make this for my own too but i have a small Problem. (First Project)

C:\Users\(Censored)\Desktop\Keypad_servo\keypad_password_servo_ v1.1\keypad_password_servo\keypad_password_servo.ino:5:23: fatal error: Password.h: No such file or directory

#include <Password.h>

^

compilation terminated.

exit status 1

Fehler beim Kompilieren. (German: Failure)

Can you help me?

author
zain siddiqui made it! (author)2016-01-31

can somebody tell me what is the password?

i have me the circuit. but its not working without password

author
asmaasma made it! (author)2015-11-30

i can't find the code plzz help me

author
ea. k made it! (author)2015-10-02

I made it... Thanks a lot

temp_-1611167851.jpg
author
nyatuv made it! (author)2013-04-13

can i use arduino mega?

author
GeorgeBgk made it! (author)GeorgeBgk2015-09-29

Of course, you can!

author
SavageO made it! (author)2015-07-31

@camilo.n1012

do we have to use the resistors for the keyboard?

author
GeorgeBgk made it! (author)GeorgeBgk2015-09-29

No, keypad library uses internal pull up resistors

author
SavageO made it! (author)2015-07-31

I cant get it working,when I enter the password and press A nothing happens

author
RIJO VADAKKAN made it! (author)2015-07-24

Thanks

11791785_985315988185337_519202622_n.jpg
author
عامرا made it! (author)2015-07-15

author
carl.cortesnazareth made it! (author)2014-11-18

When I plug in my servo to my arduino it starts spinning without stopping. How do I fix this?

author
JuanL7 made it! (author)JuanL72015-05-31

myservo.detach

author
Shark123456 made it! (author)2015-03-25

can somebody please copy and paste the code into the comment section? I can't seem to access the zip file. I would love to make this but without the code it kinda impossible

author
camilo.n1012 made it! (author)camilo.n10122015-03-25

Hi, you can download the file from this link: http://goo.gl/ChO877

author
zinedine made it! (author)2015-01-26

Hi guy, I have just handmade a matrix keypad for arduino, I'll use that in control driver motor servo 250VAC. But it was noise when I put in the box a metal. It's mean it run, however I didn't pressed keypad. So how about I can filter noise?

author
camilo.n1012 made it! (author)camilo.n10122015-01-26

Hi, i don't understand your question on the issue, if you can be more explicit to help I'd appreciate. Regards !

author
hisham.goda.92 made it! (author)2015-01-25

@camilo.n1012 , please when i write #include <Keypad.h> , the keypad word be in black not in red , and when i upload the code , the arduino does not recognize the keypad , is there any solution for that ?

author
camilo.n1012 made it! (author)camilo.n10122015-01-25

You may have problems with the address of the file, check in the folder "/ libraries" of Arduino IDE if the file.h is there. It should be in orange the code. If you follow the problem let me know and I give you another solution. Greetings !!

Captura de pantalla 2015-01-25 a las 23.14.46.png
author
tornado.abood made it! (author)2014-12-05

Where is the code of project ?

author
camilo.n1012 made it! (author)camilo.n10122014-12-09

Hi, you can download the code from here: https://www.instructables.com/files/orig/FKM/G6W9/HYR3FXB9/FKMG6W9HYR3FXB9.zip

author
masterji made it! (author)masterji2014-12-15

seem it cannot be found...can you please give the right link?

your help is much apreciated.thank you

author
camilo.n1012 made it! (author)camilo.n10122014-12-16

This is the new link: http://goo.gl/2Lo0fC

Good Luck !

author
caserpsychocgo made it! (author)2014-09-24

donde va el password como lo meto porque si lo dejo en letras negras me da error

author
camilo.n1012 made it! (author)camilo.n10122014-09-25

Hola ! El pasword lo defines en el mismo archivo .ino, en la variable "Password password = Password( "your_password" );", ubicada en la linea 20 del codigo, de todos modos te dejo la imagen de muestra.
Saludos y éxito !

Captura de pantalla 2014-09-25 a la(s) 12.36.08.png
author
camilo.n1012 made it! (author)2014-08-12

Sorry for not having answered the guys posts, but I had a problem with the mail.

The code already update, if they have more doubts, I can write to me mail camilo.nunez@cnf.cl or send a MP.

Regards !

author
hayes255 made it! (author)2014-07-16

Camilo.n1012 the code needs to be updated

author
hayes255 made it! (author)2014-07-15

I can't get the password librarie

author
kschwartz5 made it! (author)2014-07-07

camilo.n1012, the code isn't updated and needs to be so that it will continue to work. Please update it soon.

-Thanks

author
mekaci89 made it! (author)2014-06-06

The BYTE term seems to be invalid for Arduino 1.X

I am getting same error too. Please update this Instructable, thanks.

author
r.raj936 made it! (author)2013-05-19

I made one of this kind and when I was testing there was a power failure and I had to be out till I got my spare keys.

author
Edward_ made it! (author)2013-04-16

The BYTE term seems to be invalid for Arduino 1.X, what version did you use?
I'm trying to convert. Can you update this Instructable? or add updated code?
Thanks

author
kjsrocks made it! (author)2013-01-23

could you use an ir remote insted of a keypad if possible a code too thanks.

author
matoran_nuparu made it! (author)2012-12-13

Hi! Nice instructable! but the link to the password library doesn't work. here's correct:
http://playground.arduino.cc/Code/Password

About This Instructable

134,922views

301favorites

License:

More by camilo.n1012:Control Access of Arduino YÚN with MySQL, PHP5 and PythonAccess control with Arduino + Keypad 4x4 + Servo (UPDATE)Save data of temperature and humidity on MySQL with Arduino Uno and Wifly
Add instructable to: