User:1sfoerster/enes100/spring2014/p0ComboLock

=Problem Statement (Finish description)= Mechanism attached to a computer that can open a Masterlock combination lock.

= Conceive =


 * 1) Opening a Masterlock without knowing the combination is not the goal. This can be done with a shim video.
 * 2) Reuse abandoned Masterlocks by retrieving forgotten combination


 * Original project by students at Olin College
 * Step by Step guide to how a masterlock can be opened:
 * Wikihow steps for cracking a Masterlock Combo Lock.
 * Hackaday step by step guide for Masterlock.

=Design=
 * The algorithm or steps to figuring out the combination of a Masterlock manually are well known.
 * Videos exist on how to do this.
 * The goal is to automate this process.
 * This design section here focuses on the mechanical subsystems and electrical components:

=Implement= This section focuses on the software.

Used the example programs that came with the original motor shield.

//uses Adafruit Motor shield library
 * 1) include 
 * 2) include 


 * 1) include 

Adafruit_MotorShield AFMS = Adafruit_MotorShield;

//AF_Stepper motor(200, 2); Adafruit_StepperMotor *motor = AFMS.getStepper(200,2); int solenoid = 6; //set solenoid to digital pin 6 int first; int second; int third; void setup { Serial.begin(9600);   // set up Serial library at 9600 bps Serial.println("Complete test of stepper motor."); AFMS.begin;           // create with default frequency 1.6 kHz motor->setSpeed(120);   // 120 rpm // initialize the digital pin as an output pinMode(solenoid, OUTPUT); digitalWrite(solenoid, LOW); } void loop { //continue interations until lock is opened combinations; } void combinations { for (first = 1; first < 40; first++){ for (second = 1; second < 40; second++){ for (third = 1; third < 40; third++){ motor->step(first*5, FORWARD, DOUBLE); delay(250); motor->step(200, BACKWARD, DOUBLE); motor->step(second*5, BACKWARD, DOUBLE); delay(250); motor->step(third*5, FORWARD, DOUBLE); delay(250); digitalWrite(solenoid, HIGH);  // turn the solenoid on (HIGH is the voltage level) delay(20);                    // wait for a 0.02 seconds digitalWrite(solenoid, LOW);   // turn the solenoid off by making the voltage LOW delay(100);                    // wait for a tenth of a second Serial.print("Combination attempted is "); Serial.print(first); Serial.print(", "); Serial.print(second); Serial.print(", "); Serial.print(third); Serial.print("."); //finish with three full forward rotations motor->step(600,FORWARD, DOUBLE); delay(1000); }    }  } }

If get error message such as "AF_Stepper does not name a type", then need to download the driver from [| Adafruit]. This link is to the driver for the motor controller version 1.

Use arduino example>analog>analogyInOutSerial video. See design section on switch for more detail.

Can use the example>digital>blink program if solenoid is attached to digital pin 13.

Change on to 50ms and off to 200ms for testing purposes.

Want high only long enough for the switch to test if the right combination has been found. Don't know this yet.


 * do in processing ... so emulates entering the third number video ad displays progress

=Operate= Operation manual, troubleshooting manual would go here.

=Demo= presentation

combo lock presentation 03/27

=Next Steps=
 * Spin Off Project: Design knob grabber in openSCAD and then print on makerbot so can grab any serrated knob in the future
 * Mount new stepper motor
 * Redo gears so that stepper motor has really small one on it's shaft and really big one on the knob shaft
 * Work on code that tests solenoid, switch and stepper motor, then start doing some reliability testing
 * Find the combination of a lock by hand using one of the internet video's
 * Write receiving processing sketch running on computer and sending arduino sketch that communicate through a USB cable