Introduction: Useless Machine - Arduino

Hello

We made a useless machine with Arduino. This is how we did it so you can make one at home as well!

Step 1: Step 1: What Is the Useless Machine?

What is a useless machine?

A useless machine is a box with a button (switch) on it. When you press the switch, the machine starts, and a mechanical arm presses the switch off, which in turn shuts off the machine. So it's a machine that turns itself off. Sounds useless? It is. It's a lot of fun though if it works.

www.youtube.com/watch?v=Uox-t4OB6hE

The things you will need will be:

Materials for the box (the box should be 22 cm's long, 14 cm's tall and 14 cm's wide)
4 Batteries 1.5V (the power source) and a box for these batteries
Arduino board + breadboard with cables
2 Servo motors
A switch
Superglue
Wood glue
Mechanical arm to attach to the servo which presses the switch
Hinges

Step 2: Step 2 : Building the Box

You can skip this step if you have bought a box, but the box should be 22 cm's long, 14 cm's tall and 14 cm's wide. This makes sure that there is enough place for the Servo's, Arduino board, battery, cables and arm inside the box. The top plank of the box (where the switch should be) should be divided in two equally big pieces (make sure to leave enough space for the arm!). The two equally big pieces at the top will be the two doors, which you should connect with a hinge so that the doors can move freely. We made the box in the workshop with wood and wood glue, however screws should work just fine as well.

Step 3: Code and Setup

Now it is time for the Arduino part.

In the image you can see how to setup the arduino board with the cables.

The arduino board should look something like this, and the code we used, that makes sure that the arm moves to the button and closes itself, looks like this:

#include

Servo myservo;

int pos = 0;

void setup() {

pinMode (12, INPUT_PULLUP) ;

pinMode (10, OUTPUT);

myservo.attach(10);

}

void loop() {

int buttonValue = digitalRead(12);

if (buttonValue == LOW) {

for (pos = 0; pos <= 180; pos += 1) {

myservo.write(pos) ;

delay (5);

}

for (pos = 180; pos >= 0; pos -= 1) {

myservo.write(pos) ;

delay (5);

}

} else {

}

}

Step 4: Putting It All Together

After this it is time to put everything together.

Attach the button to the top of the box and put all the components and cables together with the Arduino board in the box. You can do this with glue or with soldering. If you have attached everything like the Fritzing shows and have all the components in the box, the useless machine should work and you are done. Have fun!