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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Parts for the Project

We will need this parts for the proyect:

Arduino UNO or similar ($29.95)

Servo motor - Large ($12.95)

KEYPAD 4X4 (or similar) ($7.79)

Proto Board  ($9.58)

Breadborad jumper wire pack ($10.59)

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 !

2 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

67 Discussions


2 years ago


how do I use an electromagnetic lock for this project


2 years ago

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


2 years ago

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] = {






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(){




void loop(){

int position;

char customKey = customKeypad.getKey();

if (customKey){




// myservo.write(pos);

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




2 years ago

Use of resitors in this project


2 years ago

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?


Reply 3 years ago

#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() {

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

if (key != NO_KEY) {

JoãoS86Raj Barhate

Reply 3 years ago

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


3 years ago

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

1 reply

Reply 3 years ago

you will have to redefine the keymap to fit your keypad


3 years ago

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


3 years ago

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?

zain siddiqui

3 years ago

can somebody tell me what is the password?

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


3 years ago

i can't find the code plzz help me