Electro Double Pie Face Showdown

by udubinsky in Living > Toys & Games

2452 Views, 13 Favorites, 0 Comments

Electro Double Pie Face Showdown

temp_471287904.jpg
temp_1394880016.jpg
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.

Parts

arduino pro mini.jpg
blup.jpg
Pulsanti-v4-p-1.jpg
220ohm resistor.jpg
DIY-Prototype-Paper-PCB-Universal-Experiment-Matrix-Circuit-Board-5x7cm-Empty-Plate-Experiment-Breadboard-Pegboard.jpg
s-l1600.jpg
images.jpg
images (1).jpg
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

Connections

pieface_bb.jpg
IMG_20170107_142407.jpg
IMG_20170107_142420.jpg
temp_2039121107.jpg
temp_901584742.jpg

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.

Robotic Spoon

temp_1521607918.jpg
temp_1848973702.jpg
temp_1865517717.jpg

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

The Code

logo_arduino.jpg

#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;
}


Casing

temp_615498004.jpg
temp_1650754715.jpg
temp_1207631152.jpg
temp_1642185342.jpg
temp_481664619.jpg
temp_148517625.jpg
temp_565998468.jpg

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.

CREAM

sprayrange.jpg

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...