Introduction: Open a Box With the Flick of a Switch!

Have you ever given something to someone and wished that the box you gave it in opened automatically? No? Well neither have I (well, maybe) :D. However if you have, this is the guide for you! With just a flick of a switch the box will open automatically!

Step 1: Tools & Materials

Materials:
- A Box
- A Continuos rotation Servo (Mine's from parallax)
- Spare cardboard
- Two Limit switches (From RadioShack)
- A Metal Coat Hanger (From Laundry Places)
- Perfboard (From RadioShack)
- Wires (From RadioShack)
- Resistors (All 10K)
- Headers (From HSC Electronics)
- An Arduino (From Italy :D)
- A power switch (From an old Power Supply)
- L brackets (Cardboard works to)
- Some thread

Tools:
- A Hot glue gun
- A soldering iron
- Solder
- Heavy duty wire cutters
- Pliers

As you can tell, you can pretty much recycle everything, or find in around the house.

Step 2: The Circuit

The Circuit is fairly simple. Its a 3 switches connected to 3 digital pins with 10K resistors shorting to ground. There is also a servo motor that connects to 5v, ground, and a fourth digital pin. Connect however you like, just make sure you know which digital pin goes where. I would recommend breadboarding it out first and then doing it on perfboard. Thats what I always do. Now let's program it!

Attachments

Step 3: Program It!

I like to test the code first, before putting it in the case (the box). This way, you can perfect the code and get it right, and not destroy things later. To program it, It's like any other arduino code. Just open up the arduino project, connect your arduino, and press upload! Once you do that, your continuous rotation servo should start to spin. It will spin until it finds a button to press and then stop. When you flip the power switch to the next state, it will spin in the other direction until it finds another button to press. Believe it or not this was actually pretty hard code to write. If your just starting with arduino, you might be able to learn something from it!

Step 4: Assembly - the Arm

Great! So now we have the circuit up and running and everything working. Now lets attach the coat hanger to the servo.

Take your metal coat hanger and cut off a 5" piece. Then, straiten out the piece with some pliers. Then measure 1" on the coat hanger segment. Bend at that point until you get a 90 degree angle. It should look like the picture below.

By the way, the main reason for choosing hot glue is because it comes off without damaging other parts. That being said, you can attach the parts any way you like. 3D printer is preferred. Once I finish my reprap, I'll upload the new files. In the mean time, anyone is welcome to post the in the comments!

Ok, The next step it to attach the arm to the servo. You can do this with hot glue very easily. Once you do this, your servo-arm thing is done! Next we'll attach the servo to the box.

Step 5: Assembly - the Servo

Now we'll glue 2" x 1" piece of cardboard to the side of the box. Make sure it is as secure as possible.

Once this is done, hot glue the servo to the cardboard piece. Make sure it is strait.

Step 6: Assembly - the Switches

First, we'll secure the power switch. To make the hole for this, make a small hole with a screw driver or a pencil and keep making it slightly larger until the switch fits snugly.

Secure the limit switches. How I did this was by marking where I wanted with a pencil. This mark will be were the bottom of the limit switch will be. Next, take your L-Bracket and hot-glue it to the box with the vertex of the L where you put the pencil mark. Then, glue down your limit switch perpendicular to the L bracket. To test it, take your servo-arm and make sure it pushes down the limit switch.

Do the same thing with the other side except mount it at a 45 degree angle. You can then test it the same way.

Step 7: Adding Thread

So if you were to put it all together, you would find that it would only open. This is probably obvious, but it need something to hold the arm to the box. So you might think, why not just add a piece of tape or hot-glue? Well as you can see from the picture below, hot-glue ripped the box. What I did to solve this problem was attach some thread.

Attaching thread is pretty strait forward. Basically, take a 3" piece of thread and measure from the end in 1". Next, fold the vertex of the one-inch point and glue it to itself. This will make loop in the thread.

Put the loop of the thread around the servo-arm and hold the thread to the top of the box. Push the arm down with your other hand and make sure the place you are holding the thread slides nicely on the bar. Once you have it in the right place, hot glue it down. The thread should slide freely on the arm. We're almost done!

Step 8: Finish!

Once you have done all of this, simply pop all the electronics in there and plug in the arduino! Here's a video of mine:



If you have any questions please feel free to comment. If you have any suggestions for me, help is always appreciated. Also, If you liked this instructable, please vote for me in the microcontroller contest, make it move contest, or the USB contest! That would be awesome!
Microcontroller Contest

Participated in the
Microcontroller Contest

Make It Move Challenge

Participated in the
Make It Move Challenge

USB Contest

Participated in the
USB Contest