Introduction: Tantalizing Chest

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).

Hello readers! This guide will tell you how to make a nifty little novelty item - a chest that shuts as soon as you get too close, only to open once you're out of reach.

Step 1: Materials

The materials you need to complete the chest are split into three sections for readability: the chest itself, electronic materials, and decorative materials. Note that there are 3D-printed parts in the design, so you either need access to a printer or creativity.

Chest Materials:

  • Wood for the chest (1/4 inch thick, 6 inches wide) - you will need at least 45 inches of length.
  • Woodcutting tool (hand saw or power tool)
  • Gorilla Glue (or any other wood glue)
  • A sheet of brass
  • Small internal hinges
  • 10 3/8 inch screws
  • Screw gun and 5/8 or 11/16 inch drill bit (to drill holes for the sensors)
  • 3D-printed connecting rod (files and description below)
  • 1/2 inch wire nail (just one)
  • DC-47P DC Series Heavy Duty Electronics Enclosure (you don't need the lid)
  • Small metal brackets (brass, angular)
  • Pliers

Electronic Materials:

  • Arduino Board (I used an Uno)
  • 3 HC-SR04 Ultrasonic Module Distance Sensors
  • SMAKN MG995 Metal Gear Servo
  • Breadboard (any size that is less than 8 inches in length)
  • 12 female-to-male wires and a few male-to-male wires (or female-to-female wires with extra male-to-male wires)
  • Means to power Arduino (9V battery and connector or USB power source)

Decorative Materials

  • 3D-printed decorative pieces (files and description below)
  • Cloth to cover chest interior
  • Acrylic paints (I used AppleBarrel Black [Satin Acrylic] and MSP Polished Silver), brushes, palettes, etc.
  • Loctite Super Glue

Also, I'd recommend using some fine grit sandpaper for the wood.

Step 2: Building the Chest

This section is written assuming that you know as little about woodworking as I did when I started - so more experienced people, feel free to skim.

The box should end up with two sections - the top, where the enclosure should sit flush with the walls, and a bottom section that can be revealed by lifting the enclosure, where the electronic parts will stay.

Cutting the Wood

The chest itself is a simple rectangular prism, with a slightly longer bottom face, so the actual woodwork is simple.

The front and back faces have dimensions 8 1/4 x 6 inches.

The side walls have dimensions 4 3/4 x 6 inches.

The lid is 8 1/4 x 4 3/4, and the base just needs to a bit longer on all sides (for instance, 8 3/4 x 5 1/4 inches).

You will also need to cut two 7 3/4 x 1/4 inch pieces - these will be placed a bit less than down the front and back faces to hold the enclosure (and separate the sections).

Optionally, you can cut a thin piece that's 8 1/4 x 3/4 inches to sit on the back of the lid (and keep the screws from sticking out)

You can sand the wood here, if you intend to.

At some point, you will need to use the 5/8 or 11/16 inch drill bit to make two holes (for the proximity sensors) on the front wall and both of the side walls. The center of the holes should be roughly an inch from the bottom of each face, and an inch apart. If you intend on using the USB cable for power, also drill a hole in the back, toward a bottom corner.

Putting it together

The goal is for the smaller side walls to fit between the front and back walls. This is why the thinner pieces (the ones holding up the enclosure) are half an inch shorter. Before you glue all the walls together, you may want to glue the thinner pieces (the ones that'll hold the enclosure) to the front and back walls.

The thinner pieces should be 2 1/4 inches below where the top of the box will be. Make sure that the enclosure sits flush with the spot you're marking. The picture for this step shows what you should end up with. Make sure that there is 1/4 inch on each side of the thin pieces, so that the side walls can sit flush together.

Now, just glue the walls together - the order doesn't matter, so long as the front wall and back wall are on opposite sides. Don't forget to get those thin holding pieces in place before all of the walls are stuck together, otherwise it will be difficult to squeeze them in.

Once all the walls are together, you can glue the base on, so that there is a little overhang on all sides.

If you made the extra piece earlier, glue it on the top of the lid, at the back.

The Lid

The lid will be connected using the hinges (I used two small brass internal hinges), which is just a matter of screwing them in. I connected the so that the hinges are screwed on through the back wall and the bottom of the lid, since the smallest screws I could find were longer than the wood was thick.

Just use the screw gun to screw in both sides of the hinges. I only needed 8 screws for the hinges. Since the screws were longer than the wood, made sure the back of the box doesn't have the ends sticking out of the back of the box. Likewise, if you didn't add the extra piece of wood, make sure the ends aren't sticking out of the lid.

Brass Piece

Now you'll need to connect the lid to the servo. For this project, its a simple connecting rod with holes on both ends, so you need to create a place for that rod to connect on the lid.

Cut a small piece of brass (1 x 2 inches is plenty). Bend the piece to a 90 degree angle along the 1-inch side, and drill a small hole on either of the faces. Then just screw the piece 2 inches from the right side, the bent half facing out. It should be at least 1/2 inch from the other side (so that the box can close).

Enclosure

This is the last stage you need the drill for. You need to make a holder for the Servo.

I used a pair brass brackets and steel wire to do the job (though I'm sure there are holders you can buy for this). If you're doing it my way, you may just want to look at the picture. Just bend the brackets to have a 90 degree bend on both sides and leave some length to work with. Drill two holes on each bracket - one on one of the bent ends, and one in the middle.

The goal here is to have the steel wire go around the servo both above and below it, so that it is held tightly in place. Place the servo between both of the brackets, and pull out a bit of steel wire. Guide it through the matching holes on each bracket (one wire goes through the holes on the bent sides, the other wire goes through the middle holes). Tighten it up, then do the same for the other set of holes. One you're done, you should have the servo secured between the brackets, with the other bent ends both laying flat below it. Then all you need to do is use the self-tapping 1/2 inch screws to secure the other bent end of the brackets to the inside of the enclosure. The servo should be facing the right wall, 2 inches from the end. When you try to close the chest, the brass connecting piece should be less than 1/2 inch away, but not touching.

Finally, you need a hole in the enclosure for the servo's wires to pass through to the bottom. I used the 5/8 drill bit near the brackets, which made ample room for the wires.

Step 3: 3D Printed Parts

There is only one essential printed part - the connecting rod.

When you go to print, change the dimensions of the connecting rod in the slicer to 50.8 x 4.8 x 6.35 mm, which is 2 x 3/16 x 1/4 inches if you intend to fashion one without the printer (only the length matters, the other dimensions are for durability). I used 20% infill.

For the decorative pieces, you will want four of the "triple diamond" pieces (which I scaled to 15x, and then reduced the height to 4.064 mm) and one "full star" (scaled the same way). Since these are decorative, any infill that works can be used. Of course, you are free to print any number of decorations, so I included a "double diamond" and just a single one, if you want to use them.

Step 4: Electronic Configuration

There are only five 6 major components to the electronics system: the Arduino board, the bread board, the three proximity sensors, and the servo. Connect the female ends of the female-to-male wires to each sensor - since there are four pins per sensor, you'll need 12 such wires.

The connections are that quite simple - connect the Arduino's power and ground pins to the breadboard, then connect all of the other component's power and ground wires to the breadboard.

All that's left is to connect the other wires to the correct pin on the board. Connect the Servo's signal wire to digital pin 9. Connect the left sensor's echo and trigger pins to pins 8 and 7, respectively. Connect the front sensor's echo and trigger pins to pins 6 and 5, respectively. Connect the right sensor's echo and trigger pins to pins 4 and 3, respectively.

As for placing the physical components, simply put the sensors into the holes you drilled earlier. For my chest, two of the sensors fit well enough to not need any tape, but if you aren't so luck, just make sure the sensors won't fall out of place (putting tape on the wires leading out of the sensor seems safest).

The Arduino board should be placed so the USB cord can exit the chest easily through the hole on the back (if you didn't want the battery power). The breadboard should be stuck onto the wood wherever it fits, and that should keep the Arduino in place if you use smaller wires. If you want something more secure, I'm certain that there are printable Arduino board holders you could use.

Step 5: Code

Next is the code. It's relatively simple - if anything comes within 50 centimeters of the front sensor or 25 cm from the sides, the microcontroller will pull the servo to 0. Once a cycle has passed where nothing is within those ranges, the microcontroller will signal the servo to 180 degrees again.

If all three sensors are approached at once at a fast enough speed, the chest remain open for as long as you need. To return it to its normal state, simply move away from each sensor quickly.

You will need the NewPing library for the sensors, which I've included.

For a more comprehensive explanation of the code, there are 4 methods:

setup() - standard function, simply set the Serial output (for debugging) and sets up the servo.

updateServo - which does exactly as it says on the tin. If the isApproaching flag is set to true (and isLeaving is false), then the servo goes to 0 degrees, if isLeaving is true (and is Approaching is false), then the servo goes to 180 degrees.

isHardOpen - method determines whether the chest is to be kept open regardless of the sensor inputs. If all of the sensors notice an approach of a certain speed (that is, current readings - last readings), then the state changed to hardOpen. If the system is in that state, it can be undone if the sensors all read in objects moving away at a certain speed, changing the state back to normal if so.

main() - standard function, reads in distance from each sensor and stores it, determines if anything is too close and sets appropriate flags (so long as isHardOpen is false), determines if the hardOpen state has been activated/deactivated, and updates the servo.

Step 6: Finishing Touches

Adding the Connecting Rod

The connecting rod needs to be connected to both the servo horn and the brass connecting piece on the lid of the chest. To connect the brass piece to the rod, I used steel wire that was turned into a loop at both ends, keeping the rod firmly in place. To connect the servo horn to the connecting rod, I inelegantly used a 1/2 inch wire nail, which conveniently fit, and even more convenient is that it is easily removable, useful for when the electronics need looking at or if you need more room to access the stored items.

At this point, the chest should function completely as intended.

Decorations

To make the chest look more interesting, I added some paint. Black acrylic worked very well - just add a few drops of water to a decent amount of paint to make it spread more evenly over the lid and bottom. You're free to take the lid off the hinges for the painting, but I didn't find it necessary.

The decorative pieces were also painted in a silver color, to contrast with the black. I didn't find that a primer was needed, although it probably would have helped.

If you are trying to replicate my design, one "full star" should go on the lid, and one "triple diamond" for each other face, about 1 1/2 inch from the top. I used super glue to connect them.

On the inside, the enclosure was a little plain, so I cut out a small piece of 1/8 inch wood to fit on the inside, to separate the servo from the content side. After superglue-ing that in, I cut two pieces of fabric to cover the content side of the enclosure. I used Gorilla Glue to keep the fabric in place, but I think they may have discolored the fabric a bit.

And with that the chest is complete! Thanks for sticking around until the end.