# Engineering Projects/ComboLockPick
## Problem Statement (Finish description)

Mechanism attached to a computer that can open a Masterlock combination lock.

## Conceive

Why
Opening a Masterlock without knowing the combination is not the goal. This can be done with a shim video.
Reuse abandoned Masterlocks by retrieving forgotten combination
Original Inspiration
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:
Physical Mechanism .. putting the lock into the device, mounting physical pieces, knob grabber
First Try at developing physical mechanism .. knob slipped video ... stepper motor turned, that's it
After considering sandpaper, clay, foam and putty, started with stopper from chemistry lab, drilled, scrapped out with dremel tool so it would grab the combo lock knob .. would design in openSCAD and make generic so fits all sorts of knobs in the future
Found piece of PVC pipe whose inside diameter fit the diameter of the combo lock, cut hole for hasp and mounted on board
Hinge added so that locks can be put in and taken out video
Hooks and cable added to hold together .. because the solenoid throws lots of weight around ... tried fishing line first
A variety of S hooks were tried, the smaller ones started bending
The thicker one worked
Rotating Shaft
Initially the stepper motor was attached directly to the combination lock.video
A roller skate bearing was mounted in some wood
A bolt was run through the rubber washer that grabs the lock knob
Screw head was filed down so it didn't interfere with grabbing the lock knob
put together
moving gears around to connect to stepper motor
Designed gear in OpenSCAD software modifying a gear found in thingiverse and printing on 3D printer .. is probably too big in diameter, gear ration is almost 1:1, probably makes stepper motor work too hard, heat up, draw too much current through the motor shield
Gear printed and connecting to stepper motor ... video of it turning with teeth meshed together
The gear mechanism was damaged every time a new lock was inserted. Ultimately the stepper motor was damaged. Several innovative solutions were tried that suffered the same fate. Success was achieved when the two bearing solution was abandoned. One bearing flopped while the lock was being replaced, but then when put back together, the knob on the combo lock turned into the second bearing or second support and the shaft locked into place.
Solenoid from dollar bill changer
Solenoid was found in a donated dollar bill changer ... turn off and on with extension cord plugged into AC wall outlet ... very strong .. video
Two dollar bill changers were received with the purchase of an old vending machine. The coin magazine or coin trays were missing so they were unusable. We took one apart and found a great relay in it.
They run from $25 to $30.
Testing to see if can pull lock open with zip tie .. and it can
Finding Relay driven by Arduino to switch Solenoid's AC power on and off
Reviewing existing relays
A type of relay with clear case top so can see and hear the physical switch close when a strong enough current is applied to the coil
Single coil causing four different switches to change position ... each can switch up to 3amps at 220volts either DC or AC
Video was made of the relay switching LED off and on with arduino blink .. can hear the relay switching in video ... physical wiring of the circuit needs to be cleaned up
Tired to use the relay out of old microwave oven
Gave up and purchased a Power Switch Tail II
Used 5 volts out of desktop PC power supply to test Video
Mounting PowerSupply Tail III on the mechanical assembly, cables coming out of the middle allow arduino to turn Solenoid off and on with blink program video
Plugging one end into Solenoid, other end into AC power
Stepper motor to turn the knob and test all combinations
First stepper motor .. ASTROSYN Minebea Tandon .. 17PS-C007-04 966000-001 .. 5 wire brown/red pair, white/green pair and black ground .. stopped working .. heated up ..
First motor shield .. also heated up .. when connected to first stepper motor .. In video can see solenoid working and hear stepper motor try to work ... this is the over heating situation
Probably the gear is too big ... too close to a one to one ratio ... asking stepper motor to work too hard ... need much smaller gear
Purchased adafruit motor shield 2 that can handle more current, picture is of the bottom of this shield .. it required a different arduino libaray
Found another stepper motor and it is pretty strong at turning the small gear video
Next step is to mount the new motor and perhaps change the small gear or change the big gear on the shaft to the combo lock knob.
Switch to tell if the solenoid has successfully opened the lock
A new project was formed to hack the Vernier laser photogate. This was completed successfully:
First considered a mechanical switch video but feared that the violent solenoid movement would make any mechanical connection a reliability problem
A special cable has to be built video.
The photogate can be powered by the USB cable video.
Test analog by putting green/white in Analog 0 and running the Example Analog AnalogInOutSerial Sketch video and watching the serial monitor
Mounting switch on apparatus
Came up with 3 different options that could potentially be used to attach the photogate to the ComboLock
Use a metal bracket and screw to attach the photogate to the backboard of combolock.
Use glue to attach photogate to the metal bracket and then screw bracket to the backboard of combolock.
Use Chemistry test tube clamp to mount photogate to the backboard of the combolock.
Option 1 could work but slight problem becomes apparent. Screws have to be screwed into photogate. The problem with this is that it could interfere with the wiring and other components of the photogate.
Option 2 is a different form of option 1 and could also work. but again there is a problem with this option as well. The solution is a permanent one and once the photogate is glued to the metal bracket it can not be swapped out if the photogate is faulty.
Option 3 seems like the best choice. Photogate can be removed and also positioned precisely as needed for the solenoid to break the laser beam. Went with option 3; however, major mods had to be done for this mounting option to work.
First, had to cut aluminum rod to the right length for it to fit properly on the chemistry test tube clamp.
Before cutting the aluminum rod, using metal hack saw to cut rod.
During the cutting of aluminum rod (measurements: 3.6 cm x 1.0 cm)
Filing down the cut rod, need to file down the sharp edges.
Next, flatten one end so it sit flush on the backboard of the ComboLock.
Before flatting the rod. Rod is round and would not sit flat on the back board.
During flatting of the rod. Used a hammer to flatten the rod on one end.
Once the rod was flattened drill a screw hole on the flattened end so a screw could be used to attach it to the ComboLock back board.
Before drilling hole. Used vice grips to hold the rod firmly in place during drilling.
Drilled hole in aluminum rod.
After drilling, final product to be used.
Now the chemistry clamp will hold the photogate. To move up and down will have to drill hole in wood. To move in and out loosen chemistry clamp.
Newly cut and drilled rods attached to clamp
Bracket without photogate, Thread portion screws into existing photogate hole.
Final step was to screw on flattened rod on to the backboard of the combolock and to attach photogate.
Screwed in the flattened rod on the backboard.
Final product :

## Implement

This section focuses on the software.
stepper motor testing software
Used the example programs that came with the original motor shield.
current code (has solenoid firing in it also)
//uses Adafruit Motor shield library
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include <utility/Adafruit_PWMServo Driver.h>
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.
switch testing software
Use arduino example>analog>analogyInOutSerial video. See design section on switch for more detail.
soleniod testing software
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.
Figuring out which arduino pins to use when combining all the programs
Writing software that tests all three assemblies sequentially in one sketch
Code that figures out all three combinations
Code that displays current progress and enters the third number found manually
do in processing ... so emulates entering the third number video ad displays progress :

## Operate

Operation manual, troubleshooting manual would go here.

## Demo

presentation

## 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