A locking chest with a musical key


[Basil Shikin] was thinking about different types of locks, and was trying to come up with a locking solution that he had yet to see. It dawned on him that he had never come across a lock triggered by music, so he set off to construct one of his own.

He ordered a wooden chest online, then proceeded to piece together the electronics required for the locking mechanism as well as the music detecting logic. Using an Atmega328P paired with an electret mic, his system listens for a particular tune (the Prelude of Light from the Ocarina of Time) to be played , which triggers a tiny servo to undo the latch. To do this, he implemented a version of the Goertzel Algorithm on the Arduino, allowing him to accurately detect the magical tune by frequency, regardless of what instrument it is played on.

Be sure to check out the video below to see his musical lock in action.


  1. Bruce Rennie says:

    Check out an episode of Stargate Atlantis (cannot remember the season). Room unlocked by series of musical notes. Rodney and Daniel looking for a hidden laboratory.

    • JB says:

      Also done in the original Star Trek (don’t remember name of episode) in which a giant repulsor beam deflected an incoming asteroid. It was trigrered by musical notes.

  2. Isaac says:

    Seriously cool. I wonder how hard it is to rewrite to work with a different tune. Always thought Prelude of Light was the worst tune in OoT.

  3. Dustin says:

    Goertzel on Arduino is cool. I did one as part of a software defined radio once for DTMF detection.

  4. firefightergeek says:

    I really think he needs to use:

    G, A, F, (octave lower) F, C

  5. charles says:

    It’s a cute trick. Tis deserving of being a gift. I could see this being used as a garage door opener or closet lock or even to start coffee in the morning.

    Yet I am duty bound by my post here: http://hackaday.com/2012/04/15/a-glorious-mechanical-seven-segment-display/#comments to point out something.

    To unlock this without damage:

    1. Hold vertically with the right side pointing down. Firmly hitting it on a surface while light pressure on the lid. It causes the servo to move out of the way via momentum.

    2. Merely get a thin piece of music wire or shim stock and push the latch out of the way from the left side.

    To make it more better:

    1. Use a box with a lipped lid AND

    2a. Use two locking detainers in opposite directions. Not necessarily need two servos to do this.

    2b. Use a wide arc rotation for locking. A minimum of 90 degrees to open would suffice.

    I apologize for my unhealthy focus.

  6. Mon says:

    Really should’ve been Zelda’s Lullaby…

  7. j616s says:

    There’s that lock in Willy Wonka too. Any takers for a project?

  8. Chad says:


  9. Noxonomus says:

    There was music based lock on a safe in an episode of It Takes A Thief as well.

  10. noouch says:

    And then there was the lock in Moonraker…

  11. wardy says:

    Does anyone remember the old point ad click game “Loom”? This reminds me of Loom, where the point of the game was to use a magical music staff to manipulate your environment by playing the right tone sequences. One tune would make you invisible, one tune would move an object, I think it had tunes to open doors like this. Great game, nice to be reminded of it.

    Good hack.

  12. tom says:

    whargarbl! I’ve been writing something like this in processing for a while now!

    Mine doesnt work though (yet..)

  13. Mike Shawaluk says:

    When I saw this post, I was really hoping he would have used the melody from “Endearing Young Charms” for the unlock key. (Hint: think Bugs Bunny and Yosemite Sam)

  14. Danny says:

    Most things have been done before… 1985… Macgyver. Season 1 episode 5 “the heist”. 4 tones were required to open a vault. . He beat it using some wine glasses. Pretty cool to see one built :-). Good stuff.

    • bshikin says:

      Quite honestly I have not watched Macgyver. But is sounds like the guy really knew how to hack things!

    • Mike Nathan says:

      “Done before” in the article was meant to relay that he had not seen a musically-controlled lock in real life. While I was certain they had been featured in TV, Movies, and video games over the years – it was the first time I had seen a real, functioning musical lock.

  15. rexxar says:

    How sensitive is it to frequency? Any marching band vet will tell you that temperature can have a huge affect on tuning. Even humidity, for some woodwinds. Also, some people don’t use “standard” A=440 tuning.
    Anyway, cool project!

    • andar_b says:

      I haven’t looked closely at the project, but if it were mine, I’d use the first note as the basis for checking the remainder of the tune, +/- a percentage for poor tuning on subsequent notes.

      That way, if you’re just whistling the tune, as long as you have decent pitch from note to note, only the relation to the starting pitch is relevant, not the actual frequency of each note.

  16. Patrick Dent says:

    Should have used G, F#, D#, (-1 octave) A, G#, (up octave) E, G#, C.
    (The ‘puzzle solved’ jingle)

  17. Tyler says:

    have you posted the code anywhere? I would love to take a look at it.

    Great work btw!

  18. Tyler says:

    nvm, I see your code, but I am confused about how you put it on the atmega chip. I was hoping to modify this to detect dtmf tones and put it in an arduino sketch. Is there any chance you could port this to an arduino .pde or .ino? I’d super appreciate it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 97,581 other followers