Progress Bar

Skip to main content

Jaycar
...

Secret Knock Detector

Secret Knock Detector

Difficulty

Summary

We saw this project on Instructables, and had to try it for ourselves. Of course, we ended up using all the Duinotech parts we had around. It uses a piezo transducer as a microphone to detect knocking, and then activates a relay if the correct knock sequence is detected. The original project was designed to unlock a door, but our version has a relay output which you could use for just about anything.

Materials Required

1
1
1
1
1
1
1

Table of Contents

Most of the connections can be seen on the photo above, but note that D2 is connected to ground with a small loop of wire (we shortened one of the resistor legs and used an offcut). This keeps the Secret Knock Detector from entering programming mode. The resistor itself is connected between A0 and ground like the piezo, and can be just seen on the left of the Nano board between A0 and GND.

Duinotech

Relay Board

RGB LED

Piezo

Function

5V

5V

 

 

Power

GND

GND

-

Black

Ground

A0

 

 

Red

Signal from transducer

D4

 

R

 

Red LED

D5

 

G

 

Green LED

 

 

B

 

Blue LED - not connected

D3

S

 

 

Input for relay board

D2

 

 

 

Connect to ground

Compile and upload the code to the board, making sure the board type is set to Nano. Once the green LED comes on, knock on the table next to the sensor. It should blink off to indicate it is detecting the knock. It’ll probably then go off for a second- this means it didn’t detect a correct code. The default code is ‘Shave and a Haircut’.

You can also open the Serial Monitor in the Arduino IDE and monitor it’s output to see what the detector is detecting.

Future Improvements

The Instructables page has some good suggestions on how the software can be changed, including printing out the code and changing the default code.

Similar projects you may be interested in