loading
This is an Electric version of the Pie Face cool game.
It is built out of two servos stacked on each other, one serve as the X axis and the other the Z axis (one moving the spoon and the other lifting the spoon.

Now usually I plan both the electronics and physical casing together, in this case, however, I didn't have the casing materials so I startrd with the electronics and programming building the electronics modular so I could take it apart later to adjust the casing.
This is why I used connectors on the circuit board instead of connecting directly to the components (buttons, servos, buck converter, etc.) .

NOTE: This project ended up costing more then the original game, however it was fun building.

Step 1: Parts

Arduino Pro Mini
2 X SRM 102 Servo (or another alike)
3 X Big push button
3 X 220ohm Resistor
PCB Prototype Board
1 X Buck Converter, 220v AC to 5v DC
Some connectors, Zip Ties and Cables

Step 2: Connections

There are 3 push buttons, one function as the left player, one as the right player and a game reset button.
All the 3 are connected to 5v, I choose to to bypass the arduino for it and connect it straight to the buck converter VCC.
The other side of the push buttons is connected both to a pull down resistor and then ground and to the corresponding pin on the Arduino :
Left Player => Arduino D2
Right Player => Arduino D3
Reset => Arduino D4

There are 2 servos, Both are connected to GND and 5v (again bypassing the arduino and connected to the buck converter VCC.
The 3rd, position cord, of the servo needs to be connected to a PWM (Puls Width Modulation) :
X axis servo => Arduino D9
Z axis servo => Arduino D10

The Buck Converter is connected to LOAD and NEUTRAL at the 220v side (DON'T GET ELECTROCUTED !! - know what you are doing !!) the GND is connected to Arduino GND and to all other ground connections.
The VCC is connected to all the 5v connections and to the Arduino RAW pin.

Step 3: Robotic Spoon

I mounted the two servos on top of each other such the lower one control the rotation of the spoon and the higher one control the lifting of the spoon, I called the first X axis and the second Z axis. (important for the code)

Then I took an old spoon, bended the handle to fit the servos and mounted it to the higher servo (Z).

NOTE : All the servos mounting and securing was made using small size zip ties

Step 4: The Code


#include

#define lPlayer 2
#define rPlayer 3
#define reset 4
#define ledPin 13

#define XmidPoint 100
#define ZlowPoint 150
#define ZloosPoint 60
#define rLoosPoint 50
#define lLoosPoint 150

#define Xpuls 10

Servo servoX;
Servo servoZ;

int Xpos = XmidPoint; //, Zpos = ZlowPoint;
boolean lPress = false, rPress = false, gameOn = true, gameWon = false;

void setup() {
Serial.begin (9600);
servoX.attach(9);
servoZ.attach(10);
pinMode (lPlayer, INPUT);
pinMode (rPlayer, INPUT);
pinMode (reset, INPUT);
pinMode (ledPin, OUTPUT);
}

void loop() {
gameReset ();
while (gameOn) {
if (digitalRead (rPlayer)) {
rPress = true;
}
if (digitalRead (lPlayer)) {
lPress = true;
}
if (!digitalRead (rPlayer) && rPress) {
Xpos = Xpos + Xpuls;
rPress = false;
}
servoX.write (Xpos);
if (!digitalRead (lPlayer) && lPress) {
Xpos = Xpos - Xpuls;
lPress = false;
}
servoX.write (Xpos);
if (Xpos <= rLoosPoint || Xpos >= lLoosPoint || digitalRead (reset)) {
if (!digitalRead (reset)) {
gameWon = true;
}
gameOn = false;
}

Serial.print ("Xpos = ");
Serial.print (Xpos);
Serial.print (" lPress = ");
Serial.print (lPress);
Serial.print (" rPress = ");
Serial.println (rPress);
}

// ---------------------

if (gameWon) {
servoZ.write (ZloosPoint);
while (!digitalRead (reset)){
}
}

//gameReset();
}

void gameReset() {
Serial.println ("GAME RESET");
Xpos = XmidPoint;
//Zpos = ZlowPoint;
lPress = false, rPress = false;
servoX.write (Xpos);
servoZ.write (ZlowPoint);
gameOn = true;
gameWon = false;
}


Step 5: Casing

For the case I took two wooden boxes, one smaller then the other, stuck them together at the middle.
At first I tried wood-gluing them together and securing them with staple gun, This did not held them well enough and I added screws.

I then opened a hole through the button of the higher box and the lid of the lower one for the cable to pass and also sawed a square hole to mount the servos.

I then drilled holes for the push buttons and a hole in the back for the power cord to pass.

After every thing was in place and working I painted some simple art and then coated everything with varnish.

Step 6: CREAM

Then I connected the power cord to the outlet, set two exited kids down with their faces in place, applied cream, announced the beginning of the game and saw them getting their exited faces get creamed...

<p>Hello, looks good, do you have a video to show the speed and range of the whipped cream? No concern of the spoon flying away to make a dent in faces?</p>
<p>I wish, actually it is kinda slow, no risk of denting faces, however it dipense of the kind of servo you use.</p><p>I would try to upload later a video.</p>

About This Instructable

947views

8favorites

License:

More by udubinsky:ENC28J60 Using Ethernet With Arduino Electro Double Pie Face Showdown  Never Forget It on - Energy Saver 
Add instructable to: