Instructables
Picture of Secret Knock Detecting Door Lock
knock_lock_side_view.jpg
knock_sensor_bb.jpg
Protect your secret hideout from intruders with a lock that will only open when it hears the secret knock.

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 adsRemove these ads by Signing Up
KGuy7 months ago

Here we are! Finally done after months of procrastination! I added a buzzer and a third led (not in the picture). The code was changed very slightly but it works perfectly. A latch in the back hangs it on the door. I must thank you, however for the genius of this invention.

IMG_0255.JPG
Grathio (author)  KGuy7 months ago

Beautiful work! Thanks for sharing!

Matienzo8 months ago

here is my little one in an iphone box

vinny033 years ago
I have modified the Arduino code to add the functionality of ''Users''. What it does is that it let you program a secretCode for four users. For example: If you push the button X times, after 4 seconds the green LED will blink X times and then you enter program mode (simply do your secret code). I also added the functionality to take a picture when your sequence is bad with LabVIEW and a WebCam camera. Then the picture is saved in my folder and pictures are incrementing with numbers.
Circuit sur porte.JPGMontage.JPG
Grathio (author)  vinny033 years ago
Looks great, and really nice added features! I had done a version with his & hers knocks, but this goes well beyond that!

Fantastic job!
bserrato3 years ago
I saw your project some time back and I thought it was great. I decided to take it and improve on it, the result was a system that locks and unlocks. Also if a person inputs an incorrect knock, the system will send a signal via bluetooth to a computer terminal to snap a picture and save it.

http://www.youtube.com/watch?v=6k6XwyB8Hh0

Check out the vid. Hope you like it.
Grathio (author)  bserrato3 years ago
That really made my week! It looks fantastic and works great. And the bluetooth camera is a great idea of added security.
josiasfilho4 years ago
Hi Steve!
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
Did you finish yet?  Can't wait to see the code.
Grathio (author)  josiasfilho4 years ago
Fantastic work with the servo and the unlock option.  (And an off switch!)

It looks like your setup is really sensitive.  Really nicely done! Your achievement patch is on the way!
TheBestJohn4 years ago
I have been playing around with this code for the past hour or so and found out how you can hard code in your own rhythm if need be.... at the part that looks like this
// 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.
Whoot finally got my relays for my motor and heres a neat little Idea for your visual feedback....

 
Grathio (author)  TheBestJohn4 years ago
Oh, and for your awesome work you have been added as an official Master of Secret Knocks.  Your patch is on its way!
Grathio (author)  TheBestJohn4 years ago
 This is awesome!  Thanks for sharing your code and video.  Having the door unlatch too makes it that much more mysterious.  And I like the feedback through the peephole.

Great work!

And if I ever have any questions about taping something to something else I'll be asking you. :)
reyscreamz20 days ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz20 days ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz20 days ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz20 days ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz20 days ago

what type of door lock should i use?

please specify :D

thank you so much

igorandrade29 days ago
ndiaz91 month ago

im just wondering. why do you need to put the knock detector at the back of the door and not in the front door? thanks for your reply, if ever :)

longandy made it!1 month ago

Here's my build - thanks for an awesome instructable!

changes - replaced motor with relay to trigger an external motorized door opener

inverted some of the green LED states so it is normally off but flashes on when knocking

knock.jpeg
sarci3 months ago

we have a filipino who made this project? just txt me this is my # 09169033782 and help me how to do this project! please! tnx...

ell092792 sarci1 month ago

docu please :)

Roberto11t12t2 months ago

What size does the SPST momentary pushbutton have to be?

maski13 months ago

does it have to be gear motor or can i use solenoid lock instead?

palominom4 months ago

I'm a guy from Spain and I am doing this proyect for a competicion but I have a problem with the gear motor. All is good except the gear motor it isn't move i don't know why?

Please help me, THANK.

I-robostein6 months ago

AWESOME!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Danny1417 months ago
Please help I need this for a school project please...
Danny1417 months ago
Hi guys! Please what changes do I add to the code if I want to replace the knock sensor with a capacitive touch sensor
mbessam7 months ago

i have all things goin great but my motor is not spining

billbillt8 months ago

very cool

Matienzo9 months ago
Hi there, I hope there is someone hanging out in this project.
I got a problem with my motor.
I made it work in the breadboard but when i solder that circuit it doesn't work. I'm getting the knock and the button running but the motor does not react when the lock is opened. I checked the circuit for about 3 hours and it looks exactly as the one here (not the breadboard, the other one)
Any one made it like that?
jkctech11 months ago
idk why but my programming button isnt working, is this because im using an arduino uno or did i mess it up? everything works but the programming button.
KGuy jkctech9 months ago
Check the polarity of your rectifier diode.....and if that doesn't work continuously check the circuit diagram for any mistakes on your breadboard
KGuy9 months ago
Whew! After a few weeks, I have successfully completed the (perfectly running) circuit. I did have to make a few modifications to the code to increase the sensitivity of my piezo (thanks to your helpful hints) but hope to find a way to increase it even more. I plan to finish this project (the hardware) in the next few weeks.....
I find your projects amazing, good sir.

And for all those who can't seem to get their motor running.....
MAKE SURE YOU KNOW THE VOLTAGE....my first few motors were over the standard voltage of 5v. If your motor uses around 6 or 7 volts, I recommend using the vin pin, which gives you a little extra power (keep it safe though). If your motor doesn't work no matter what, get a lower voltage motor :)
sleepyone10 months ago
Hi there, I am currently working on this project and manage to get everything run smoothly. However instead of using a buzzer to detect knocks, I use two digital arduino pins to create a touch sensor as well as replacing the gear motor with a servo. Now, for added security, I would like to prompt the user to key in the original touch rhythm before they are allowed to key in the new touch rhythm they desire when the button is press. I am not very good in programming, I was wondering if you would be able to assist me in this perhaps? hope to hear from you soon. thanks in advance.
jkctech11 months ago
How to program the knock?
nahtanoj12 months ago
Can someone please tell me were you can get the 5v gear motor ad the perfboard?what if
okay1231 year ago
hello Steve
I decided to recreate this project for a school project I have coming up this month. I saw this video a couple of years ago and recently bumped into it again. I really want to build it. I have done all of the construction used for this project but I need a little help with the code. I used a servo instead of a gear motor and there for the code does not work. I do not know how to code a Arduino at all!!!!!! Could you please give me a code that will work for an Arduino?? it would really help me a lot. in one of the other vids there was a guy who could unlock his door and then press a button and it would lock again. If you have time could you please make the code enable that feature too. I really need your help.......
okay1231 year ago
Any ideas how I can attach a servo instead of a motor.
Jawknee51 year ago
I don't know if anyone who has successfully completed this actually checks the comments, but im in the process of doing this- but i added an H-bridge to do two seperate knocks, one to lock and one to unlock... The circuit is correct, by switching the wire motor output from one pin to the other on my Hbridge IC, i can get the motor to move in two different directions, but apparently I'm not the best with programming...but i know a quite a bit.

Im just not sure on where i would add programming, just a simple knock of three, that would make a digital pin(7 in my case) HIGH and enable my motor through the Hbridge...... any help would be great!
Hi. Im interested in making your project but the only motor I have with me right now is a 12V stepped motor. The one with 5 wire-cables ( red-ground, orange, pink, blue, yellow ). I was wondering is it different compared to the gear reduction motor u used for this project? I assume the arduino codes will need some changes? Hope to hear from you soon! :)
cstawell1 year ago
brilliant, I think my little girl would find this a brilliant toy, XD
Andsetinn1 year ago
Very interesting idea and well executed. I've been thinking of putting similar system on the doorbell in my apartment building so that ringing the bell in a certain pattern would open the downstairs door.
There are security issues that stop me. :(
whitkari41 year ago
My senior project team just got our device to work with a servo. Yay we plan on adding wifi so that we can figure out how to lock and unlock remotely via a website and mobile application. Once we get everything we plan on posting our code etc for others.
snibbalol1 year ago
My red Light is all ways on so that`is not a good thing right? and another trouble i am having is eaven tho reject value and average reject both are above 80 and my knock is just simple 4 knocks 100, 100, 100, 100, 0, 0, 0,.... etc my device wont regonize the knock as right one and wont do anything to motor what so ever could someone please assists me with this issue since i would need to complete this work by the end of this week / begin of the next week. thank u so much beforehand. :)
dmarinho1 year ago
hey, newbie here, can someone upload the code to the lock and unlock system? also the gear motor, does it hold the key or you got to put the device literally inside the door?(sorry for bad english =\ )
enagel31 year ago
that got my attention

masonson1 year ago
cool next project
hanyc931 year ago
Does anyone know what is the use of the diode? I know it allows current to flow in one direction only but when I remove the diode, the motor still can turn properly.
Grathio (author)  hanyc931 year ago
It's called a Flyback Diode and you really want to keep it in there. Electric motors generate spikes of current when they're stopped and the diode is to protect that current from feeding back into the rest of the circuit, destroying the Arduino or whatever other circuitry you have attached. It's the 3¢ part that will save you $300.  Read the link above for much more information.
mrmerino1 year ago
Oh my god, I just realized that putting this in my hypothetical future kid's treehouse would make me the coolest dad ever.
n79c1 year ago
I am having a problem with button - it adds a knock when I release the button - any suggestions? Everything else works.
Grathio (author)  n79c1 year ago
This is just a guess, but I suspect that releasing the button causes enough physical movement that it registers as a knock. To fix it I'd try one of these:
- Reduce the sensitivity (see step 2)
- Use a button that has softer action.
- Move the button further from the sensor.
- Physically insulate the button so vibrations aren't transfered to the sensor.
- Be really really gentle when releasing the button.

It's possible that the switch is very electrically noisy and is putting a spike somewhere that puts garbage into the circuit, in which case changing to a different model of button would help.
n79c Grathio1 year ago
Hi
Thanks for responding - no I am a dork! I watched your youtube and realized that I released the button too soon. When I waited until both lights went on it was ok. My bad.It is finished and boxed you and working great. Thanks
PS any chance of getting the unlock/lock code that someone said they did?
Adam
Grathio (author)  n79c1 year ago
This is just a guess, but I suspect that releasing the button causes enough physical movement that it registers as a knock. To fix it I'd try one of these:
- Reduce the sensitivity (see step 2)
- Use a button that has softer action.
- Move the button further from the sensor.
- Physically insulate the button so vibrations aren't transfered to the sensor.
- Be really really gentle when releasing the button.

It's possible that the switch is very electrically noisy and is putting a spike somewhere that puts garbage into the circuit, in which case changing to a different model of button would help.
n79c1 year ago
Hi Can I please have the code that will use a server motor and will lock and unlock?
SubEclipse1 year ago
I'm in the early stages of attempting this build, and am gathering all the necessary parts.

I can't come up with a motor locally, and have been looking online. Everything I find online is either coming from China or Canada and was hoping to find something located in the US.

The Solarbotics GM22 used as an example looks great, though a little expensive... I couldn't seem to find these offered by anyone other than the manufacturer (also in Canada).

If someone could point me in the right direction, I would greatly appreciate it.

Thanks.
I got this all wired up on a breadboard tonight and it's working perfectly (substituting the gear motor with a LED for now). Now I just need to track down a decent motor and put it all together. I'm about to break down and order the one from Canada, since I can't seem to find any decent ones offered from US vendors.
twighahn1 year ago
could you dummy this down for me?
twighahn1 year ago
would you please dumy this down for me i think it would be a great idea for a panic room
englishfire2 years ago
How can I modify the Code to work with a servo?
englishfire2 years ago
Why to you use a 9v battery? Why is 5,5v from the arduino Not enough?

In which way do I have to change the code if the motor should move to the origin position after a view minutes?

Greetings from Germany
Maik
Grathio (author)  englishfire2 years ago
>"Why to you use a 9v battery?"

For two reasons. 1) The motor doesn't create enough torque at 5v to turn the lock. And 2) The 5v pin on the Arduino can only safely pull about 200mA. The motor can pull over 500ma under load. This keeps the voltage regulator on the Arduino from burning out.

>"In which way do I have to change the code if the motor should move to the origin position after a view minutes? "

This is not a simple change and would require more circuitry to allow the motor to turn the other way. (Typically an H-Bridge is used for this.)

A simpler way to do this would be to use a servo to turn the lock since they're naturally high torque and can turn either way without extra components. I don't have an Instructable for that yet, but do a web search for "Secret Knock Gumball Machine" to see how that would work.
yozarseef2 years ago
I have some difficulties designing a model with locking ability .. any help please? I will be thankful
KGuy2 years ago
Is it basically the same with arduino uno?

If it is I could make it today.......

Nice job!
cmelad2 years ago
good day sir, I was just wondering if you can give any recommendations or possible innovations for this project. I am studying engineering here in the Philippines and I want to make this as a final year project. my teacher demands for an innovation and I cannot think of any.
eng.7oka4 years ago
hey.. sorry to bother you again.. I just want to know what the function (map(knockReadings[i],0, maxKnockInterval, 0, 100); does..
Grathio (author)  eng.7oka4 years ago
Arduino reference for the map() function.

This normalizes the data so the longest time between knocks gets "100" and the rest are adjusted proportionately.  We do this so it doesn't matter if you knock fast or slow as long as you get the rhythm correct.
I read that in the comment.. but the thing is I'm programming usuing another language.. so I need to understand the mathimatical algorithm behind it.
Grathio (author)  eng.7oka4 years ago
The best description of what it does is in the link I provided to the description of the function in the Arduino Reference manual.
this is the function

long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
area362 years ago
My motor is getting no action. I have tried it on the 5v and vin pins along with switching the diode and still nothing. Anyone know whats wrong?
bmondor2 years ago
where do the positive ends of the LEDs go. also i only have 2 wires that go into the digital pin in the arduino. i cant figure out how to get it to work even though i have all the wires in which seem to be the right places.
darthtony4 years ago
Is it possible each time you program a new knock code(on the fly , using the program button)  the arduno stores it in the EEPROM so you dont have to re program it when you reset?
can someone help me with this?
Grathio (author)  darthtony4 years ago
Yup, it is possible, and a good feature. Here's an outline of the changes you'll need to make:

- 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.
Grathio (author)  Grathio4 years ago
 Gah.  Instructables is still eating preformatted text.  Lets try the code again:
 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 //
 }

awesome... i've got my code reading the EEPROM on power-up and writing to the EEPROM whenever a new knock is programmed.





i 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!
electricStrike.jpg
Grathio (author)  KevCarrico2 years ago
Fantastic work, thanks for sharing!

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.)
lol... all great stuff.

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!
stephin992 years ago
oh my ive got it!!! add a wifi unit and have it text you every time someone enters the code wrong
jakejj2 years ago
Disregard my previous comment. The motor won't work. I do however have a micro servo with enough torque. Any tips on writing code so the knock will unlock the door (servo turns 45 degrees) and then a different knock would lock it(servo turns back to original position)? Thanks so much. Fantastic instructable
jakejj2 years ago
I bought an experimentation arduino kit that comes with a DC motor. The problem is I dont know whether the motor will work or not. This is the link to the kit.

http://www.adafruit.com/products/170

Thanks so much :)
Jaslene1002 years ago
how did you figure out the array pattern for the "shave and hair cut" rhythm?
andrewbaker2 years ago
This would be perfect if you had a deaf roommate
Can somebody explain to me about line:
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...
Anybody,can you tell me whether I can use arduino with Atmega8-16PC instead of Atmega328P to do this project.And can I use the program that you (Grathio) gave without change anything.It is because they don't have Atmega Duemilanove.
etlerd2 years ago
I know little of electronics or arduino. I'm fact, this is my first project. I've put it together, substituting a servo for the gear motor, and a speaker for the piezo. It works great. One problem: the servo seems to be generating some sort of feedback which occasionally interferes with knock detection. For instance, if it's just sitting there, an occasional knock is detected, and if you manually twist or bump the servo horn, a few knocks are detected (which is what leads me to think its the servo). If this happens when I'm knocking, it interferes with the detection of a correct knock sequence.

Any suggestions to prevent this? I'd be grateful!
robker3 years ago
how much wold you sell it for
mvillarin3 years ago
i'm from the Philippines and i'm trying to do this project. i try to buy a piezo speaker

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?
it's ok to use 2400 buzzer. I've used that on mine. My problem now is with just like butcher_pro problem. It always sense knock eventhough i adjust the threshold to the max. I've tried the connection on different breadboards but still the same problem. Do you any suggestion?
ayanez3 years ago
i cannot download the code :/
groger23 years ago
I can't find a reduction motor here in our place so I decided to buy a servo motor.

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.
hello im vanessa from philippines..i am having a mini-thesis today..i really love these sites because it helping me a lot in my thesis..i am doing a light clapper...i want to know the Schematic Diagram of these project...please help me....thanks..:)
butcher_pro3 years ago
Hi people, i have the whole thing up and running, but when i turn the monitor on keeps reading this:
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
ok, i got the thing up and running today, was a serious bad conection LOL anyways im up to the record button and found out that a little cable plugged anoe side only to the digital 2 and the othere end NOWHERE, it works as an "antena" and detects the prescence of static fields so you can record without button. This is cool, but i would like to know if some1 knows whats happening :(
butcher_pro3 years ago
Hello, im from Mexico and i loved this project, but im having trouble getting it to work properly. First i want to know if i can use this transistor http://www.datasheetcatalog.org/datasheet/fairchild/KSP2222A.pdf wich is the one im currently using, but i get knock starting, then some knocks then knock stored. But no lights or engine motion whatsoever. I tried switching the threshold up to the maximum but this makes no change at all. i would love some help. i know im doing something wrong, ive doublechecked the resistors and buttons and batterie but everything seems ok to me. Please please some1 help, i know electronics but not very good and i would love to see this arduino project running!!!

Thank u very much! :D
respect...for you
Lorddrake3 years ago
good job. just saw that your knock detector lock was front page on "there i fixed it"

http://thereifixedit.failblog.org/2011/08/31/white-trash-repairs-secret-knock-detector/

CHEERS!!
bjarni19953 years ago
Great tutorial, i made a prototype of this but i used a servomotor, i found it really easy to edit the code to work with a servo.

-Bjarni
can we use other type of knock rather than Shave and a Hair Cut. Because all video related to this project is using the same type of knock. It's make me a little bit confuse. If we just can program it using that knock so what is the secret means?..really interested in this project but lil bit confused.
I'm printing the template for the secret knock detecting gum ball machine
that you did from makezine!
Here.


http://makezine.com/25/gumball/
Where do i find the code?
Grathio (author)  Jordan arduino3 years ago
Read #1 above.

If you're still having trouble after following those instructions post again.
Thanks awesome
im 11 years old and i know how to program the arduino
you make the code really precise and pretty good
the last time i  did a progect i got confused but this is
clear:-o 
Hey, I set this as my only lock to my house, and I got robbed! why would you post this?! Just kidding, really cool instructable though!
shishi yat3 years ago
Can we replace the atmel micro-controller with PIC micro-controller? if yes..what type of PIC that suitable to use to make the knock detecting lock project..if no..can you explain me why the PIC cannot be used..your answer are very helpful for me..and i hope i can get the answer..Tank q...:)
Grathio (author)  shishi yat3 years ago
The best way to figure this out is to look at the project, determine what the technical requirements are and then see if you can find a PIC processor that meets them. Some of the technical requirements are:

Looking at the schematic you should be able to get:
- Number of analog and/or digital pins needed.
- Operating voltage.

Other things you'll need that you can get from looking at the code and the data sheet for the Atmel328 processor (the Arduino's main chip) ( http://www.atmel.com/dyn/products/product_card.asp?part_id=4720 )
- Amount of flash ram and sram.
- Amount of EEPROM used (if any)
- Processor speed.
- Special hardware features such as interrupts, timers, PWM, USB, SPI, etc.

After you have all this go through the specs for the various models of PIC microprocessors and see if you can find one that meets or exceeds this. There's a good basic outline here: http://www.best-microcontroller-projects.com/pic-microcontrollers.html

Porting the code will be easiest if you use a C compiler since Arduino code is C.


beehard443 years ago
this was my original project when i bought my arduino uno. Problem is, i need a motor (or a servo) and it'll take me some time beore i go to town (i'm in dunstable)
can the secret knock save to eprom memory?
Grathio (author)  neutron_robot3 years ago
It would be very straight forward to add  with the Arduino EEPROM library. Just make sure you add a way to clear or reset it if you forget the knock.
Putrid3 years ago
What did you use to go from the 9V battery to the 9V in plug on the Arduino? More specifically, what is the connector piece called that you used to go from the +/- of the 9V to the power input?
Grathio (author)  Putrid3 years ago
It's similar to this power adapter from Adafruit.  Alternately you can:

Just use a 9v plug adapter and plug the red wire into the Vin and the black into Gnd on the Arduino.

Make your own with a 2.1mm barrel connector. (I think you can find these at Radio Shack.)  (The 2.1mm is the diameter of the inside plug.)  Be sure to connect the center pin to the positive lead from the battery.
Putrid3 years ago
In step #8, you reference a 220 ohm resistor. I (think) hope you mean a 2.2K ohm resistor.
Grathio (author)  Putrid3 years ago
Fixed! Thanks. (Can't believe after 66,000 views there are still typos that people haven't pointed out!)
noobduino3 years ago
would any of these moters work http://www.thesource.ca/estore/category.aspx?language=en-CA&catalog=Online&category=Motors i am Canadian (no radioshack for me only the source)
Grathio (author)  noobduino3 years ago
Nope, those are all high speed, low torque motors. This project needs low speed, high torque motors.

The motor I link in Step 1 is sold by a Canadian company so shipping costs, etc should be minimal.
jigsawnl3 years ago
I'm just started with my Arduino Uno. This was a great tutorial to learn more about electronics and programming. After setting up the Arduino i thought about how I could improve it with the little bit of knowledge that i had gethered. I removed the two LED's and put a RGB instead. I added Digital 6 to the code. Now standby shows green. A false knock pattern red. And when you press the button to program it's becomes blue.

Thank you for this great instructable.

PS. i had some problems at first. Happens to be that my knock sensor is really hard to trigger. Even with threshold = 1. It's a really small knocksensor encased in plastic.
PyroMonger3 years ago
Could a piezo transducer be used instead of the buzzer - are they pretty much the same thing?
Grathio (author)  PyroMonger3 years ago
Yup, they're essentially the same thing.
Pingman7473 years ago
First off, this is a great project. I could see alot of personal use for this project. As such, I'm in the process of recreating this instructable. In doing so I noticed a line of code I have a question about. I noticed around line 45 in the setup routine you setup the knockSensor pin as an OUTPUT. Is this intentional and I'm just being thick, or is this pin supposed to be an INPUT (what I suspsect)?

Thanks so much for the great project. I'll be watching you for any other great ideas.
Grathio (author)  Pingman7473 years ago
Yes, you are correct.  Good catch!

Fortunately that line doesn't actually -do- anything so it's not super critical.

It looks like I haven't updated the PDE here in several versions. You can get the latest here:
http://grathio.com/assets/secret_knock_detector.pde

I'll also try to update the coke embedded above, but the Instructables interface doesn't make it easy.
Dr_Stupid4 years ago
Finally SOMEONE posts a really interesting and USEFUL Instructable. +1
Ok, I've got it up and running ! All I need is some cable sorting and I'm ready to show the world! Do you have any of those patches left? :D
Grathio (author)  Crimson-Deity4 years ago
Fantastic! Any chance you can post a photo or (even better) a video?
Ok! Its mearly finished! http://www.youtube.com/watch?v=V6X6jEcNDY8 You can see my current status there ! :D
Grathio (author)  Crimson-Deity4 years ago
I really like your take on it, thanks for sharing!  Your patch is on the way!

(And here's the video embedded for everyone else to see.)
I'll upload a video as soon as I'm completely finished ! I also have to find a Wall to USB adapter since a 9volt wall-adapter makes my green indication light blink for some reason :S
hjuyhgfghjh4 years ago
Can I buy this because im not very good with electronics. im UK based
godgodgodgo4 years ago
How much did this cost to make?
Grathio (author)  godgodgodgo4 years ago
I answered this one below, but since there are a lot of comments to read through I'll answer it again:

It cost me hardly anything since it was all stuff I had lying around. To buy all the parts as listed is around $80 USD. Most of that price is from the Arduino ($30) and the motor (Around $15). You can bring that down if you use an Arduino clone like the Boarduino ($17) or Diavolino ($13)  (But you will need a USB->TTL adapter to program these boards.)

You can also replace the motor with a high torque servo to save a few dollars but you'll have to modify the program and mounting to work with a servo.
Chewie424 years ago
totally awesome...would be great for a secret panel somewhere
Dannne114 years ago
the engine starts when I plug it into the Arduino: ( has anyone any idea what I'm doing wrong?
chestercito4 years ago
hey man..I want to use this but for an electric lock...what do you think i would need no change in the code or in the circuit??
B.F.L.M4 years ago
it could be more secure if you use layered security (e.g. RFID, knocking, PIN, iris scanner, fingerprint, AND key!!! (in a specific order of course) ) p.s. im a little paranoid
pls help.. can I use an atmel 8051 micro?? how would the programming be??
nmarbm4 years ago
Where do you draw the sketch, the colorful one (with arduino and protoboard)?
Grathio (author)  nmarbm4 years ago
It was done with the free application Fritzling.

http://fritzing.org/

It's super easy to use and can also generate schematics and even make (simple) PCB layouts for manufacturing.
nmarbm Grathio4 years ago
Thank you vey much. And when I am on this page I could say it is a very good project, and I build one yesterday (but only on protoboard) and it works perfectly. And because I am very intrested in arduino, I would like to ask you would you post more new arduino projects?
iceng4 years ago
I used an accelerometer in my e-lock, this responded to drumming fingertips and made it look as if I was bored as I leaned with my back to the secret door while my hand was sending a complex tap code. This works on a car if you include a temperature adjustment for cold weather. iceng...
iceng4 years ago
If you are using the 2N2222 transistor (NPN), the Emitter (arrow) should be the pin wired to ground and the Collector wired to the motor ! It may work backwards as the schematic shows, but with very very poor gain. Change this for a better motor drive. Good Luck... iceng...
wout smeets4 years ago
 how do you make an h-bridge for this doorlocker




i come from belgian srry for my bad inglish you can anser me on woutsmeet1997@hotmail.com
Grathio (author)  wout smeets4 years ago
 There are a number good Instructables on the site for making H-Bridges, just click here.  (Or type "h-bridge" in the search box in the upper right, which is what I did.)

Of those I think this one might be the most helpful since it also mentions how to program the Arduino to use it.
thanks
 i have my arduino today



:p
Storming idea, but i don't know what happen when AC power cutting which usually done in my country?
juanvi4 years ago
woha! very nice and clever!! i really like it, but have you ever used it in real life? as going out without keys and returning 5 hours later and be opened by it?? how much does the battery last??
Very nice. I thought that it was for opening any doors. Even though, Very clever invention!!!
alcurb4 years ago
Very clever invention. For increased security, may I suggest to add a touch sensor option connected to door handle/knob. Lightly tap your code on the door handle/knob. The neighbors won't be able to hear that.
godgodgodgo4 years ago
Do I need a power supply for the Arduino Duemilanove and the circuit board?
Grathio (author)  godgodgodgo4 years ago
Reread the 'Materials' section carefully and you can see my recommendations for powering the project.
godgodgodgo4 years ago
Why when you etched the board out did you not just leave a long line of the copper instead of the wires for the power. Also should you not have done it so that some of the holes are linked?
Grathio (author)  godgodgodgo4 years ago
The board is a perfboard, not a custom etched board.  Follow the link in the 'Materials' section to see what I'm talking about.
Could this be modified to work with music. For example, tones played in a certain order unlocks the lock?
yes
Grathio (author)  nitetime30214 years ago
Unfortunately recognizing tones is a different task from rhythm.  The piezo element would need to be replaced with a microphone and amplifier.  The code would need some excellent noise removal and pitch recognition, probably some kind of FFT,  which is difficult (though not impossible!) to do on the Arduino's limited hardware.

By the time you do all that it would essentially be a different project.  A very cool project, but a different one.
Robot Lover4 years ago
When I download the file and open it in the arduino sandbox it says "Bad file: Processing can only open sketches and other files ending in .pde" Help anyone?
Grathio (author)  Robot Lover4 years ago
 Sometimes the file that Instrucatables gives you is a different file name.  Just rename it to secret_knock_detector.pde and it should work fine.


I already did but it still does not work. Any suggestions?
Grathio (author)  Robot Lover4 years ago
 Hm.  I'm guessing some computer somewhere is messing with the encoding.

You can also download it directly from my site here.  If both of those links don't work for you try a different web browser to download the files.
louwhopley4 years ago
Great project!
Haven't read the instructable, but the video looks really good!
eng.7oka4 years ago
Ok..I Think I will use C ... I'm looking for C compiler for my PIC now... Thanks again
eng.7oka4 years ago
Thanks alot man.. it's really useful.. I have a small problem though. I'm using PIC 18F series. How can I modify the program
Grathio (author)  eng.7oka4 years ago
 The Arduino uses an Atmel chip which is functionally pretty similar to the PIC 18F series.  However they speak pretty different languages.

The code I provided would require some kind of conversion.  If you're programming the PIC in C the conversion should be pretty straight forward since the Arduino code is mostly straight C.  If you're using Assembly or some other language you'll have to port the whole thing over.  How hard that is depends on the language and how good you are with it.  I've commented my code pretty well.  You might find the Arduino reference manual useful for seeing what specific instructions do (like timing and reading/writing pins). 
eng.7oka4 years ago
I need to test the piezo without the microcontroller connected.. any idea how to do that?

Grathio (author)  eng.7oka4 years ago
 If you have a particularly nice multimeter you might be able to use that, (Set it to 2v)  though often the sampling is too slow to register.

I simply made a quick sketch that continuously read the values coming from that pin and dumped them to the serial port.  It's not too different from this or this Arduino tutorial.  (Looks like you're using PIC, so you'll have to port or modify the code.)
ratgod4 years ago
I love the "Scream while knocking" solution.
jmn19934 years ago
This is prity cool..
Just 1 thing, were can some 1 get an arduino??
cheers
Grathio (author)  jmn19934 years ago
 It depends where someone is in the world. There is a list of suppliers here.
jmn1993 Grathio4 years ago
cheers heeps .
luishfialho4 years ago
 oh, i've already seen it in the instructions x) my bad, sry
luishfialho4 years ago
 hi, great job! where do you get the white piece? (or something similar) thanks!
mdawg224 years ago
thats pretty sick man... cool...
cdousley4 years ago
that npn 2n2222 looks like a tranistor but you said its a diode, is that a typo or am i about to learn about a new electronic component?
Grathio (author)  cdousley4 years ago
Nope, that's a typo.  Thanks for catching it!
cdousley4 years ago
i have most of the parts ill probably make it on a breadboard and see how i like it . This looks great Cool project !!
jasper_muc4 years ago
 Hey guys,
Does anybody know how a sleep mode could be implemented? I assume that could boost the battery life tremendously.

Thank you,
Robin
first, i'd like to say this is one of the coolest arduino builds i've ever seen. truly inspired!
my first thought for power saving was a magnetic on/off switch so that, in addition to knowing the correct knock, you would also need a "key" (a relatively strong magnet) and know where to put it.  of course this would probably require the opener to be a permanent installation and might detract from some of the novelty.  but in a secret door application (which would make this already awesome device even more awesome) the more security the better.
Grathio (author)  tinkerist4 years ago
That's a great idea!  It would certainly be one way to implement a sort of two factor authentication (something you have + something you know) for a truly secret entrance.   A rare earth magnet in a piece of jewelry and a reed switch just might make a winning combination. 
is an arduino complex enough to operate in tandem with an RFID set-up, so that an individual has an exclusive knock associated with their RFID? or would that require multiple controllers or connection to a server of some kind?
Grathio (author)  tinkerist4 years ago
Most RFID readers are very trivial to hook to a microcontroller, they simply spit out the RFID tag's ID through a serial connection, so you could very easily use one as a second form of authentication.
"magic" ring + secret knock + hidden door = awesomeE9
there are other options too.  you could have an external power supply that connects to stealth contacts on the outside of the door.  or a candle stick/fake book on/off switch, al a old horror flicks.

the possibilities are endless, i'm going to be geekin' on this for a while, i think.  :)
Grathio (author)  jasper_muc4 years ago
 I'm still experimenting with this. So far it looks like you can use voltage produced from a knock on the piezo to trigger a wake from sleep... sometimes.  And it then takes a bit to wake fully.  To use it you have to knock once loudly, wait for it to wake up (if it did), and then do your secret knock, which kind of makes it hard and cranky to use.  My goal is to make it to wake reliably and within 0.1 sec so the usage is the same if it's asleep or not.

I'm going to keep looking into it though.  There are a few other power saving ideas:
  • Underclock it.  I'm not sure how low you can go, but I'd be surprised if it wont run at 4mhz or even 2.
  • Use a LillyPad Ardunio (ATmega168), which should* use less power, since it uses the internal resonator and doesn't have to drive a serial buss.  (It also likely pulls less power since it runs at 8mhz.)
  • Power down the pins and subsystems not used. 

*I haven't looked up the specs to see if it actually uses less power, I'm just assuming it does.

The voltage regulator on the Arduino board likely takes as much or more power than the Arduino itself just idling. You'll need a better power supply. 
 nice work
matej4444 years ago
hi, i have something really stupid question, I dont know where I must connect my battery on arduino. if someone can tell me where I connect this?
And I have litle problem my LEDs always blinking and I dont know where is problem, maybe that write somewhere in comments, but I dont have to much time to reading, and Im not good in english
Grathio (author)  matej4444 years ago
Next to the analog pins there is a pin lableed "GND" that's where the ground (-) goes.  Next to it is "Vin" which stands for "Voltage in"  That's where (+) goes.

You can put anywhere between 7-12 volts into it via those connections.

You can also use a 2.1mm plug connected to a battery pack and plug it into the power jack on the board that's below the USB connection.

More info is here.


ArduinoDuemilanove.jpg
robbotica4 years ago
great project ,) 
maybe i would add a feature that unlock all the system when the battery is low.
grahamdube4 years ago
The motor I wanted to use was just on the threshold of running with the 5Volt output. So i installed a relay with its coil on the 5V output and then had a battery in series with the motor on the N.O. pins on the relay so that when the relay is tripped, the battery runs the motor efficiently. Thanks for the the overall instructable, it was amazing.
Grathio (author)  grahamdube4 years ago
 Thats a good innovation.

Depending on the requirements, an easy way to provide more voltage to the motor is to connect the motor (+) to the raw power in pin on the Arduino (or straight to the battery). But check the ratings on your transistor to be sure you're not going to overload it with the motor.
EnigmaMax4 years ago
This is a great project, but I did mine a bit different. I drilled a hole in my door and used a infrared LED instead of the peizo. I then programmed a (hacked) NES zapper to the "knock" sequence to flash its led to it. The door opens metroid style.
Grathio (author)  EnigmaMax4 years ago
 Ha!  That's fantastic!  The NES zapper is an inspired touch.
thanks. again, this is a great project.
Grathio (author)  EnigmaMax4 years ago
 Any chance you can post some photos?  It sounds awesome!
sorry, I don't have a camera, but it looks exactly as it sounds.
Grathio (author)  EnigmaMax4 years ago
That's no problem.  Thanks for sharing!
jasper_muc4 years ago
 Hey guys,
I had already everything working as can be seen here:
http://www.youtube.com/watch?v=a5VO0aOaHZw

However I had to take everything apart for storing issues. Now that I have actually built a mount and want to get going it doesn't work anymore.
The problem is that every time I set it up, the LED connected to pin 5 blinks like crazy (if i try to knock after a short period, the other led does really quick the three blinks (doesn't matter if the knock is right or not) and then the other led blinks crazy again.

Did anybody encounter similar problems?
Anybody suggestions how I could find out what's wrong?
I loaded the blink sketch on the board so that I could test if my arduino board pins are broken but everything worked fine. So I guessed is a software issue but since it has been working before that cannot be either...

I would be very thankful for help,
Robin
Grathio (author)  jasper_muc4 years ago
If the pin 5 LED is blinking like crazy its because it's getting garbage data from the piezo.  Some things you might try:
  • Around line 28 there's a value for "threshold" set at a default of 4. Raise that to 10 or 50 or 100 (or 500) and see if it stops. If it does, reduce the value to just above the noise threshold.
  • If that doesn't work you might have a short somewhere in your piezo. Check all of the connections.
  • Another way to test the hardware is to go do this really simple tutorial.  If you can't get that to work, it won't work on the lock.
  • Try another pin for the piezo.  And change the definition of "knockSensor" on line 21 to match.  The ADC on the ATMegas aren't that great, so trying another pin might reduce the noise.
Good luck.
Grathio (author)  Grathio4 years ago
I just discovered another thing that might help.  If you have a noisy power supply it can cause the same thing. Putting a couple of 0.1uF capacitors between + and - really smoothed things out and let me drop the sensitivity from 100 down to 2.
themonorail4 years ago
 about how much did this cost to make. by the way i think this is one of the coolest things i've ever seen.
Grathio (author)  themonorail4 years ago
 For me it didn't cost anything because I had this stuff lying around the lab.  To buy everything is probably less than $80.  The two most expensive items are the Arduino (about $30) and the motor (about $15).

(These prices are for the USA)
that's an expensive motor.
Grathio (author)  cdousley4 years ago
 It's important to get a gear motor that can generate a lot of torque and that will cost more than $2.00.  If you want a cheaper option you can use the GM3 gear motor from solarbotics for about $7.00 USD.  However it's a completely different form factor and you'll have to come up with a different way to mount it.
 You should call it your "Nerd Cave", like I do.
I WANT I NERD CAVE TOO THIS WILL BE MY LOCK

sorry i alyays leave caps on
XOIIO4 years ago
Is it me or does he not look a bit like Sheldon from The Big Bang Theory?
Grathio (author)  XOIIO4 years ago
I always thought it was the other way around.
jestrada94 years ago
This is an awesome instructible.  I've almost completed mine, just need to mount the spring for the piezo, mount the motor & put the lock turning clamp on.  I'm definitely a beginner but was able to make this because of all of the detailed instructions.  Now I just need to learn how to read wiring diagrams and build a playhouse for my kids so I can mount this to their door.
Grathio (author)  jestrada94 years ago
Thanks for sharing the progress!  A playhouse is the prefect place for it.
amr90004 years ago
 I tried switching the motors power supply to the Vin pin caues I didn't think it had enough torque, I put my finger on it and it with a little pressure and it couldn't turn, so after I switched it it wouldn't do anything.. no power at all..
so I put it back to the 5 V pin, and it when I tap shave and a haircut, it shakes a Liiittle bit.. I don't know if I just touched something else in the process or if this killed my motor..
Grathio (author)  amr90004 years ago
(I'm going to assume that your motor is rated to run at 5v, will work correctly when you apply power directly.)

This is a good time to use your multimeter and see what kind of current you're getting through the motor.

This can happen if your diode is in the wrong way.  Check the polarity of the diode.  Probably wouldn't hurt to check the transistor's pins as well. Don't just mount it by looking at the shape, check the spec sheet and be sure that the pins are going to the right places.


amr9000 Grathio4 years ago
 I figured the direct power part out right before you replied to that, got it running again, now how do I get direct power to the motor? I figured out my motor is not the correct 'gear motor' but it's Very powerful with a direct line from the battery.. is there anyway to do this through the circuit?
gp1200r4 years ago
 grathio,

On the third picture on this page, with the breadboard layout diagram, the parts list on it says PNP transistor, which I'm thinking is incorrect.  The similar-looking diagram in step 3 has it fixed, though...  Not a huge deal, but it's something you might want to fix.  Thanks a lot for this Instructable, it's great.

Grathio (author)  gp1200r4 years ago
 Thanks for catching that!  Fixed.

(The diagram on Page 3 was the corrected one, the one on page 1 had a few small errors on it.)
amr90004 years ago
 okay.. I don't know what I'm doing wrong, I got in a Huge woop about this, spent 80 dollars or more on parts.. and once I got to the wiring part.. it just went downhill;
for one thing, the wiring doesn't seem to make any sense, thought it was just me but then I had an engineer sit down and look at it and neither the digital nor the live picture of the wiring scheme makes sense.
the program you posted seems to have a glitch;
it starts the program, then first knock, then one Right after another till it hits it's limit and says new lock stored.. and considering while it does this it is hooked to Nothing but the USB that seems a bit impossible to be actually happening.
until I set the sensitivity to 1023, it doesn't see Anything at 1024, but at 1023 when I touch the wire of the piezo, or any wire for that matter, it see's a knock..
have I gone completely crazy? I've worked with plenty of this stuff before.. so I guess maybe this is just new to me........................................................................?
really not sure considering I'm not sure considering how this circuit seems impossible yet so many people seem to have gotten it fine..
if anyone has Any advice to get this thing on it's way so I Haven't wasted 80-100$, Please give it
KnexFreek4 years ago
 THIS IS AWESOME 5 STARED FAVED AND SUBSCRIBED!!!!
gp1200r4 years ago
 I'm planning on implementing a project like this one after I get my Arduino for Christmas, and one of the biggest challenges for me will be mounting the whole device.  This will be going into a dorm room, so I can't modify the door, drill holes, or anything like that.  So as for this, I am planning on using a whole lot of 3M commandstrips.

For the motor shaft/deadbolt interface, one thing that caught my attention as a possibility is aluminum C-channel.  It would work by the same principle of the sheetmetal approach you used, slipping over the deadbolt.  The attachment of the aluminum to the shaft might end up being difficult, though, which could negate the benefit of not having to bend sheetmetal.

Another option might be to fix a piece of aluminum c channel to the deadbolt with some extra off one side, making it something like the equivalent of a servo horn, and using a servo to control it.

If anyone else has a brilliant idea for this particular step of the project, I'd love to hear it.
Grathio (author)  gp1200r4 years ago
 A servo with an appropriate horn is a much better idea than what I've done here.  It's easier to attach to the lock and is easy to make it lock as well as unlock .  The primary reason I didn't use one is that I didn't have one on hand that was powerful enough to turn the lock.

The 3M command strips should work.  If they don't, 3M's extra strength double sided foam tape definitely will, though more permanently .  (Back in my dorm days we stuck a chair to the ceiling with it...)



chase0444 years ago
heres an idea idk if you have thought about. but how bout making one like this but instead of knocking, putting a momentary switch on the door that you could put the same type of code into. you would have to press the button with the same timed rythem as knocking. this would make it more secure than knocking your code like you said since even is someone is watching you press the button it would be hard to tell the exact code you used.
Grathio (author)  chase0444 years ago
I think that would be great.  Connect to to a doorbell switch on the outside of the door and no one would know!  (Though they'd wonder why the doorbell doesn't work...)
robotkid2494 years ago
 This is sweet, fantastic build!!
BSprague4 years ago
 Thanks for this fantastic guide, I just modified it so that I have a laser activated door lock, which works by breaking the beam to a set rhythm. It works fantastically, and people can't figure it out simply by hearing it. ;)
Grathio (author)  BSprague4 years ago
 That's a great idea!  I'd love to see a photo or video of it  in action.
 My camera is broken, but I'm picking up a new one in a couple weeks hopefully. I'll definitely record it doing it's thing and I'll send you a link.
kicker1094 years ago
this is the single most brilliant device i have ever seen
amr90004 years ago
Shut The Front Door!!
Alright, I'm seriously planning on building one of these. I think the main course is under the tree ;D
Also I see two other opportunities for this
1, ever lock your keys in your car?? either something that moves the thumb lock itself (would be easier on older cars) or something that actually installs inside the door on whichever cable 0.o
2, okay, little out there, but I'm picturing one of those rooms where the bookcase is the door. Or you know, something similar :P
wearingpink4 years ago
awesome idea and well done! it would be good for a bedroom door, especially in a college house. Too bad I don't know anything about building electronics.
MJDOG84 years ago
This is a great idea and i think i will try to make one
photis224 years ago
 Simply wonderful, I love it and would love to make it.
 I think this might also be a really interesting thing to put on the inside of a desk if you had a somewhat smaller version, that might unlock it aswell.
This has to be one of the "coolest" ibles I've seen!  I am totally going to have to try this sometime!  Now if only I can figure out how to make my sliding/pocket door open automatically, and incorporate that and the knock-lock together....
Yea.. definitely the coolest thing Ive ever seen
astro boy4 years ago
 man this is awesome ive just been thinking and im going a bit far like at first it was like position sensitive, then it turned into wouldn't it be cool if a drum kit came up and you played a beet or a guitar or even thinking to open it! way to futuristic but you never know. i think touch sensitive, position sensitive and time sensitive would be great
boltfox204 years ago
 There is one method for fixing the security problem. Instead of holding th button and knocking on the door, you could also hold the button until it enters the programing mode, push the button to the beat of the knock, then hold the button again to set that knock. That way no one would hear the new knock until after you need to use it.

Otherwise, this is a great idea, and would certainly be a good gift for a child if they have a "secret" club. Otherwise, this is also a great alternative to picking your lock when you lose your keys.
zebaron4 years ago
 I'm thinking of making one of these and moding it to open a desk draw.  What kind of motor would be best, some kind of mini hydraulic cylinder?  
Grathio (author)  zebaron4 years ago
Hydraulics are complicated and probably overkill for this. Depending on the design of your desk here are the ways that come to mind:

1) Rack and pinion.  Lego parts might come in handy.  Attach the rack part to the drawer, motor with the matching gear to the inside of the desk.

2) Spring load the drawer (put a compression spring or two behind it) and latch it closed with a solenoid.  When the solenoid withdraws the drawer springs open.
zebaron Grathio4 years ago
 Thanks a lot, I think I'll try going with the rack and pinion.
I've used power antennas for cars to actuate the drawers that my amps were in back in my high school days.
cacaloz4 years ago
very cool!. I like it very much. it very good idea.
What is electric board to use. Is it microcontroler or you make in yourself?
( blue board )
Absolutely first class!!  Would there be a way to voice-activate this device instead of the secret knock?
vr3604 years ago
 that was amazing!! congratulations!! :)
elmegil4 years ago
This is very cool.

I saw someone (an electrical engineer) do this for the lock on his Corvette, about 20 years ago....beatiful work, completely hidden, and no external lock on the car.

Not entirely sure how he would deal with a failure in the system, though I suppose he probably had a jimmy bar.
Alchymist4 years ago
I can see this being amazing for kids, bedrooms and tree houses etc. I wouldn't put it on my front door but the desire is still there :P
insanely cool one question though ... does it work with any sound like say a music clip from your phone? so if you put your phone next to the door and played the music clip it will open? because if thats possible then a person could create a "key" device that sends vibrations of a music clip to this lock opening mechanism .
Grathio (author)  computer_nerd4 years ago
 That is a very cool idea, but it won't work with this design.  The sensor pretty  much only senses big vibrations (like knocking) and not small vibration like sound.  The code would also need to be dramatically rewritten to account for arbitrary sounds rather than discreet timing between knocks.

Great idea though!
yea thanks for the quick reply and this item even though it may or may not have a solid consumer base its kool as mess!
erosser4 years ago
 This is Uber-brilliant!  Admittedly a little too advanced for me, but I shall attempt one after I play with some more microcontrollers.

Nice work!  The end product is very sleek and elegantly arranged.  Plus, an AWESOME idea!
revelae4 years ago
is the arduino capable of pitch recognition? cus i have an idea, theoretically the pitch of a knock should change with the location of the knock on the door, so if you recorded a single knock's pitch and then used that instead of a pattern, you could use that.
also, to the random observer it would seem like an ordinary knock.
JohnJY4 years ago
Very nice, extremely detailed!  Uses real English, not that LOL crap, and you even did something I haven't seen before, and I don't make things, the only thing I've done since I've been joined for a year is view Instructables, and I've never, never(!) seen anyone say what skills you'd need to make the Instructable.
How long does this type of quality take to create? 
Seven stars out of five!
Grathio (author)  JohnJY4 years ago
 Thanks!  

I think the skills are just as important as the tools and parts.  Nothing worse than getting into a project and finding out that you're in over your head.

As for how long it took...  I'm a bit of a perfectionist so it takes me quite a while.  When I made the original one I had no intention of making a DIY (or even a kit) so I had to make another one just to document it. That probably took 3 hours.  Plus taking photographs, I took a total of 127 photos.  Didn't use them all, but did Photoshop the best ones so they're clear as possible.  That's several more hours.  Writing and proofreading probably another 6=8 hours (or more).

So it's no small task, but people loved the idea so much that it seemed worth it to share.

But it depends on the 'ible.  For example my Make a glove work with an iPhone DIY took 90 minutes at most.
Spydamonky4 years ago
 I cant down load the code. it downloads as a tmp. could you post it please
Grathio (author)  Spydamonky4 years ago
 Just rename the .tmp file to .pde and you're good to go!
This would be perfect to permanently mount to a secret door, one that was flush in the wall. No outer lock, with a battery backup and constant power... You'd have to add the lock function though.. Would be fantastic for that secret lair I've always wanted.. And I know what you thinking, oh noes what if the power is out long enough for the battery to die.. Well, first off I was thinking computer battery backup, like a cheap one, should last a real long time, but on the off chance it did, I suppose you'd have to install some sort of batter life meter, and have a failsafe that unlocks it before it dies..

Only one problem, where can I put a secret door in my house.... Hmm...
Looks like it's time to start building that extension to the house... another cool thing would be like a container of some sort with a solenoid to open it up. Like a table or desk that just looks solid  w/ a built in power bar... plug the power bar in and presto the arduino is active and ready for your knocking.
 
Of course with this you would also want to hold the lock/unlock start in a variable so you could knock lock the thing as well. Perhaps I'll edit the code and maybe add a sensor to tell the script whether or not the door is locked so it can lock for me too...

On another note I am in the process of making a physical computing Club here at my college and we are going to be making some of these as one of our first projects. There are 10 of us in the club and it looks like we'll be getting approved for recognized status. Thanks to Grathio for making this open source and coming up with such a cool Idea. On a final note, i'd like to complement you on your elegant code Grathio It took me a few minutes to see how it was working but once I grasped the concept I thought that I would never be able to come up with that. It looks as if it could be used for a slew of other things as well.

Bravo!
Shazzam.tky4 years ago
Way too kewl man!
goeon4 years ago
 awesome ible btw step 6 image one it says "a food of leads attached"
Grathio (author)  goeon4 years ago
Thanks for catching that!  Fixed it.

(I'd give out patches for finding spelling errors in my 'bles, but I'd run out of them in about a minute.)
tahirhh4 years ago
You look like Jimmy Carr
ljfa3214 years ago
Put it simple, "Best Instructable Ever".
I can't believe you even describe the code for us :D~
Mooncaller4 years ago
 This is the coolest thing I ever seen!!! :D Good job!!!
lucek4 years ago
neat device now change out that typical door and lock for a hidden passage and your golden.
dark sponge4 years ago
 Nice! I might try this with a ATtiny and a servo I have from an old robot!
h3llo414 years ago
 so awesome, i really wish i knew a little more about tech so i can make one.
You really should sell these, i would buy it :D 
ClayChip4 years ago
This is just plain AWESOME! I do not know how to use Arduino, but this instructables makes me want to learn it.  5 stars from me.
Kaiven4 years ago
No way! My friend gave me a link to this video a while ago, it's such a cool device!
Joe426 Kaiven4 years ago
Featured on HacknMod a while back : http://hacknmod.com/hack/secret-knock-detecting-arduino-door-lock/
Get your patent on this one PDQ. This is a hell of a security device, no lock to pick or keys to lose.
That is the coolest thing ive ever seen!!! i dont have the time,money or skills needed but i really want one!!! 5 stars faved and subscribed!!!
crapflinger4 years ago
this is the bees knees! (and 23 skidoo and what not)...i really like the idea of putting a knock-back-device on it as well to do a challenge knock...you could do some massive annoyance with that (make a 6 level authentication profile where you have to knock, then it knocks back, and you have to knock, then it knocks back etc...)

another "modification" could be to use an actuall electric deadbolt (or something as simple as a really beefy solenoid) in place of the current deadbolt, so you wouldn't have to muck with lock turning mechanism....just tie into the existing contacts on the electrick lock and you're good to go...

or make it a "star trek" door....put some form of actuator...so once you authenticate and the door unlocks, it also opens the door for you...this would be made even more awesome if you've got pocket doors....it could even play the star trek "door open woosh" noise