Instructables
This is a simple Arduino sketch that was originally designed to experiment with arrays and the built-in timing functionality. I based it on the tutorial sample code http://www.arduino.cc/en/Tutorial/Knock

The system consists of a piezo sensor connected to an analog pin that listens for a knock from the user. The Arduino then stores the time the knock occurred in an array. After a predefined time without further knocks occurring, the Arduino will 'play back' the knocks on a buzzer and LED in time to the original knocking pattern.

The device could be expanded to include a stepper motor or similar suitable output that would recreate the knocks exactly, just replace the output buzzer.
You could also use the piezo input sensor as the output buzzer by altering the code.
 
Remove these adsRemove these ads by Signing Up

Step 2: Assemble

Picture of Assemble
The configuration of the device is fairly simple.

1. Connect the LED to pin 9 (via the resistor) and GND.
2. Connect the output buzzer to pin 8 and GND.
3. Connect the knock senzor to analog pin 0 AND GND.
4. Connect your 1M resistor to the positive wire of the knock sensor and GND. This is used as a pull-down resistor.

Note: Be sure to check that my resistor recommendations are correct for the components you are using, including the lack of resistors on the two piezo buzzers.
jjurotte7 months ago

Works great Dan. Well commented code too :-)

azharz1 year ago
Very nicely done.
dan_nicholson (author) 1 year ago
It's a SainSmart UNO (an arduino clone)
Ma77h3w1 year ago
what type of arduino is that?