Introduction: Legend of Zelda Musical Chest

Picture of Legend of Zelda Musical Chest

As many of you know the Legend of Zelda is one of the most popular video game series to have ever been made. The Ocarina of Time is probably the most popular game in the series having a total of 7.6 million copies sold during it's lifetime. One of the most iconic features of the Ocarina of Time is when you open a chest.

As you go to open a mysterious chest a tune starts to play. This tune causes anticipation and suspense. When the tune hits it's climax Link holds the item he has found over his head in victory and a triumphant score is played. You feel accomplished for just opening a chest and holding an item.

So the goal for to day is to recreate that here. So equip Master Sword and grab you Hylian Shield, you have some items to collect!

Materials:

  • A chest or a box or a container of some sort
    • I bought a plain chest from a craft store and then stained the wood
  • copper tape
  • a piezoelectric speaker
  • WS2812 LED strip (length can vary)
  • chipKIT Max32
  • 4-AA battery pack
  • AA batteries
  • 10K-Ohm Resistors
  • Wires
  • Solder
  • (Optional) A lever or switch

Once you have clear all of the dungeons and gathered all of your items let the adventure begin!

Step 1: The Design Dungeon

Picture of The Design Dungeon

The first thing to consider when setting up your chest is the circuit of everything inside. The main part you really need to worry about is the button set up. The reason why this is such a big concern is because I used the actual chest as a button. When the lid is closed the button is being pressed. When the lid is open the button is not being pressed. It's a great way to get the timing correct for when the user opens the box.

You'll want to make sure you have enough space in your chest to hold a battery pack, a Max32, a LED strip, and wires. If you want to have your box look more beautiful then you'll have to find away to cover up all the wires and circuitry.

Step 2: The Music Dungeon

Picture of The Music Dungeon

To create the classic song from Legend of Zelda you'll need to know the notes, have sheet music or be able to remember how it goes exactly. I found some sheet music at this website.

To create the notes you need you'll need to know the frequencies of each note. Since most people don't have super precise hear and frequency calculating ears you can use this helpful wiki page.

Finally to defeat the Music Boss you'll need to make a function in Mpide that will take the frequencies and make them play over the piezoelectric speaker. There's a handy learn module on the Digilent website that can help with this or you can check out my previous Instructable or this blog post.

Here's some handy pointers when you're coding though:

  • Define all of your notes and variables and have them set to the correct frequencies. This will make things much easier.
  • You'll need to know the tempo of the song.
  • Having a little bit of a musical back ground would be helpful

I'll post how I coded this section later in this Walkthrough but I encourage you to take a shot at it yourself.

Step 3: The Dungeon of LEDs

Picture of The Dungeon of LEDs

I used a WS2812 LED strip from Digilent. The length of the strip should wrap around the inside of your container. I had a total of 12 LEDs on the strip. If you purchase the strip from Digilent you won't need to solder any wires to the strip. If you plan on modifying the strip or using a strip that doesn't have the preset wires you may need to solder some stuff to it. Make sure when you solder that you have the strip facing the correct way. solder the wires on the side where the arrow is point towards the other end. Check out this Instructable to see how to use the WS2812 LED strip.

You will need to download the PIXcel library to get the LEDs to work properly. If you follow the Instructable above it will show you how to download and install the library easily. If you already know how to install Libraries you can click here to get to the repository of the PIXcel library for the WS2812 on the chipKIT.

The way I wanted my LEDs to work was I wanted to have a trailing effect with a Gold light LED. The LED would be full bright and then the next LED would less bright and so on and so on. I was able to talk to one of my coworkers and friend, Marshall, who generously let me use his one of his old projects. Marshall's LED Fedora is quite popular around the office. There is one effect that it can do where it trails green all the way around the hat. You find his LED project on his github. I'll describe how to use the code later on.

You can use either green-red-blue(GRB) or hue-saturation-value(HSV) values for your LEDs. The GRB is better for getting more precise colors but the HSV is either to change brightness saturation. I used the HSV to get my gold colors.

Hue: 150

Saturation: 255

Value: varied to change brightness.

Step 4: The Chest in the Dungeon

Picture of The Chest in the Dungeon

To set up your chest you'll need to start with some copper tape. The way to get this to work is that there needs to be a button being pressed so the chipKIT knows to not play music and start the lights right away. The chest I'm using isn't heavy enough to hold down an actual push button. I improvised and made a quick button using the chest it's self.

To start take a piece of the copper tape and put on the middle part of the back edge of the lid . Next you'll want to take two other pieces of copper tape and put them on the connecting edge of the chest where the lid copper tape will touch them. Make sure those two pieces aren't touching. As you can see when you close the lid it will create a closed circuit. When it's open the circuit is broken.

Next you'll need more copper tape and wires. Take one wire and put it on one of the bottom copper strips and the lay the new copper strip over it to hold it in place. On the other side put two other wires on the same way. The single wire will be the power to the button. The other wires will act as the ground and the wire signal. The ground and signal will need the 10k-Ohm resistors for this.

Step 5: The Mpide Dungeon With the Coding Boss

Picture of The Mpide Dungeon With the Coding Boss

To start with your code you will need to include your PICxel.h library

I also defined the pins that I used for the button, piezoelectric speaker and the LED strip. You will also need to define the number of LEDs on your strip.

to get the LED strip working you'll need to define the strip function. here you will be to decide if you want to use either GRB or HSV.

PICxel strip(number_of_LEDs, LED_pin, HSV);

From there I defined all of my global variables such as my notes and the LED values.

The next set is part of Marshall's code where he defines the hue, saturation and value variables. He also sets up an array for the values for each LED strip. I modified his array to fit the length of my strip, the result I wanted, and the colors and values I needed.

The setup function is next where you set the piezo pin to output and the button to input. Also you need to intialize your LED strip to make it begin.

You need to make a function that will play the your notes frequency. earlier I linked you to some websites that should help with this. Try to figure this out yourself if you can but I will post my code for this also.

Next I made my functions for the trailing LED effect and then all LEDs on. The trailing LEDs came from Marshall's code but it was modified. The full effect was simple to create. Give it a shot.

My music playing function is more then just for music. I started this program without considering doing some form of interrupts. So after each note I had the LED trail increment once. At the beginning you'll want to define each of your note lengths based on your tempo. Take the tempo (beats per minute) and convert it to milliseconds per beat. So a sixteenth note is 1/4 of tempo calculated.

The loop function is where your code will determine if the box is open or not. I used a couple if statements for each section. So if the button is high (lid is closed) nothing happens. If the button is low (box is open) music plays and lights go. Try to give it a shot before you us my code.

Step 6: Final Boss (Finishing Touches)

Once everything is set up and working you can do the final steps. Any of these steps are optional and they are purely suggestions.

If you want you add an On and Off switch to your power source. That way you don't have to fiddle with wires every time you want to turn it on. You could also even cut a hole into your box to put the switch on the outside of the box.

Make it pretty! Add some designs if you want to it. Spruce up the outside so it looks rustic or old or how ever you want.

Try hiding the circuitry on the inside. You could get a piece of wood to cover up the board and the wires but still have the LEDs out. You could stick the batteries in the lid of box so it's out of the way.

Try thinking of other ways to make your box stand out. Remember, the cooler the box looks the better the treasure will be inside.

Step 7: Final Thoughts

I hope you guys have fun making this as much as I did. I would suggest you try writing the code yourself before trying others. It's always good to have some practice. If you need any tutorials check out the chipKIT website or the Digilent Learn Webpage.

If you have any feedback at all please let me know! I'd love to see what you guys do with this or how you improve it. Let me know if there's anything wrong with this Instructable or the project itself. I'll try to fix it as quickly as possible. Thank You and enjoy.

Keep on building!

Some of these photos were taken by my friend Quinn Sullivan.

Comments

NameAnxiety (author)2015-07-10

This is great. If I ever suspend my hatred of putting together circuits long enough to make this I'll be sure to post a picture.

A few thoughts: Would there be a way to cover up the wires and battery pack on the inside? The outside looks good, but the inside's a mess of wires. I think a frosted plastic sheet of some sort would cover all that up while letting through and diffusing the light. Of course, we never see the inside of the chest in the game, so I guess it could just be a gob of circuits and LEDs. How would we know?

Point the Second: There's no item in it! I just finished this long-ass dungeon, and I don't even get a few Rupees? No way. This is an easy fix, however. If you have access to a 3D printer, this will probably be helpful. If you don't, you could probably sculpt something like a Key or a Piece of Heart out of modeling clay. If you're going to go this far, you might as well go all out.

Again, this is a great idea, and I hope I get to make one one day. I should make one for my friend's birthday. He hates how the chests open in Ocarina. He says it's a waste of time to wait for Link to finish gawking at whatever is inside before you get to use it. I know it's a lot of energy to expend on what is basically a prank gift, but it is a nice chest.

bprew1 (author)NameAnxiety2015-07-13

Thanks for the comments! You could probably cover the wires with a thing piece of wood to lay over the board. Also the LED strip I was using has a sticky tape side so you could stick it to the edges of the box. You would just have a couple wires sticking out here and there. Also I would have stuck the battery pack in the lid and covered it up with some stuff but I ran out of time. If you have want design a circuit with out having to make it first check out this program called Fritzing. It'll allow you to design circuits digitally.

We do have a 3D printer but I'm not yet sure how to work it yet. Maybe I'll learn and post an Instructable about how to do that and my learning process.

The chest sequence in Ocarina is obnoxious. But it is one of the most Iconic things about the series. I personally enjoy Link to the Past much more. Here's a video you should watch about someone comparing Link to the Past and Ocarina of Time.

Thank you for taking the time to comment on my project I really enjoy it :-)

NameAnxiety (author)bprew12015-07-13

I love that video. My friend actually forced me to sit down and watch it a few months ago. He said "See? SEE?! I'M NOT CRAZY!" I've only played Wind Waker, but the point still stands. I thought the whole Sequelitis series was masterfully done, and I hope Arin makes another one before I die of old age.

"You took fun and made it un-fun".

JColvin91 (author)2015-07-07

Sweet!

Why do you need the solder though? It looks like the WS2812 strip from Digilent you can just use normal jumper wires to connect it to whatever board you're using.

bprew1 (author)JColvin912015-07-07

You're very right about that. I went through and changed that. Digilent's LED strip doesn't require soldering. I soldered pieces of LED strips together to make the length I wanted. I also used solder to attach a resistor to a wire for the button.

About This Instructable

5,381views

205favorites

License:

Add instructable to: