AVR Treasure Chest

Introduction

When my boys were very young, I made a treasure chest from a cheap toolbox, placed an electronic lock in it (AT90S1200) and sent them on a treasure hunt, solving clues and ultimately opening the chest to get their pirate booty, a pair of N64 games. Over the years that chest has been used on many such hunts, created by myself or the boys.

Fast forward over 10 years later and I felt it was time for a new chest, one that would run the treasure hunt itself, playing videos, sound effects, and even hand out paper clues. The typical scenario would start with the chest playing a video clue on the iPod touch, which would send the treasure hunters off looking for more clues and eventually get a key. Returning to the chest they would insert the key which would signal the chest that they completed that scenario and it's time to start the next one, which could be another video, or dispensing a paper clue or map. Once the last scenario was completed the chest would release the big spring loaded trunk latch and the treasure hunters could reap the reward of what ever was inside waiting for them.

Since the project was a secret I had to hide the construction from my boys, which meant working early morning before they were up, or when they were out and about. This slowed the development such that it took around 11 months to complete. What I finally ended up with is the following:


wooden chest 18"L x 11"W x 12"H
video playback iPod touch cabled to an ihome boombox
atmega64 main board
atmega48 led board
atmega48 tone recognition board
cerebot atmega64
Contains 14 Bi-color LEDs
Sparkfun amplified mic
sound effects somo-14d audio sound module on interface board
antique key recognition 3 ir led /sensor pairs


System Overview

The chest consists of several circuit boards cabled together to handle all of the functions. The main board is a Cerebot I, which is based on an Mega64. Attached to the Cerebot is an interface board I made to handle I/O functions, 5-volt power supply, and sound generation via the Somo-14D module. The LED and Tone board are mounted inside the lid of the chest and are described later on.

cerebot.jpg extender.jpg drivetray1.jpg lid1.jpg


Key Recognition

I considered several different key options including barcode, RFID, or plastic strips like I used on the original chest. Ultimately I decided to keep an authentic look and use antique keys with an optical reader to sense the different keys as they are inserted into the chest. The key sensor assembly consists of a small block of plastic with a slot cut in one end for the key insertion. A set of 3 holes are drilled through the side that contain an IR emitter/sensor pair. These holes are placed in such a way that different keys will allow some of the IR beams to pass, while blocking the other beams. To avoid having the beam bounce off the shiny key and get picked up by an adjacent sensor I alternated emitter/sensor placement on both sides of the assembly. Shown here is an example of different keys and how you can place the sensors holes to pick up different parts of the keys. In my case I was able to distinguish 4 keys using 3 sensors.

keylock4.jpg keylock2.jpg keylock3.jpg keylock1.jpg


Clue Dispenser

The chest has a clue rail hidden behind one of the decorative buttons in the lid. This rail is driven by a continuous-rotation servo and slides out 4 inches from the chest. The rail is a piece of 3/4" black plastic with a slot cut through the center that holds a piece of rolled up paper. An IR emitter/sensor pair is used to sense when to stop the rail. When completely extended the end of the rail travels past the sensor and allows the IR beam to hit the sensor. The micro on the main board sees this sensor change and turns off the servo. A hole drilled through the plastic rail allows the beam to pass through and hit the sensor when the rail is retracted completely into the chest. So once again when the micro sees the sensor change, it stops the servo just as the rail is completely inside the chest.

clueslide1.jpg clueslide2.jpg clueslide3.jpg clueslide4.jpg


Trunk Latch

My original treasure chest just made a clicking noise when it was unlocked. This time I wanted a good visual indication that the chest unlocked, so I used a big spring-loaded latch like the ones you'd see on a steamer trunk. My plan was to mount a pincher type device inside the latch that would squeeze the two prongs of the latch inward to release the latch. Turns out that this squeezing action pinched the latch too much and it couldn't pop open on it's own. My solution was to cut off one of the prongs and only push the single prong in to release the latch. A micro-servo is used to move the finger back and forth as shown in the pictures

lock4.jpg lock2.jpg lock1.jpg lock3.jpg


Tone Recognition / LED Board

One of the scenario's I developed was to have the boys play a song on an Ocarina (Legend of Zelda). The Tone board waits for a known tone (frequency) and sends the results back to the main board. The main board then sends a command to the LED board, lighting green for the correct note, or red for the wrong or unknown note. The LED's are arranged like notes on a musical scale to give the user an idea of what note to play. The 4th picture shows the bottom of the LED board (wire-wrap) and part of the Tone recognition board, both mounted in the lid of the treasure chest.

led3.jpg led2.jpg led1.jpg lid1.jpg


Video Tray

The heart of the chest is the ability to play videos to help out the treasure hunter. I decided to use an ipod touch to display the videos and an iHome Boombox for the audio and playback control. The Boombox has buttons on the front for play, pause, rewind, etc. A pair of relays on the interface board are wired to the play and rewind buttons to control video playback. The video used for the treasure hunt is one continous video that 8 second blank spots in between each video segment. The video is paused between each segment until ready to play again. The iPod touch sits on a molded tray that's attached to an old DVD drive. The DVD drive was stripped of everything but the eject mechanisim, which is used to move the iPod touch in and out of the chest. The original plan was to use the iPod touch in Portrait mode which allowed the iPod touch, interfeace cable, and tray to fit inside the 5.25 drive width. The chest was designed with the center ribs 5.25" apart to mount the drive to, with a front panel that fit between these ribs. As I neared the completion of the wood chest construction, I started testing video segments and decided the screen was just too small in Portrait mode. By switching to Landscape mode the screen is now fullsize, but the width of the iPod touch plus cable is over 8", exceeding the width of the center ribs. It would take a major rework of the chest to support a panel that wide.The solution was to drop the drive below the front edge of the chest and then eject the tray forward. This would require that the chest sit on short legs, but I think the final look was cleaner then cutting open the front of the chest for a wider tray. The final design uses a servo to drop the front of the drive below the bottom of the chest, then the drive's eject motor moves the tray out to bring the iPod touch into view

drivetray1.jpg drivetray2.jpg drivetray3.jpg drivetray4.jpg


Here's a short video showing some the features in action.

And check out the gallery here