How do I detect the pattern of the knock on a door, and use it as a signature to unlock a door?
This site has fairly detailed answers to how they did it

http://grathio.com/2009/11/secret-knock-detecting-door-lock.html

Method description from that webpage, for permanence:


  A microphone (okay, really a speaker) presses against the door and
  listens for knocks.  If it hears the right number of knocks in the
  right cadence it triggers the motor to turn the deadbolt and unlock
  the door.  If the sequence isn't recognized, the system resets and
  listens for knocks again.