[youtube:http://youtu.be/CC1LJgOTENY]

Everyone loves treasure hunts. Running around on a quest to find your present makes any gift better. So just for fun, I designed my own variation of the game. I combined an Arduino microcontroller with an Adafruit Wave Shield to make an audio treasure hunt box.

The treasure hunters are given a code. When they enter the code into the box, it will play a short audio clip that gives them a clue as to where they should go next. When they arrive at this location, they will find another code, which they will enter and get another clue. This continues until they arrive at the final location and find their present.

Project Steps

Assemble the Wave Shield

The Wave Shield is an add-on to the Arduino that allows it to play music. It can be purchased at Adafruit. This comes as a kit that you have to put together yourself. The first step is assembling the Wave Shield. There is a very good tutorial on how to do this on the Adafruit website.

First, find and identify all the parts. The part numbers may not match up exactly. Be very careful to correctly identify the two 8 pin IC chips. Then solder them onto the circuit board. To make it easier, start with the parts that are the most difficult to solder, such as the SD card holder. You will have more room to work around before the other parts are installed. Continue soldering on parts until they are all installed.

The wave shield connects to the Arduino board with header pins on the bottom side of the wave board. These pins fit into the pin sockets on the Arduino. Adjacent to the pin holes where these header pins are mounted is a second set of holes that are connected to them. These let you connect external components to the pins on the Arduino. You can solder wires directly to these holes or you can use header pins for removable connections. The kit comes with eight additional header pin connectors. Two of these I soldered to the 5V and GND pin holes. The remaining six I connected to the analog input pins.

The kit does not come with a speaker — you need to provide your own. The wire from the speaker can be attached to the two open pin holes that are adjacent to the headphone connector.

Alternatively, a full Audio Player WaveShield Kit is available in the Maker Shed

Download and Install the Wave Library

In order to make the wave shield work, you need to install the waveHC library. You can download a copy of it here.

Download the zip file and unzip/extract the files. Copy the WaveHC folder into the libraries directory of your Arduino program folder.

You can find a detailed tutorial on the library and how to use it here.

The Arduino Code

[protected-iframe id=”3fc44e520a3505278cf89711b61f5c2f-30206320-62929444″ info=”https://gist.github.com/interested1/1e06518d12e4407cf0e5.js” ]

Changing the Message Codes and Adding New Ones

​I have six patterns set up in the example code. These are stored in arrays labeled “secretCodeOne”, “secretCodeTwo”, etc. You can add more to make the treasure hunt as long as you want.

Start by adding more arrays. These are initialized at the first of the void loop. Then add another “for” loop to check the pattern. This should include a reference to additional audio clips.

Record the Audio Files

Next you need to record the audio tracks that will be the clues in the treasure hunt.

First, decide on what kind of clues you want to use. You have a lot of options. You can keep it simple and just say the location of the next clue code, or you can make it more difficult by having each clue be a riddle. You can find some good example riddles here. You can also quote lines from books that they have read and have them find that passage in the book or the objects that they are talking about. Another fun option is to record various sounds around the house and they will have to go find the objects that make those sounds. The possibilities are endless; just use your imagination.

Make one extra soundtrack that will play if they enter the code incorrectly. This can just be a buzzer, or you saying “wrong.”

Convert the Audio Files to the .WAV Format

The Wave shield can only play audio files in the .WAV format, so if your sound recorder saves the files in a different format, you will need to convert them to .WAV.

If you have iTunes, you can use this tutorialto convert them.

You can also use online file converters such as this one.

Regardless of which program you use, you need to convert the file to the .WAV type. The bit resolution should be set to “16 bit”. The sampling rate should be set to 22050 Hz (or 22.050 kHz). The audio channels should be set to “Mono.”

Load the Files onto the SD Card and Install it

Next, copy the .WAV files onto the SD card. You need the file names of the sound clips to match the file names in the code. The wave shield is a little picky about how the files can be named, so for simplicity, I called the files 0.wav, 1.wav, 2.wav,…etc. I made it so that 0.wav is the error message and the rest of the sound files are the clues in order. If you rename your sound files to match this, you won’t have to change the code.

Once the files are on the SD card, plug the card into the Wave Shield.

Drill Holes in the Housing for the Buttons

To avoid conflicts with other parts that will be mounted inside the housing, try to fit the speaker, the boards and the battery in place to see where there will be room for the buttons.

Once you have decided on a good location, drill holes in the side of the housing for each of the buttons. When you are done, you may wish to clean up the edges with a knife or file.

Connect the Buttons to the Board

First you need to mount the buttons to the side of the housing. Unscrew the mounting nut from each button. Insert the button through the holes. Then tighten the nuts back on to hold them in place.

Now you can connect the buttons to the board. One terminal of each button will be connected to the analog input pins. The other terminal of each button will be connected to GND.

To connect the terminals to ground, I took a single wire with a female header pin connector on one end and I wired that to one terminal on the first button. Then I connected the other switches to that using a string of short jumper wires.

To connect the other side of each switch to the board, I used a six terminal header pin connector cable. The header pin block connected to the pins on the board. The wires were connected to the other side of the buttons. I highly recommend insulating each connection with heat shrink tubing.

Mount All the Parts Inside the Housing

Now all you have to do is mount all the parts inside the housing. First, slide in the speaker. Use glue to hold it in place if necessary. There is a lot of exposed metal on the back of the speaker, so I put a piece of paper over it so that it wouldn’t accidentally cause a short with any of the connections on the board. Then carefully fit in the boards. This was a little tight with the housing that I used. I ended up removing the volume knob on the wave shield to make it fit better. Lastly, connect the battery and fit that in place. Be sure to use a brand new battery. If the battery is too low, the system won’t work properly. Now just close up the housing and your audio treasure hunt box is complete.

Hide the Clue Codes at Each Location

The final part of the setup is to hide the clue codes at each location. You can write the code on a piece of paper or you can write directly on the objects. If you want, you can even make it a little harder by giving the code number in the form of math problems.

Give the Box to Your Treasure Hunter and Watch the Fun.

Wrap up the audio treasure hunt box as a regular gift. Include a note to get them started. Then just sit back and watch the fun.