Lock Box with Keypad

There are a few components to a keypad safe. The first is the keypad. I use a six digit code. When entered in the right order, the motor spins 90º, allowing the door of the safe to open.

Engineer

Cameron B

Area of Interest

Electrical Engineering/ Coding

School

Scarsdale High School

Grade

Rising Junior

First Milestone

My first milestone was getting a specific input on the keypad to get an output. I used an LED as my output and only had a one digit as a password. Challenges I faced included finding the right Arduino library, identifying errors in the code, and wiring the circuit incorrectly.

Snippet of the code used for the keypad lock

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

if (key){
if(key == keycode[progress]){
progress ++;
}
else{
progress = 0;
}
}
if(progress == 6){
servo.write(90);
delay(3000);
servo.write(0);
progress = 0;
}
Serial.println(progress);

Explanation of code

The first line matches up the button that was pressed on the keypad with the number represented by that button. Next, the progress of how many correct keys pressed is recorded. If the key pressed is correct, the progress increases by one. If a key outside of the key code is pressed, the progress resets. Then, once the six correct numbers are pressed in a row, the a servo motor spins 90º. This represents how the physical lock would spin if attached to the servo on the box.

screen-shot-2020-07-24-at-9.44.59-am

Second Milestone

Securing the lock on the box

Motor Setup

screen-shot-2020-07-24-at-9.31.58-am

My second milestone was creating a sturdy, secure lock for the box. I struggled with this for a couple of days as I tried to use the parts I had to secure the pin I connected to the motor. Every idea I tried was limited by the flexibility of the arm. The plastic arm always bent backwards and the box opened without much force. I tried using two motors to counteract this, but the motor did not have enough torque to spin the opposite side. However, I had the right idea. I ditched the second motor and instead used a hook and hit glue to secure the second arm while allowing it to pivot.

RC Car: Project 2


First Milestone

My first milestone was getting my motors to spin. This process required a lot of research and I learned lots about the motors and the motor driver.

Coming Soon

Start typing and press Enter to search

Bluestamp Engineering