Open a box with the flick of a switch! using Arduino


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

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]

– 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

– 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.[/box]

Step 2: The Circuit

The Circuit (1)

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!

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.

Read more: Open a box with the flick of a switch!

Leave a Comment

Your email address will not be published. Required fields are marked *