I wanted to get into Arduino projects and introduce my sons to robotics using Arduino. So I thought about building a simple project that made use of an Arduino Uno and a servo. I saw a great post in Instructables about The Most Useless Machine Ever and was inspired to create an Arduino-powered version.

It was a most satisfying build experience with my sons and I learned a lot about programing the Arduino.

How does it work?

The Arduino "listens" to the state of the switch and actuates the servo when the switch is activated.

In the OFF state, the Arduino sends the servo to the reset position (box lid closed). When a user flips the switch to ON, the Arduino sends a signal to the servo and actuates a finger to push the switch to the OFF state.

Step 1: Parts List

Parts list.

You will need:

- wooden jewelry box (you can get these at your local craft store for less than $5)
- Arduino UNO
- Laptop (I use a Macbook Pro)
- 10k ohm resistor
- small SPDT switch
- servo motor
- wires
- 9v battery
- popsicle sticks
- wood glue
- some 0.5" x 0.5 " wooden rod
- old coax cable
- 2 pcs of small hinges (approximately the same size of the hinges that comes with the box)


- Dremel tool
- saw
- screw driver
- pliers
- wire stripper
- soldering iron, lead solder
- voltmeter
- breadboard
- electrical tape


Check out the schema for the component wiring. I used Fritzing app for Mac to lay out my components.

I recommend wiring up your circuit using a bread board first. Check your servo calibration and play around with the code to achieve the desired rotation or position of your servo arms. This may vary so you need to tweak the code to achieve the right motion.
My wife sent me a video from a site called Gag donkey that had these. Your work is great. Thank you for posting the step by step. I am doing an Alice In Wonderland theme Halloween, this would be great to put on the front porch and see how many of the little ghosties and goblins push the switch.
Perfect toy for kids!
LOL! She's like "I WANNA DO IT!" Little kids are great.
<p>Hello,<br><br>I know very little about servos... will something like this work? <a href="http://www.ebay.ca/itm/Micro-Servo-Motor-RC-toy-Robot-Helicopter-Airplane-controls-SG90-Servo-9G-Motor-/301666348401?hash=item463cb72d71:g:mHMAAOSwT6pVg-cO" rel="nofollow">http://www.ebay.ca/itm/Micro-Servo-Motor-RC-toy-Ro...</a><br><br>Thanks!<br></p>
<p>hey,</p><p>i also modified your code so now it also has a door servo and you can add moves, just like opening the door then close it, then open it again, switch it off and go back in the box. ;)</p><p>// Sweep</p><p>// by BARRAGAN &lt;http://barraganstudio.com&gt;</p><p>// This example code is in the public domain.</p><p>#include &lt;Servo.h&gt;</p><p>const int buttonPin = 2;</p><p>int buttonState = 0;</p><p>Servo handservo; // create servo object to control a servo</p><p>Servo doorservo; // a maximum of eight servo objects can be created</p><p>int pos; // variable to store the servo position</p><p>long timeDelay;</p><p>void setup()</p><p>{</p><p> pinMode(buttonPin, INPUT);</p><p> handservo.attach(9); // attaches the servo on pin 9 to the servo object</p><p> doorservo.attach(6);</p><p>}</p><p>void loop()</p><p>{</p><p> buttonState = digitalRead(buttonPin); // Read the button position</p><p> if (buttonState == HIGH) {</p><p> if(doorservo.read()==11){</p><p> doorservo.write(50);</p><p> delay(500);</p><p> handservo.write(11);</p><p> }</p><p> if(doorservo.read()==50){</p><p> doorservo.write(11);</p><p> delay(500);</p><p> handservo.write(11);</p><p> }</p><p> if(doorservo.read()==11){</p><p> doorservo.write(60);</p><p> delay(500);</p><p> handservo.write(11);</p><p> }</p><p> if(doorservo.read()==60){</p><p> handservo.write(100);</p><p> delay(1);</p><p> doorservo.write(61);</p><p> delay(1);</p><p> }</p><p> }</p><p> if (buttonState == LOW) {</p><p> handservo.write(11);</p><p> doorservo.write(11);</p><p> }</p><p> }</p>
How did you wire up the servos? I'm new to Arduino and love the other tutorial on here where the door and finger act sparatic but I don't have the other components to hook up a debouncing circuit.
And then connect the doorservo to digital pin 6 and the hanservo to digital pin 9.<br>http://library.isr.ist.utl.pt/docs/roswiki/attachments/rosserial_arduino(2f)Tutorials(2f)Servo(20)Controller/arduino_servo.png<br>
Oh ok. The answer was staring me in the face lol. Thanks!
<p>Thank you so much for posting this! I have been looking for an Arduino controlled useless robot!! I definitely want to build this soon.</p>
<p>Thanks ;) </p><p>I built other machine , based on your tutorial.</p><p>https://youtu.be/-bSdqhItKJE</p>
Did you have to modify the servo at all for continuous rotation?

About This Instructable


146 favorites


More by rsucgang: Big Hero 6 Hiro Hamada and Gogo Tomago Costume Refreshingly simple pear and kale smoothie Avocado Ice Cream
Add instructable to: