I modified the project to a) delay after pushing the button so I could close the box, b) use an internal pullup resistor on the button instead of an external pulldown, to reduce the parts count, c) debounce the button, d) explicitly ignore noise from the servo on the piezo sensor.
Once the button is pressed, I have 12 seconds to close the box before the servo moves to the locked position. 3 knocks unlock the box.
Interestingly, I found the mechanical work to be the largest part of the project: deciding how to mount the LEDs, piezo sensor, and servo; adding wiring so I could mount all that stuff; aligning the slot with the horn of the locking servo. I'm finding that the mechanical part of most Arduino projects is the largest part of the project.
Watch video Arduino Starter Kit Project 12: Knock Lock - modified online without registration, duration hours minute second in high quality. This video was added by user Bradford Needham 28 February 2015, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,32 once and liked it people.