Two Player Robo Putting

by Daði14 in Living > Toys & Games

300 Views, 1 Favorites, 0 Comments

Two Player Robo Putting

putt braut.jpg

Matirials needed

Course: Grass like carpet 200cm x 30x Arduino x 2 Alot of wiers Fan Servo motor DC motor DC motor with shake head Bike tube Wood plexi glassPutter:

Bettery case Putter - preferably with a big head DC motor with shake head on/off swich Light golf ball Remote: Plexi glass Potentiometer x2 on/off swich x2

The Putter

pútter.jpg

Glue the battery case on the head of the putter.

Solder the DC shake moter to the case and glue on the top of the putters head

Solder long wiers from the battery case to an on/off swich and wrap the wiers around the shawt to glue the swich on the top of the putter

The Course

holur fyrir vatn.jpg
vifta.jpg
golf braut a hlid.jpg
shaker.jpg

Take the carpet and cut 3 holes in the end of it, one for the main hole for the

ball and bean shaped holes on both sides of it for the water. A file with bean shaped bowls that fit the holes with a 3d printer is attached.

Build a frame around the carpet with two 200cm x 10cm pices of wood on the the starting end of the frame attach a wooden board (20cm x 20cm) with cut up bicycle tubes. Add a DC shake motor under the board for a vibrating effect.

Put the fan at the opposite end of the shake board, faceing up and towards the other side. Add a floor under the frame and put it at an angle up to the fan. Then add the carpet on to the floor of the frame and make sure that the hole on the carpet lines up with the fan. Then build a frame around t the fan and the slope of the course that is high enough so a golf ball wont fall out.

Add a obbstacle to the course with drilling a hole into the slope and insert a DC motor and put a 6cm x 4cm plexi glass on it so it spins. Add another obbstacle to the course by adding a servo motor with an 20cm x 4cm plexi arm. Both of these obstecles along with the fan and the shake board will be connected to an arduino that will be conrolled by a remote.

Downloads

The Remote

fjarstyring.jpg

Find On/off swiches and adjust remote file to fit them. Then laser cut 3mm

thick plexi glass with the remote file. Glue the switches and the potentiometers to the plexi class and then solder long wiers from the switches and the potentiometers to the arduino. For a better look and feel 3d print knobs for the potentiometers.

Downloads

Arduino Codes

/*

Interactive Landscape Game! Two player crazy golf, one person plays the landscape Code by Sam R with edits by Daði X September 11th 2019 *

/ Load up the servo library #include

#include #include

// Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS = Adafruit_MotorShield(); // Or, create it with a different I2C address (say for stacking) // Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Select which 'port' M1, M2, M3 or M4. In this case, M1 Adafruit_DCMotor *myMotor = AFMS.getMotor(2); // You can also make another motor on port M2 Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(3);

// Name the pins const int analogOutPin = 9;

// Name the variables and initiate them at 0 int potentiometerValueZero = 0; int potentiometerValueOne = 0;

int servoPosition = 0; int motorPower = 0;

int buttonValue; int buttonValueTwo;

// Name the servo Servo myservo;

void setup() {

Serial.begin(9600);

AFMS.begin(); // create with the default frequency 1.6KHz //AFMS.begin(1000); // OR with a different frequency, say 1KHz // Set the speed to start, from 0 (off) to 255 (max speed) myMotor->setSpeed(150); myMotor->run(FORWARD); // turn on motor myMotor->run(RELEASE);

/* Set the speed to start, from 0 (off) to 255 (max speed) myOtherMotor->setSpeed(150); myOtherMotor->run(FORWARD); // turn on motor myOtherMotor->run(RELEASE); */ myservo.attach(10); // attaches the servo on pin 9 to the servo object

pinMode(2, INPUT); pinMode(3, INPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); }

void loop() {

// ************************************* // read the inputs from the sensors // ************************************* potentiometerValueZero = analogRead(0); potentiometerValueOne = analogRead(1);

buttonValue = digitalRead(2); buttonValueTwo = digitalRead(3);

// ************************************* // print the readings from the sensors ( magnifying glass to view) // ************************************* Serial.print("potentiometerValueZero = "); Serial.println(potentiometerValueZero); Serial.print("potentiometerValueOne = "); Serial.println(potentiometerValueOne); Serial.print("buttonValue = "); Serial.println(buttonValue); Serial.print("buttonValueTwo = "); Serial.println(buttonValueTwo);

// ************************************* // If Button One pressed, activate Fan // *************************************

if (buttonValue == 0) { digitalWrite(11, LOW); }

else if (buttonValue == 1) { digitalWrite(11, HIGH); }

// ************************************* // If Button Two pressed, activate vibrating motor // ************************************* if (buttonValueTwo == 0) { digitalWrite(12, LOW); }

else if (buttonValueTwo == 1) { digitalWrite(12, HIGH); }

// ************************************* // When potentiometer Zero turned, control motor // *************************************

// Potentiometer values come in between 0 and 1023, but need to limit to 0-255 power motorPower = map(potentiometerValueZero, 0, 1023, 0, 180); constrain(motorPower, 0, 255); if (motorPower > 0) { myOtherMotor->run(FORWARD); myOtherMotor->setSpeed(motorPower); delay(10); }

else { myOtherMotor->run(RELEASE); delay(10); }

// ************************************* // When potentiometer One turned, control servo // *************************************

// Potentiometer values come in between 0 and 1023, but need to limit to 0-180 degrees servoPosition = map(potentiometerValueOne, 0, 1023, 0, 180); constrain(servoPosition, 0, 180);

Serial.print("servoPosition = "); Serial.println(servoPosition); myservo.write(servoPosition); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position

}