Introduction: Useless Game

About: I am an American teaching English at Shangluo University, Shaanxi. I like making machines that do interesting but fairly useless things - I call them Quixotic Machines.

This is my take on the Useless Machine/Box (or Ultimate Machine - originally invented by Claude Shannon) that switches itself off if you turn it on. In this case you can play a game against the machine that will always result in a draw or win or lose - I'm not sure which one.

The components are a box, servo, Arduino Uno and a magnetic or reed switch that detects the presence of a magnet.

I know, the Arduino is such overkill but they are so cheap here ($2.00) - probably a good project for a Nano.

Ok, guess I have to explain the two dollar Uno. This particular board cost me $6 (35rmb) on taobao.com but I said $2 because I have five clone boards (dccduino) that I also got on taobao for 15rmb (actually $2.50) each but didn't even notice I used the $6 board. So the devil is in the details. Sorry I stretched the truth, told a fib, lied a bit. (http://item.taobao.com/item.htm?spm=a230r.1.14.42....

I will try to be more careful and detail oriented in the future and less prone to exaggeration.

On a different note: a real useless machine actually turns off it's power (as I understand it, I haven't built one) and this one does not do that.That would be cool because this one you have to unplug the power or battery or install an on/off switch. Would be cool if this one turned off the power too with some kind of magnetic switch or something but

then the Arduino would have to init each time - not sure how to approach that.

Step 1: Set Up Servo Arm With Magnet

I just hotglued a piece of chopstick to a servo arm with a zip tie. Then hotglued magnet to the other end.

Step 2: Mount Servo in Box

Here I glued servo to the inside of a plastic box container so the magnet is just below the "game board" drawn on the outside of the box.

Step 3: Mount Magnetic Switch and Connect Arduino and Servo

Then hotglue the magnetic switch (I used old bicycle speedometer reed switch) centering one end below one of the playing squares.

Plug one end of magnetic switch to digital port 2 and also to a 1 k resistor then to ground.

Plug other end of magnetic switch to 5 vcc.

Plug servo signal to digital port 9.

Plug servo positive to 5vcc.

Plug servo ground to gnd.

Step 4: Arduino Uno Program

#include

Servo servo1;

const int buttonPin = 2; // the number of the pushbutton pin

const int ledPin = 13; // the number of the LED pin

int buttonState = 0; // variable for reading the magneticswitch

void setup() {

Serial.begin(9600);

// initialize the LED pin as an output:

pinMode(ledPin, OUTPUT);

// initialize the pushbutton pin as an input:

pinMode(buttonPin, INPUT);

servo1.attach(9);

servo1.write(55); }

void loop(){

// read the state of the pushbutton value:

buttonState = digitalRead(buttonPin);

Serial.print(" button= ");

Serial.println(buttonState);

// check if the pushbutton is pressed.

// if it is, the buttonState is HIGH:

if (buttonState == HIGH) {

// turn LED on:

digitalWrite(ledPin, HIGH);

delay(3000);

servo1.write(85);

delay(100);

servo1.write(47);

delay(2000); }

else { // turn LED off:

digitalWrite(ledPin, LOW); }

}