This started out as a bit of a joke project, but turned out to be surprisingly accurate at judging knocks. If the precision is turned all the way up it can even detect people apart, even if they give the same knock! (Though this does trigger a lot of false negatives, which is no fun if you're in a hurry.)
It's also programmable. Press the programming button and knock a new knock and it will now only open with your new knock. By default the knock is "Shave and a Haircut" but you can program it with anything, up to 20 knocks long. Use your favorite song, Morse code, whatever.
Maybe a video will explain it better:
Important Notes:
(I hate to even have to say this, but since someone's going to say it, I'll say it first:)
1) This is for entertainment purposes only. Really. This decreases the security of your door by adding another way to unlock it, and it makes your unlock code known to anyone who can hear. If you put this on your door, be sure to carry your key too. The batteries might die, the suction cups might fail or you might forget your knock. Don't complain to me if someone imitates your knock and steals all your stuff, you've been warned.
For obvious improvements to safety, security and whatever, see the final page of the Instructable.
2) This is not a project for a beginner! Read through it carefully and be sure you understand it before you start! I will not take time to answer questions that are already in the instructions or from people who have gotten in over their head.
(If you think this project is too complex you might go here and sign up for the kit mailing list. The kits will be much more simple than this.)
Sorry about that. Now that that's out of the way, lets get to work.
Remove these ads by
Signing UpStep 1Tools, Supplies, And Skills
(If this all looks too challenging, you might consider signing up to the kit mailing list which, when available, will be much easier and a lot more simple.)
Time:
This project will take several hours to complete.Skills:
To complete this project you should be able to do the following:These are important! If you're not sure if you have these skills, read through the entire Instructable and make sure you understand it before starting anything!
- Basic soldering.
- Read a basic schematic.
- Basic knowledge of microcontrollers (I'll be using the Arduino.) This means you know what one is, how to upload data to it, and how to make minor changes to code.
- Improvisation. There are many ways to do this project, and you will have to make changes based on how your door and lock works.
Tools:
- Drill (ideally a drill press) and an assortment of drill bits.
- Saw capable of cutting PVC pipe. (ie: Pretty mcuh any saw.)
- Soldering iron and solder.
- Pliers.
- Screw drivers.
- Heat-shrink tubing and/or electrical tape.
- Wire stripper.
- Vice.
- Safety glasses.
- Gloves.
Materials:
(The links are for example only, I don't necessarily recommend or have experience with any of these vendors. Feel free to suggest other sources in the comments.)Electronics:
- 1 Arduino Duemilanove (Or compatible. Or really any microcontroller with at least 1 analog input and 3 digital outputs.) Buy from here, here, or here. And other places.
- 1 5v Gear reduction motor. The higher torque the better. Here's a good one. (14-16mm diameter is ideal because it fits inside of 1/2" PVC pipe.) I recommend one with at least 15oz/in (11 N-cm) of torque at 5v to turn a basic lock. 1
- 1 Piezo speaker. (30mm) similar to this. You can use larger or smaller ones, smaller will be less sensitive.
- 1 SPST momentary pushbutton. (normally "off")
- 1 Red LED
- 1 Green LED
- 1 NPN Transistor P2N2222A like these or these (or similar).
- 1 Rectifier Diode (1N4001 or similar) this or this will do.
- 1 2.2k ohm resistor (1/4 watt)
- 1 10k ohm resistor (1/4 watt)
- 1 1M ohm resistor (1/4 watt)
- 2 560 ohm resistor (Or whatever will run your red and green LED's at 5v. How to tell.)
- 1 small piece of perf board. 5x15 holes or longer. (example)
- 1 9 volt battery clip and 9v battery. (Or any other way you can think of to get 7-12v to the Arduino. A wall adapter like this is a great option so you don't have to worry about batteries running out. 6 AA's would be another option for longer lasting power, but it will bring down the suction cups.)
- Connector wire. 20 gauge or narrower flexible wire in a number of colors for connecting the electronics together.
Case:
(These items are to make the project as pictured. Feel free to build a completely different and more functional case.)- 20" PVC Pipe 1/2".
- 3 right angle 1/2" PVC connectors.
- 1 5-way 1/2" PVC connector. (example)
- 2 1/2" PVC end plug.
- 3 1 1/2" suction cups. (Available at hardware stores and craft centers.) NOTE: If your door is unsuitable for suction cups then replace these with three end caps and you can use adhesive strips or screws to mount the lock.
- 6" of 1/2" wide by 1/64" thick metal strip (steel, tin, copper, etc.) (available at hardware, craft, and art supply stores.)
- 4.5" of 1" wide metal sheet, 1/32" thick (steel, tin, copper, etc.) (available at hardware, craft, and art supply stores.)
- 2 3/32" x 3/8" screws with nuts. (1/8" will work too if you can't find the smaller ones.)
- 2 1.6M (metric) 16mm screws. Ideally with countersunk heads if you can find them. (For securing the motor. Check your motor specs to see what screws it needs. One motor I tried used 1.6M, the other 2M. You'll probably have to buy long ones and cut them to length.)
| « Previous Step | Download PDFView All Steps | Next Step » |





















































As you know, I already started to do mine, with a few modifications. I uploaded a new video with a new option:
As soon as I finish my project I'll post the code online
It looks like your setup is really sensitive. Really nicely done! Your achievement patch is on the way!
// If we're recording a new knock, save the info and get out of here.
if (digitalRead(programSwitch)==HIGH){
for (i=0;i<maximumKnocks;i++){ // normalize the times
secretCode[i]= map(knockReadings[i],0, maxKnockInterval, 0, 100);
add this little guy
Serial.println(secretCode[i]);
and open up your serial monitor....
make sure you un-commented the serial begin up at the setup and then it should spit some numbers back at you... put these numbers into the array and enjoy.
Great work!
And if I ever have any questions about taping something to something else I'll be asking you. :)
(And here's the video embedded for everyone else to see.)
http://www.youtube.com/watch?v=6k6XwyB8Hh0
Check out the vid. Hope you like it.
Fantastic job!
can someone help me with this?
- in Setup() you'll need to read the data from eeprom. (If there is any.)
- in the validateKnock() function (around like 208) you'll need to write the info to eeprom. You could do it as part of this code loop:
for (i=0;i>maximumKnocks;i++){ // normalize the times secretCode[i]= map(knockReadings[i],0, maxKnockInterval, 0, 100); // Write the value of secretCode[i] to EEPROM here // }Here are examples of how to read and write EEPROM.You also might want to look at the code for my Rock-Paper-Scissor Playing Glove for an example that saves and reads info to/from the Arduino EEPROM.
for (i=0;i>maximumKnocks;i++){ // normalize the timesi also added some audio feedback, for instance a "game show"-like "fail" buzz through a second piezo for a bad knock, and audible playback of a newly-programmed knock in unison with the LED flashes since it seems like listening to the code being played is absorbed by my brain easier than just watching the LEDs (for me, it all stays in the realm of sound).
also, i'm triggering an Electric Door Strike (commonly used in apartment complexes to remotely unlock a door) instead of a deadbolt or door handle... this means less hardware on the door (only the sensing piezo, actually) and the added convenience of simply being able to push the door open (very helpful when one's arms are full of groceries... and/or beer!).
thank you for this brilliant project and your kindness in helping everyone here who seeks to employ this device around the world!
We've been playing with electric door strikes as well. They're obviously more invasive (you have to install them in the door frame) but they work much better. You can even mount the knock sensor somewhere other than the door if you want to be extra sneaky. (Or if you're using it to open a secret door hidden by a book case.)
added a "darlington pair" touch switch to a bare metal thumbtack and now the code can be tapped -- silently -- with one finger.
no more neighbors sneaking in and stealing my beer.
thanks again!
http://www.adafruit.com/products/170
Thanks so much :)
int secretKnock [maximumKnocks] = {50,25,25,50,100,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
this is the initial setup:Shave and a Hair Cut..Is it mean that I can only knock using this type of knock?Then how do I record new knock...
Else,is it really matter if I use any type of program button? I mean NO, NC?
It because my reset button went crazy each time I try to record other knock, it only listen to Shave and a Haircut knock...all the master please help me...
Any suggestions to prevent this? I'd be grateful!
and they say to me that the piezo speaker is a transducer. i search for the picture
of a transducer and it is just like a flat thin disc so i decided to buy a 2400 buzzer..
is it ok to use a 2400 buzzer for the speaker?
The problem is I don't know how will I connect the servo motor to my circuit
because it has 3 wires. I search about the polarity of the servo motor wires and I
saw that the red wire is for power, black for gnd and white for signal. Can anyone
help me how will I connect those 3 wires to the circuit? I use the same circuit that
is posted here in this project.
Program start.
knock starting
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
knock.
New lock stored.
Every ten seconds. i know that the knoks are the readings and it seems like the program is running a loop. I tried getting the sensitivity threshold up to the limit but any threshold variations dont seem to change anything. Any ideas?
Thanks for such an amazing project and gretings from Mexico! :D
Thank u very much! :D
http://thereifixedit.failblog.org/2011/08/31/white-trash-repairs-secret-knock-detector/
CHEERS!!
-Bjarni