Are you bad with combination locks? Our device is designed to unlock any standard master lock. Enter in the three digit combination from your mobile device and allow Unlock that Lock to take care of the rest! From school lockers to gym lockers let Unlock that Lock solve your lock problems so that you don't have to worry about permanently locking up your stuff!


Intro Video: https://youtu.be/vKBUFM5oecc


Our project consisted of an Arduino, h-bridge, and stepper motor. The Ardunio allowed us to translate the 3 digit combination into angled rotations for the stepper through the following code:

  //Declare pin functions on Redboard
 define stp 2
 define dir 3
 define MS1 4
 define MS2 5
 define EN  6

 //Declare variables for functions
 char user_input;
 int x;
 int y;
 int state;

 void setup() {
    pinMode(stp, OUTPUT);
    pinMode(dir, OUTPUT);
    pinMode(MS1, OUTPUT);
    pinMode(MS2, OUTPUT);
    pinMode(EN, OUTPUT);
    digitalWrite(stp, LOW);
    digitalWrite(dir, LOW);
    digitalWrite(MS1, LOW);
    digitalWrite(MS2, LOW);
    digitalWrite(EN, HIGH);

  Serial.begin(9600); //Open Serial connection for debugging
  Serial.println("Begin motor control");
   Serial.println();
//Print function list for user selection

 }
   //Main loop
 void loop() {
     while(Serial.available()){ 

    digitalWrite(EN, LOW); //Pull enable pin low to allow motor control

     int input1 = Serial.read();  //reads the first digit 
     int input2 = Serial.read();   //reads the second digit 
     int input3 = Serial.read();   //reads the third digit 
     int a = 200 - (5 * input1);
     int b = 0;
     int c = 0;

  if (input1 > input2) {  //determines number of steps a to b 
     b = 200+(5*input2);}
   else {
     b = 200-a + (5*input2); }

 if (input3<input2){ //determines number of steps b to c 
   c = input3 * 5; }
 else {
   c = b + 200 - (5 * input3); }


 for (int i = 0; i < 600; i++) { //clears lock 
     digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse"
     digitalWrite(stp,HIGH); //Trigger one step
     delay(1);
     digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
     delay(1);
     }    


  for (int i = 0; i < a; i++) { //moves right to first digit 
      digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse"
      digitalWrite(stp,HIGH); //Trigger one step
      delay(1);
      digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
      delay(1);
       }    

  for (int i = 0; i < b; i++) { //moves left to second digit 
     digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
     digitalWrite(stp,HIGH); //Trigger one step forward
     delay(1);
     digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
     delay(1); 
       }

  for (int i = 0; i < c; i++) { //moves right to third digit 
          digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse"
          digitalWrite(stp,HIGH); //Trigger one step
          delay(1);
          digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
          delay(1);  
        }
   digitalWrite(stp, LOW);
   digitalWrite(dir, LOW);
   digitalWrite(MS1, LOW);
   digitalWrite(MS2, LOW);
   digitalWrite(EN, HIGH);
 }

}

Since the stepper has 200 steps and the lock has 40 digits, each 9 steps is 1.8 degrees which means every 5 steps is one incrementation on the lock. We chose to use a stepper rather than a servo because the stepper allows for more precision and it locks in place after every step. The H-Bridge was used to translate the output from the Arduino into pulses that the motor could operate through. The user only has to input the three digits through the serial monitor and center the lock at 0 for Unlock It! to work.

Share this project:

Updates