More info at https://www.rudolphlabs.com/projects/knock-lock
The basic idea is to be able to open the deadbolt on a door without a key, by using a known sequence of knocks. Obviously this isn’t the cutting edge in home security, it works nonetheless.
I used a piezo element to detect knocks. I got the piezo element out of an old Radio Shack siren that didn’t work any more – in the video, you can see the original housing for the siren is still there (but gutted of the driver circuitry).
An ATMega328 processes the knocks. The code times the intervals between knocks. If any given series of six intervals matches a stored set of six intervals (the correct knock sequence) to within a given tolerance, the ATMega opens the deadbolt. To do so, it turns a servo motor which grasps the deadbolt handle. The ATMega also flashes an RGB LED at various points: blue = knock detected, red = wrong sequence, green = correct sequence. This was mainly for troubleshooting – when the door is locked, the user is on the opposite side, and can’t see the LED anyways.
Check out the video here for the physical structure. The device clamps to the door using some neodymium magnets that are embedded in the wooden frame. This makes for very clear vibration transmission from the door to the piezo sensor. The wooden attachment on the servo shaft turns the deadbolt handle itself.