Picture of Secret Knock Detecting Door Lock
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
1-40 of 274Next »
KGuy8 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.

Grathio (author)  KGuy8 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.

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
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. :)
ArvindS211 days ago

Hey Grathio

We took this idea for school project. We made the circuit connections correctly. After that we connected it to the Ardiuno ( UNO instead of a duemilanove). But the motor is not running. Can u tell us the probable errors? ( Will UNO cause problem since we didnt use Duemilanove?)


mr led11 days ago
that`s so interesting.
reyscreamz1 month ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz1 month ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz1 month ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz1 month ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz1 month ago

what type of door lock should i use?

please specify :D

thank you so much

igorandrade1 month ago
ndiaz92 months 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!2 months 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

sarci4 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 sarci2 months ago

docu please :)

Roberto11t12t3 months ago

What size does the SPST momentary pushbutton have to be?

maski14 months ago

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

palominom5 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


Danny1418 months ago
Please help I need this for a school project please...
Danny1418 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
mbessam8 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 jkctech10 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
KGuy10 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 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 :)
sleepyone11 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.
1-40 of 274Next »