The idea was to create a box that opens if you knock on it with the correct rhythm. It may not be so useful, but it is a great chance to learn further Arduino and create something awesome, having the right to say: "I made it!".
Above you can see some sketches I made to figure out how the box will look. However, don't take the layout too seriously: in the final version it is different. But they are still useful to understand the "user interface".
Analyze the main image.
First of all, the switch (1): there is no much to say.
Secondly, three LEDs: when turned on, the red one (2) means that the box is locked. As you can easily imagine, the green one (3) means it is open. The last, blue LED turn on when the user knocks on the box. In this way, he/she knows if the box detected the input or not.
Then, the box provides three buttons. The first one (6) closes the box, the second one (7) plays the rhythm saved, and the third one (8) record a new rhythm.
Warning: due to technical reason, if you record a new rhythm it stays until you turn the box off. However, you can easily fix that saving the rhythm in the Arduino EEPROM (reference).
In the next step, I will show you how to realize the electrical circuit.
Step 1: Circuit and Code
Let's do it!
Things we need:
- a piezo element;
- a servo motor;
- a 100uF capacitor;
- three LEDs (red, green, blue);
- three push buttons;
- three 220Ω resistors, three 10kΩ resistors and one 1MΩ resistor.
You can find everything in the Arduino Starter Kit.
Recreate the electrical circuit. The scheme is the one in the main image.
I have insterted also some pictures of the completed circuit.
You can download the code from here.
Step 2: Finally, the Box!
Pay attention: the box's lid must not be totally straight, but it needs a vertical component, as mine does. The animated gif shows how the locking system works.
Make three holes for LEDs, three for push buttons and one for the switch. See the pictures.
Now, make another hole on the, and then smooth the area next to it inside the box, so the servo's flap has enough space to move. The servo motor will move in there and prevent the box from opening.
While making holes, try to be more precise than me. It was the first time I had a drill in my hands.
Finally, insert Arduino (or chip) and components inside the box. Fix the piezo sensor at the centre of the lid and the servo motor in correspondence of the last hole.
Congratulations, your KnockBox is ready to take care of your secrets!