Coding a Keypad

Introduction: Coding a Keypad

The objective of this project is to take a keypad and code it in such a way that it responds to a certain password which would be pre set in the code itself. I will then use this keypad to place on a pre made model safe. The objective of the project is to have the safe open if and when the right password is typed in. To help make this project I will be using an Arduino to help code the keypad. This way I will be able to set my own password and then have the Arduino perform any command I chose. I am really excited for this project, and am confident that it will work out well.

Step 1: Materials

The following are the material that I would require in order to complete the project.

  • Arduino- 1
  • Keypad- 1
  • Servo Motor
  • Arduino wires
  • Breadboard
  • Laptop (with Arduino application installed)

Step 2: Coding the Keypad

The most important step of this project is to code the keypad in such a way that a computer can read which numbers are being inputted and then tell another source whether it is the correct or incorrect password. For this project I am using Arduino, therefore I used some online resources to try to understand how to wire and then code the keypad to fit the above listed requirements. What I found on the net was that I would have to wire each output on the keypad to a pin number on the Arduino and then the ground output on the keypad to ground on the Arduino. The code I used is attached in the pictures. This code allows the computer to read what numbers are being punched in as well as determine whether the password is right or wrong.

Step 3: Attaching the Servo Motor

Having the computer read inputs and thus determine whether a password is right or wrong is one thing, but then having it perform an action after that would really be cool! In order to achieve this we hooked up a servo motor to the Arduino. The outer most output on the servo goes to 5V whereas the other two go to pin numbers (you can use pins a0 and a1 incase you run out due to the keypad). Once this is done, you put down in your code how much you want the motor to rotate depending on whether a correct or incorrect password is typed in. The code for this is provided in the pictures.

Step 4: EXTRA- Hooking It Up to a Safe

Now that the mechanism is functional, I thought I could take this project a step further by attaching it to an object such as a safe to see if my project can help control the opening and closing of it. I got my hands on a ready made cardboard safe (a school mate of mine had made (Cardboard Safe)) which essentially had a box with a strip of cardboard that would move in and out therefore controlling the possibility of opening or closing the safe. I decided to attach the servo motor to that cardboard strip- which would then control the movement of the strip hence the opening and closing of the safe.

Share

    Recommendations

    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest

    Discussions