Instructables
loading
loading
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
« Previous41-80 of 314Next »
yashkapoor7544 months ago

unable to upload code gives error Arduino: 1.6.0 (Windows 7), Board: "Arduino Uno"

sketch_mar01a.cpp.o: In function `setup':

/Arduino/sketch_mar01a.ino:46: undefined reference to `pinMode'

/Arduino/sketch_mar01a.ino:47: undefined reference to `pinMode'

/Arduino/sketch_mar01a.ino:48: undefined reference to `pinMode'

/Arduino/sketch_mar01a.ino:49: undefined reference to `pinMode'

/Arduino/sketch_mar01a.ino:54: undefined reference to `digitalWrite'

sketch_mar01a.cpp.o: In function `triggerDoorUnlock()':

/Arduino/sketch_mar01a.ino:163: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:164: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:166: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:168: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:172: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:173: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:174: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:175: undefined reference to `delay'

sketch_mar01a.cpp.o: In function `validateKnock()':

/Arduino/sketch_mar01a.ino:210: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:211: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:212: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:213: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:214: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:215: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:217: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:218: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:221: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:222: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:223: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:225: undefined reference to `delay'

sketch_mar01a.cpp.o: In function `listenToSecretKnock()':

/Arduino/sketch_mar01a.ino:85: undefined reference to `millis'

/Arduino/sketch_mar01a.ino:86: undefined reference to `millis'

/Arduino/sketch_mar01a.ino:88: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:90: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:92: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:93: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:95: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:99: undefined reference to `analogRead'

/Arduino/sketch_mar01a.ino:103: undefined reference to `millis'

/Arduino/sketch_mar01a.ino:108: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:110: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:112: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:113: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:115: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:119: undefined reference to `millis'

/Arduino/sketch_mar01a.ino:130: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:132: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:133: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:134: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:135: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:137: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:143: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:144: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:146: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:147: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:148: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:149: undefined reference to `delay'

/Arduino/sketch_mar01a.ino:150: undefined reference to `digitalWrite'

/Arduino/sketch_mar01a.ino:151: undefined reference to `digitalWrite'

sketch_mar01a.cpp.o: In function `loop':

/Arduino/sketch_mar01a.ino:59: undefined reference to `analogRead'

/Arduino/sketch_mar01a.ino:61: undefined reference to `digitalRead'

/Arduino/sketch_mar01a.ino:66: undefined reference to `digitalWrite'

C:\Users\kaumudi\AppData\Local\Temp\build8307707147705721311.tmp/core.a(main.cpp.o): In function `main':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:32: undefined reference to `init'

collect2: error: ld returned 1 exit status

Error compiling.

please fix

Grathio (author)  yashkapoor7544 months ago

I've just tested the code with your setup (Arduino 1.6.0 IDE, Windows 7 Arduino Uno) and found no errors.

Troubleshoot your system by uploading a simple sketch, like Blink, and make sure that works. If so, download the secret knock sketch again, and follow the instructions.

can we use arduino uno for knock detecting door lock system?

Aidanj15 months ago

Have not made this yet, but you can make a song detector where you have to play a song to open it. It would take a little more programming, but would be fun.

goldenshuttle5 months ago

If you replace the piezo with a microphone, will it work as a secret clap switch ?

Grathio (author)  goldenshuttle5 months ago
If you want to use a microphone, check out this version of the project: http://makezine.com/projects/sound-activated-outlet/

(It's not a door lock, but you should be able to swap the circuit for the microphone, and the code, and get something that works.)

Thanks Grathio: indeed the link you gave has things that would do. Now I am working on a totally different project based on the clap switch..sky is the limit here...many thanks..please keep posting these creative gems.

thank you for this great project sir..

Sundback5 months ago

Hi Grathio!

First of all - a very nice project! I have a tiny problem and that is that when I've unlocked the door I can't turn the lock back to it's origin. When I've unlocked the door, how am I supposed to do so I can turn the lock back?

I would really like to get an answer.

Thanks in advance, Alex.

Nadeera NadiM5 months ago

what type of motor and lock its specification

we took this idea for diploma engineering project, we made the circuit connection correctly. after that connect it to the Aurdiuno (freeduino board). but the motor is not running. can u tell us the probable errors? pls reply fast..........

RHED6 months ago

can i use electret mic as substitute to the piezo?

ArvindS28 months 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?)

Regards

AzizK1 ArvindS26 months ago

we are using Uno board aswell, code will not compile properly. can you help us?

Krizbleen made it!6 months ago

Guys - thanks for posting this tutorial! I used the code as part of my secret sliding library door project and it works great. People giggle when I demo it to them. I owe you a beer for this!

IMG_0363.jpg
shreyask1 made it!6 months ago

AWESOME!!!!!project......It works properly.......Can someone say me how can i put a servo instead of a geared motor........PLZZZZ.

SECRET KNOCK DETECTOR.jpg

Hey guys, how can I program a DEFAULT secret code? I means how can I determinate de values (in the array), per knock? for example if I want something like "HBD to YOU" or "We r the champions my friend", many thanks for your help.

Grathio (author)  El_Minion_Dice7 months ago
Great question! The default timing information is stored in a variable near the top. It looks like this:
 int secretCode[maximumKnocks] = {50, 25, 25, 50, …
The easiest way to figure out what the new numbers should be for your rhythm is to have the lock its self tell you. To do that find the line near the bottom of the sketch that reads:
// only turn it on if there's a delay
Right below that, add this, on its own line:
Serial.println(secretCode[i], DEC); 
This will print out the secret code values when you program a new knock.

Upload the modified sketch to your Arduino, and keep it plugged into your computer.  Open up the Serial Monitor in the Arduino IDE. (It's the little magnifying glass button on the upper right. In older versions it looks like a radio.)  On the little window that pops up, be sure to set the baud rate to 9600. (The little pulldown at the bottom right should read "9600 baud"). If everything's working correctly you should see the text "Program start." in the serial window, and it will print some other status messages as you use the knock.

Now program a new knock like normal. When you're done you'll see some text and numbers in the serial output window. There will be twenty numbers.

Go back to the sketch and find the line near the top of the sketch that starts:
int secretCode[maximumKnocks] = {
And replace the numbers with your new numbers, starting from the top of the list. Make sure there are 20 numbers, and there are commas between them all, or the sketch will break. When you're done it might look like this (but with your own numbers, of course):
int secretCode[maximumKnocks] = {72, 54, 66, 60, 100, 45, 22, 80, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
After making the change, upload the modified sketch, and you're done! The new default will have been changed.
george.kaileh made it!7 months ago

Hello

I've made your project, but I have changed 2 things in it:

1- Instead of piezo speaker I have kept resistor alone so nobody can hear the knock (its now working by touch, all you have to do is touch the resistor as the secret knock and the door will open)

2- I have put the battery from outside the door as a key to power everything, by that way you won't worry about the battery dying or electricity outage (if you're using a power adapter).

10807936_857862580914937_1963219683_n.jpg10816036_857844824250046_604419573_n.jpg10805515_857861067581755_1409710774_n.jpg
justnik677 months ago
The author has stated he will not answer questions for beginners. So did you make this for people that already have the skills to do it on their own? If you are not here to teach, then you are just showing-off! I am a total beginner but managed to figure out a way. Instead of using a motor, I used a 12v solenoid lock from adafruit. It automatically locks and there is no need to make metal brackets or a PVC contraption. Use a seeed relay shield. Move motor control digital pin 3 to one of the relays on digital pin 4,5,6, or 7. Now you can control anything up to 120vac. You will also have three additional unused relays available. Move led 4 and 5, to digital pins 8 and 9. I also took apart a Gfi 120vac outlet I had installed just outside the door, and wired the reprogram button to the test switch. If you want it fail safe, rewire the reset button in the gfi to a battery. 120vac power can also be used from the outlet, to the relays if you need it. Anyway, that's how this beginner did it.
goldenshuttle7 months ago

This is a great project. Can it be extended to make a multi-appliance clap control system ? like certain clap opens curtains, certain clap closes curtain, another clap opens cupboard drawer, and other clap closes it..and so on in one Arduino sketch ?

Eloisa CamelM8 months ago

thank you sir it worked.. :)

Eloisa CamelM8 months ago

it worked sir.. thank you very much..:)

mr led8 months ago
that`s so interesting.
reyscreamz9 months ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz9 months ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz9 months ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz9 months ago

what type of door lock should i use?

please specify :D

thank you so much

reyscreamz9 months ago

what type of door lock should i use?

please specify :D

thank you so much

igorandrade10 months ago
ndiaz910 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!10 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

knock.jpeg
sarci1 year 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 sarci11 months ago

docu please :)

Roberto11t12t12 months ago

What size does the SPST momentary pushbutton have to be?

maski11 year ago

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

palominom1 year 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.

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

Danny1411 year ago
Please help I need this for a school project please...
Danny1411 year 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
« Previous41-80 of 314Next »