Knock on this coffin to awake the dead. Don’t worry, the skeleton won’t get out and come after you but it will reply from inside.
Ok, we know that you know that there isn’t a real skeleton there. It’s really a piezo used as a knock sensor. After you’ve made this project you might think of a handy way to use this sensor in other ways. Check out this secret knock detecting lock for some inspiration.
- 1 Arduino Uno board
- 1 Basic Education shield
- 2 Piezos
- 1 1M ohm resistor
- 3 colored jumper wires
- 3 black jumper wires
- 1 9v battery
- 1 9v battery holder
- Knock-knock box kit
- Masking tape
- 1 breadboard
- Attach the shield onto the top of the Arduino board.
- Connect a piezo speaker to the breadboard and connect one leg to digital pin 8 and the other to GND.
- Using an separate breadboard, connect a 1 Mohm resistor between analog pin A0 and GND.
- Make a piezo knock sensor by connecting a second piezo speaker to the analog pin A0 and GND.
Build the Knock Knock Box from the kit provided.
Connect the Arduino assembly to the computer and upload exampleKnockKnockBox.
Disconnect the Arduino assembly and connect a 9V battery and holder to the Arduino’s power jack.
Place the assembly in the knock-knock box. Make sure the piezo serving as sensor is in contact with the lid of the box before you close the lid.
You can find the code in File -> Examples -> Castilla -> Magic -> KnockKnockBox
How it works
The first time you knock on the box, the recording begins. Each time the knock sensor is knocked, Arduino will record the time of this occurrence into an array. If you stop knocking for more than 2 seconds, it’ll be considered as end of recording. At this stage, the pattern of knocking will be played back through the piezo speaker.
- Make sure the battery is connected properly so the power LED on Arduino is on. Test with Arduino connected to the computer and 9v battery disconnected. If it works with the USB cable but not with the battery, there could be something wrong with the battery, change for another one.
- Remember to knock on the right wall of the box (the one with piezo knock sensor).
- See piezo knock sensor reference for debugging.
- Change the sound of how the box knocks back.