Arduino Keypad With Motor – Tinkercad
Arduino Keypad With Motor – Tinkercad

This project is about setting up and configuring Arduino Keypad with Arduino Servo Motor. We can type the Password by Keypad if the Password is correct, then the MicroServo will turn around and the LED Green Light will be on, and if the password typed by Keypad is Wrong, then the Servo will not be opened and the LED Red Light will be on.

The TinkerCad Diagram

You can use this scenario for automated doors, gates, windows, and any other similar uses. All the steps have been explained in our YouTube Training Tutorial. Click here to watch it. The codes are as below.

#include <Servo.h>
#include <Keypad.h>
Servo ServoMotor;

char* password = "789"; 
//You can change the Passowrd

int position = 0;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
byte rowPins[ROWS] = { 9, 8, 7, 6 };
byte colPins[COLS] = { 5, 4, 3, 2 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

// Create two variables for LED Lights
int RedpinLock = 12;
int GreenpinUnlock = 10;
void setup()
pinMode(RedpinLock, OUTPUT);
pinMode(GreenpinUnlock, OUTPUT);
void loop()
char key = keypad.getKey();
if (key == '*' || key == '#')
position = 0;
if (key == password[position])
position ++;
if (position == 3)
void LockedPosition(int locked)
if (locked)
digitalWrite(RedpinLock, HIGH);
digitalWrite(GreenpinUnlock, LOW);
digitalWrite(RedpinLock, LOW);
digitalWrite(GreenpinUnlock, HIGH);

Related Links

  • To watch the step by step YouTube tutorial Click Here
  • To access TinkerCad Project Click Here


Share on facebook
Share on twitter
Share on whatsapp
Share on linkedin
Share on telegram
Share on email

1 thought on “Arduino Keypad With Motor – Tinkercad”

  1. Pingback: IoT Project, Setting up Keypad with the password - Soshiance Technology

Leave a Comment

Your email address will not be published.

You might also enjoy