LockBox
AURDUINO LOCK BOX
Matt Otto, Zach Robbins, Monty Wonnacott
Heres a brief video of the lockbox in action, it will show if the codes right the green light will turn on and open, if its wrong it will shut or stay shut and then turn the red light on
our lock box on the outside locked up and ready to go
this is the servo in the box that when the code is inputted it will turn and unlock
When the code is put in wrong then the red light will turn on.
When the code is inputted correctly then the green light will turn on and the box will open up.
This is our board and setup
Diagram of the aurduino setup
THIS IS OUR CODE BELOW
#include <Password.h> //http://www.arduino.cc/playground/uploads/Code/Password.zip //tells to use password library
#include <Keypad.h> //http://www.arduino.cc/playground/uploads/Code/Keypad.zip //tells to use keypad library
#include <Servo.h> //tells to use servo library
Servo myservo; //declares servo
Password password = Password( "1379" ); //password to unlock box, can be changed
const byte ROWS = 4; // Four rows
const byte COLS = 3; // columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 5, 4, 3, 2 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 8, 7, 6 };
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
pinMode(11, OUTPUT); //green light
pinMode(12, OUTPUT); //red light
myservo.attach(9); //servo on digital pin 9 //servo
Serial.begin(9600);
keypad.addEventListener(keypadEvent); //add an event listener for this keypad
}
void loop(){
keypad.getKey();
}
//take care of some special events
void keypadEvent(KeypadEvent eKey){
switch (keypad.getState()){
case PRESSED:
Serial.print("Pressed: ");
Serial.println(eKey);
switch (eKey){
case '*': checkPassword(); break;
case '#': password.reset(); break;
default: password.append(eKey);
}
}
}
void checkPassword(){
if (password.evaluate()){ //if password is right open box
Serial.println("Success");
//Add code to run if it works
myservo.write(0); //160deg
digitalWrite(11, HIGH);//turn on
delay(500); //wait 5 seconds
digitalWrite(11, LOW);// turn off
}else{
Serial.println("Wrong"); //if passwords wrong keep box locked
//add code to run if it did not work
myservo.write(93);
digitalWrite(12, HIGH); //turn on
delay(500); //wait 5 seconds
digitalWrite(12, LOW);//turn off
}
}
Problems we encountered during the project is trying to use a servo. We have never used a servo motor before and could not code but after some tutorials and videos we figured it out very quickly and were able to get the box working. If we had the time or the money we would have used a better more sturdy box and had a secret way to open the box without the code. We had alot of fun with this project and if we had more time then we would have been able to do so much more with the project. Zach Robbins did well with wiring along with Matt Otto. Matt Otto and Zach worked hard with this site also taking great pictures and descriptions for the site. Monty did a great job with the coding of this box and project. It took a lot of hard work and teamwork to get this box running and looking good but in the end it came out well and we are all proud of what we accomplished.