Hello everyone! Today i want to show you my idea of making a very simple and cool code lock. It is not like other locks, it has no numpad and contains only 4 parts! Interested? So lets start!
Step 1: Components We Need
As i said above, we need only 4 components to make this device, so here they are:
1) An Arduino (i used nano) - this will be a brain of all system;
2) A servo motor - it is a locking element, you can use any other stuff you like for this purpose, tihs is all on your fantasy;
3) 10k rotating potentiometer;
4) A small button - i used a button from old broken mouse;
and.....that's all! Yes, lets start building!
Step 2: Assembling
The idea is to add a button mode to a potentiometer, so i invented this design:
Then i tried to repeat this on a breadbord:
Then to make a handle i drilled a small hole in a pvc pipe cap. I heated it up and pressed to the axle.
Next i made a demonstration case from plastic box i found in electric shop.
This is not a perfect design, it is just to show an idea!
Step 3: Upload a Sketch
When you soldered all this together, the last step is to download two sketches. First, you need to draw something on this device. These lines are separating zones with digits of combination. To draw them correctly, open the second sketch "codelock_test", upload to arduino and open com port. You'll see some strange numbers, but if you start tuning the handle of potentiometer you'll find out the princip. First, draw a little line on the handle, turn it to a left limit of potentiometer and draw there another line, right near the first one (as it showed on photo).
On the screen you'll see "9" or "0". Start turnig the hadle slowly and look to the number at the screen. When it changes (from 9 to 8 or from 0 to 1) stop, and draw a line near the first one at this point, where the nubers are changing. Continue turning and drowing like this until you reach the right limit.
Now you know where to turn the handle to reach certain digit.
Start realizing the princip?)
Step 4: Final Adjustments
Yes, you're right! This is the similar mechanish that they used in tose old disc telephones.
To type a number just turn the handle with small line to the sector withthis number and press the hadle. Do it 4 times (the combination contains 4 digits) and you'll unlock it!
It also has a protection - if you're incorrect 3 times the system freezes for a period of time you can adjust in the sketch.
This all you can adjust in sketch.
To see how it works watch a video!
Here are the sketches:
Step 5: Video
Sorry for my bad english and quality of video, but this is all i have)