User:1sfoerster/enes100/fall2013/p2Combo

Problem Statement (Finish description)

 * 1) Electronics was packaged onto a frame
 * 2) All sub-assemblies including stepper motor control, solenoid and switch were demonstrated
 * 3) Code was written for the arduino to exercise the three sub-assemblies.

Conceive
Previus team pages:

https://en.wikiversity.org/wiki/Combo_Lockpick/Howard_Community_College/Fall2012/p1-502-hwht https://en.wikiversity.org/wiki/ComboLockPick/Howard_Community_College/Fall2012/p1-502-cmsb https://en.wikiversity.org/wiki/Combo_Lockpick/Howard_Community_College/Fall2012/p1-502-hwht/Friction_Decision_Matrix

Our previous page: https://en.wikiversity.org/wiki/User:1sfoerster/enes100/fall2013/p1Combo

Be able to open a Masterlock without knowing the combination Ability to easily remove abandoned locks from public lockers
 * Replace bolt cutters
 * Locks still useable after removal
 * Retrieve forgotten combination

Original project by students at Olin College: http://boingboing.net/2011/03/10/combination-lock-cra.html

Step by Step guide to how a masterlock can be opened: http://www.markedwardcampos.com/files/gimgs/13_mcamposfinal.png

Design

 * Two Previous Iterations Found
 * Fall 2012 Team 1
 * Fall 2012 Team 2
 * Tutorial of Combo Lock Pick Method Found
 * Wikihow steps for cracking a Masterlock Combo Lock.
 * Hackaday step by step guide for Masterlock.

Material
Material: This is a continuation of the combo Lock Project. This week, my job is to create a program that works with both the Solenoid and Sensor.the first curve was understanding how to use an arduino so i can get the arduino communicating with the solenoid. the plain for this project is, when ever the stepper motor stops the solenoid checks if the lock is undone this is do to the large magnet that retracts the arm when giving power.
 * Arduino
 * Power Switch Tail
 * Sensor
 * Solenoid

A basic program that can be used to active the solenoid is the blink program. this program can be found in the arduino software. this program will allow you to get basic understand on how the arduino and solenoid work.

steps to find blink program:
 * Click File
 * Examples
 * Basics
 * Click on Blink

Solenoid activated using Port 13 on the Blink program: http://www.youtube.com/watch?v=3N0Egcpq_8c&feature=youtu.be

I moved the Solenoid activation to port 5 to see what happens: http://www.youtube.com/watch?v=w8uWqiPF8JI&feature=youtu.be

Blink Program
How I got to the blink program:  File:Arduino Blink File.JPG|This is a file that is already made on the Arduino program on the school computer. It is the blink program. File:Blink File.JPG|I changed the blink file to activate on the arduino when the orange wire is in port 5, not 13. Because port 13 is needed for the motor program. File:Arduino Connected to computer.JPG|Arduino linked to computer to send it the program to run the solenoid. File:Wires Coming off of the power cable.JPG|The power cable connects to the solenoid and to the arduino. The red wire is the ground. The orange wire is what runs the program. File:Wires in Arduino.PNG|Red goes to the ground, and when the orange goes into the correct port it shoots up the solenoid. File:Solenoid Pulled Up.PNG|The solenoid is told by the arduino to contract up. File:Solenoid Switch.JPG|This switch could be used to mount on top of the solenoid to tell it when it hits it to stop the program because the combination has been solved.  Arduino connecteed to the Solenoid:
 * Engshortcut
 * Arduino
 * Ports
 * USB serial port (Com 14)
 * Blink Program

http://www.youtube.com/watch?v=qMwK1ov807k&feature=youtu.be  File:Power Source Plugged Into Solenoid.JPG|Power source plugged into solenoid File:Power Source Back.JPG|Power Source screwed in to the upright board.  Video of the Combo lock relining back to change out a lock, then coming back into position:

http://www.youtube.com/watch?v=cFAW6Mqz9Vo&feature=youtu.be

After getting the Blink program, i connected the arduino to the computer and uploaded the program. if done properly the led on the board should be flashing on/off every second. next, i Plugged in the Power Switch Tail and took hold of the two wire. the red wire will be plugged in to the port labeled ground and orange wire will go into port 13 which will active the solenoid.

After playing around with the arduino program, i was able to modify the current blink program to help the solenoid snap a lot better by decreasing the High output to 50ms and increasing the Low output to 2000ms. this gave the solenoid a faster snap then a longer release when the solenoid is active.

The modify Blink code that gave the solenoid a more Natural snap: http://www.youtube.com/watch?v=JkO884DU_N4&feature=youtu.be

Mounting the Arduino
This is a broken arduino that we mounted before the one that will work with our project. We first mounted this one to ensure that we had a way to put it on the base first without attemping to put on the working arduino.  File:Rubber pieces that will be under the arduino.JPG|These rubber pieces go under the arduino, and around the screws. File:Rubber pieces on the board.JPG|This is showing where the rubber pieces will go on the wood. File:Top view of arduino screwed into the board.JPG|Top view of arduino screwed into the board. File:Rubber under the arduino.JPG|Rubber under the arduino. File:Side view of rubber under the arduino.JPG|Side view of rubber under the arduino File:Rubber under the top two screws.JPG|Rubber under the top two screws. File:Screws with rubber through the arduino.JPG|The screws run through the arduino with the rubber on the bottom to keep the arduino from coming into contact with the wood. 

Extending Wires
 File:Ground wire does not reach the arduino.JPG|Ground wire does not reach the arduino. File:Wires connected before they are extended.JPG|The wires need to be extended because when the solenoid is pulled back the wires are too short to stay connected to the arduino. File:Power wire is extended.JPG|Power wire is extended by soldering an extra wire to it. File:Heat wrap on power wire.JPG|After being soldered the power wire is wrapped in a heat shrink wrap. File:Ground wire is extended.JPG|Ground wire is extended by soldering. File:Ground wire is extended again.JPG|Ground wire is extended again by soldering.  Video of the wires being to short to stay connected while the solenoid and lock are pulled back:

http://www.youtube.com/watch?v=RnwxFWSSMJI&feature=youtu.be

Video of the solenoid and lock being pulled back, the wires stay in place:

http://www.youtube.com/watch?v=1t0uR5_pfHs&feature=youtu.be

 File:Hole drilled for wires.JPG|a hole is drilled to channel the wires through. File:Wires running along bottom.JPG|Wires running along bottom. This makes them hidden from sight. File:Wires coming through the hole.JPG|Wires coming through the hole, but they aren't long enough. File:Wires go underneath the wood.JPG|Wires go underneath the wood. File:Wires soldered.JPG|Wires extended to reach the arduino. File:Wires coming through the bigger hole.JPG|wires are now long enough. File:Wires connected to the arduino.JPG|Wires coming through the hole and connecting to the arduino. File:Wires running under motor.JPG|Wires running under motor. File:Hook 1 holding wires in place.JPG|Hook by the hinge is holding the wires in place as they come in from the power block. File:Hook 2 holding wires in place.JPG|Second hook is placed by the the hole under the arduino. 

the regular wire on the Optical switch was very weak. I soldered new wire on to exciting wire to increase it strength and durability. this will allow for a better connection point for the the arduino. after these connection as been made, this should give better contact points on the arduino.

Solenoid Hook
 File:Thicker hook.JPG|A thicker hook is needed connect to the lock because the solenoid would bent the thinner one out of shape. File:New thicker hook.JPG|thicker hook connected to lock.  Video of the thicker hook connected to the solenoid:

http://www.youtube.com/watch?v=ZnLiqRuQBjM&feature=youtu.be

Re-designing Gear Structure
 File:Motor Connected to gear.JPG|the motor needs to connect to the gears by moving forward because there is a line hat runs through the middle of the gear. File:Gears moved forward.JPG|The bearing board is moved forward so that the gears can be pushed back so the motors gear can hook up correctly. File:New screw placed through the gear..JPG|A thinker screw is placed through the gears and rubber piece because the old screw started to slip. File:Back view of new screw.JPG|The new screw is shorter so it doesn't poke out the back. 

Mounting Stepper Motor and Arduino
Video of gears being spun by hand:

http://www.youtube.com/watch?v=ETb02RsUdVU&feature=youtu.be  File:Arduino mounted.JPG|The arduino with the programs is mounted to the project. File:Side view of arduino.JPG|Side view of arduino mounted. File:Wooden block that will hold up motor.JPG|Wooden block that will hold up motor File:Wooden Block screwed in.JPG|The wooden block that will hold up the motor is screwed in. File:Motor on top the block.JPG|The wood block will hold up the motor so the gear doesn't scrap the wood. File:Metal clamp.JPG|A metal clamp is used to tighten up motor. File:Motor held in place.JPG|The motor is held in place by a metal clamp that is tightened.  Making the final mount for the motor, the 2in x 2in block is where the motor will sit so it will be next to secondary gear for the rubber mount.

Holding the Project together
<Gallery> File:Hooks on the main board.JPG|Hooks will be used to hold a string to keep the project from moving so much. File:Hooks on top and bottom.JPG|Hooks will hold the project together by the tension of a string. File:Fishing line used.JPG|Fishing line is tied and used to hold the project together. File:Steel cable connected to hook.JPG|Steel cable connected to hook. File:Cable_hooks.jpg|Both ends of the steel cable with hooks attached. File:Steal cable wrapped around hooks.JPG|The wire is wrapped around the hooks to hold the project together. </Gallery> strengthening the Structural integrity of the project board by replacing the fishing line with steel cables.

Code One
when using this code to operate the machnical switch, i was not getting any response from the led after the switch was activated. this program was suppose to label pin 13 as led, and label pin 8 as switch pin. when the switch is activated the arduino reads the signal as high and turns the led on, else the led should be low.

Code Two
For part two, the boolean was added to check the current state of the led. (boolean lastButton = LOW;) keeps track of watch the button did in the previous loop, and (boolean ledOn = false;) is used to keep track of the current state of the led. and they will help check things in the loop to help set thing to where there suppose to be.

this is the youtube video showing the problem: http://www.youtube.com/watch?v=t-3kIytQPeQ&feature=youtu.be

Code Three
Code to works, but has a bit of a problem. the led turns of and on but you can still see a dim light coming from the led. in order to solve this problem i made my own function. the function is suppose to return a boolean. (boolean debounce(boolean last)) debounce is now a function with input last, this is now define as a that determine the current value with the remaining of the program.

this is the youtube video showing the problem: http://www.youtube.com/watch?v=ib1kVmWDMzU&feature=youtu.be

Hooking up a Switch to Arduino
if your not confortable with writing you own code, the Analog in out Serial program can be found in the arduino software under (File, Example, Analog, and number three AnaloginoutSerial). this program works perfectly with the switch with now problem what so ever.

Implementation
The code currently being used to test the function of the project is shown below. It is able to properly operate the solenoid at the end of each combination attempt and will output the combination attempted at the end of each iteration. The next step for this is to devise an algorithm to more efficiently test combinations for the lock.

Operation
The project as it is currently assembled is shown below from both a top and side view. When testing the entire project together, it was found that activating the solenoid for too long of a period at once was causing the PVC piece to come unglued from the wooden structure.

<Gallery> File:Top_view_of_lock_picker.jpg File:Side_view_of_lock_picker.jpg File:Lock_holder_unglued.jpg </Gallery>

As the two videos below show, each part of the project functions individually, but the motor's primary gear does not mesh with the second gear properly. This results from a difference in tooth shape and pitch between the two gears. This will be addressed in the future.

<Gallery> File:Project_test1.ogv File:Motor_test2.ogv </Gallery>

Next Steps

 * Address tooth pitch problem, mesh together motor to shaft
 * Algorithm for efficiently opening lock
 * Enes150 project for coding
 * Better user interface
 * Enes100 or 150 in processing language
 * Self contained except power cord, press entire unit up to lock – new more refined design
 * Determine a more secure method of holding the lock in place