This one is the most complicated project I have ever faced: a box whose lock only opens if you knock on it playing a specified rhythm. It is not a miracle, neither black magic: it is just an application of the innumerable possibilities of electronics.
Because of the compexity of the project, I have split up its presentation in three parts: the first one is the introduction (you are reading it); the second one deals with the electronic and software aspects; the third one talks about the locking system.
The whole device is based on a “piezo”: it can be used to riproduce sounds of a certain tone as well as a sensor (see How to – Piezo as Knock Sensor).
- The switch (1) connect the electric circuit of the box to the energy supply, that is 4 batteries type AA 1.5V.
- When turned on, the box is locked. So, the red LED (2) is on.
- To open the box, you have to knock in the “Knock Zone” (5), that is the zone corresponding to the position of the sensor.
- Everytime the sensor receives an input, the blue LED (4) turns on.
- If the input corresponds to the saved rhythm (for every knock a tolerance of 150ms is applied), then the box will open, e the green LED (3) will turn on.
- To close the lock, press on the closing button (6). The red LED (2) will turn on again.
- You can also record a new rhythm: first of all, open the lock, knocking with the correct rhythm. Then, press on the record button (7) and knock on the Knock Zone (5) with the new rhythm. The piezo will play the new rhythm. If you want to complete the recording, press again on the record button (7). Otherwise, press the closing button (6) to annul the process.
- If you save the new rhythm, the box is closed automatically.
- If you cancel the recording, the box stay open.
- The play button (8) reproduce the current saved rhythm. It can be used only if the box is open.
- The saved rhythm can be longer than 10 intervals (that is 11 knocks).
- The input sequence is considered finished either if 3 seconds had passed from the last knock or if you have reached the 10 intervals limit.
In the next post we will discuss how to assemble the eletrical circuit and analyze the source code.