What's in the box???
Is it doing something???
Is it going to hurt me???
Just hit the switch guys!!! Nothing will hurt you, maybe...
Really now, this project is about a box with an Arduino in it. It does nothing. Literally. It is in a bad mood and all it wants is to be left alone. Can you make it happy? Try your luck with the switch!!
Step 1: How It Works
The switch is connected to the Arduino and is monitored by it. When you push the switch the state of it changes and is set to ON position. Then the Arduino activates the two servos, one for the lid and one for the finger, the finger comes out and hits the switch so it goes back in OFF position. After that, the finger goes back in the box and the lid closes.
Step 2: List of Components and Tools
- Arduino board (i used Arduino Nano 3 5V, you can use whichever you like)
- 2 x Micro generic Servo
- 2 x 100μF electrolytic capacitors
- 1 x 10kΩ resistor
- 1 x small SPDT switch
- 1 x simple ON/OFF switch
- Hook up wires
- 9V battery
- Balsa wood (or any other material you like for the box)
- Wood glue and nails
- Small hinge
- Spray paint in any color you like (optional)
- Wire cutter
- Duct or electrical tape
- Soldering iron
- Dremel tool or slitter
- Sand paper
Step 3: Building the Box
In order to build the box i used 6mm balsa wood. The dimensions are 23 x 11 x 11 (w, d, h). The top lids are made from 4mm balsa wood. You can cut the wood with a dremel or a simple cutter/slitter, it is a soft and light wood. I glued all the pieces together and also nailed the frame parts.
The hinge was screwed in the lid and in the inner side of the box so it will be hidden. It was tricky to screw it in place and you must be careful to not damage the box.
Next you must make a hole for the switch in the top lid (the one that will not move). Then screw the switch in place. Also, in this lid you will place the case for the finger servo. In order to make the case, glue together wood parts. Make sure to make the case sturdy and durable. My micro servo is really strong, it broke the first case i made! I reinforced it and i put nails along with the glue in order to handle the servo power.
Now it is time to make the finger. Many ideas here about the design, the right angle, the dimensions, the curves. I tried several designs but the only one that works just fine is the classic one with the L shape. It was the only that did not break when it came in contact with the switch. You must make it buffy and fat, otherwise it will bend on the side when it hits the switch. Don't worry for the weight, balsa is super light. I glued together five 3mm pieces L shaped. It may not be pretty but it does the job right. I also glued the servo connector on the finger. Be creative and make your own as you like!
The next thing you have to do is to make the stick that will be connected to the door servo and will be pushing the lid up so the finger can come out. Just glue two pieces of balsa in the right dimensions and put it on the servo. Piece of cake. The only thing you have to consider is the right height that the srvo must be in order to open the lid. You can place the servo in the right height by putting balsa pieces underneath, making a base for it. Don't spend too much time here, just glue some remaining pieces together.
The final step is to put an external ON/OFF switch to power the arduino and save your battery. Open a hole carefully in the side of the box and glue the switch. Solder the cables and the switch is ready.
The box is ready! If you want to paint it, do it now, before putting the electronics inside.
During the building process, especially while building the finger, i thought that a 3d printer would made the whole process so much easier. Dealing with balsa wood is fun, but 3d printing the parts you want exactly how you want them is just more efficient and the parts will be more beautiful. The downside is the cost.. Your choice..
Step 4: Wiring
Wiring the circuit is very easy as you can see. The finger servo goes to pin 10 and the door servo goes to pin 9. One pin of the SPDT switch goes to ground, the other to 5V and the third goes to Arduino pin 2 through a 10kΩ resistor. Don't forget to connect the capacitors and be careful with the polarity!
Step 5: Final Assembly
Now you can put everything inside the box and connect the battery to the Arduino. The anode goes to Vin pin and the ground to the GND pin. Pay attention so you don't damage the box while you put the electronics inside. I made my box narrow and had a hard time putting them all together.
Step 6: Arduino Code
The code for the useless box is very simple. First of all you must include the servo library, then create two servo objects (one for the door and one for the finger) and attach them to Arduino's pins in the void setup function. The void loop is just an if statement that checks if the switch is ON. If it is ON, the servos must move and close it. I made some different moves for the servos in order to be funny. Feel free to add your moves too!! It is very simple, just look at the code and follow the pattern!!
Here is the link to the code on GitHub, so you can copy/paste and use it easily.
Step 7: Problems and Thoughts
During the process of making the box, I came across some problems and I would like to share them with you.
The most annoying problem was about the batteries and powering the circuit. For some reason, the circuit would not work on a 9V alkaline battery no matter what. The servos were not doing what they were supposed to do and sometimes they were not moving at all. So, I started the troubleshooting process by powering the servos and the Arduino separately. I tried 9V to the servos and 6V (4 AA batteries) to the Arduino. Nothing changed. Tried with Arduino UNO, nothing again. After several tries, I found out that the problem is solved if I use a 9V battery in combination with the USB cable plugged in the Arduino. Crazy, huh? However, it works like a charm like this. The thing is that I don't want to have the box with a USB cable hanging out and to have to plug it in the PC every time I want to play with it. After several discussions with some people who have more experience than me in electronics and Arduino, we concluded that I should use LiPo batteries because of the fast discharge and high current capability they have. Finally, during the Arduino Day 15 event in my town, I was able to try a 6600 mAh power bank (used to charge smartphones) and it worked perfectly!! So, if you have the same problem, give it a try!
The second thing I want to say is about the material of the box. Balsa is a very good material, light, durable if thick, but it can be a pain when you want to make really detailed work with it. You can even destroy your whole project. The box would be perfect if it was 3d printed. The finger that closes the switch at least. Think about it.
That's all!! Hope you enjoy this Instructables!! Post your creations in the comments below!!