Categories
001. Caleb's Favorite Posts 203. ITP Stuff 995. Physical Computing

Dice Catapult 5000

Do you ever get tired of throwing your own dice during a particularly long game of Monopoly?

Me neither because no one plays monopoly anymore, but for your dice throwing pleasure, here is the Dice Catapult 5000!

Dice Catapult 5000 was created using the combined knowledge of digital and analog inputs and outputs.

The dice holder is attached to a servo motor that is controlled two inputs:

  • A shiny blue arcade button that tells the servo to launch the dice
  • A potentiometer that controls how β€œhard” the dice are thrown. Here is a full video that shows the potentiometer’s effect:

For the first iteration of Dice Catapult 5000, loose cardboard, a mousetrap spring, and other low-budget prototyping materials were used. The next iteration (Dice Catapult 6000) would naturally feature golden carbon fiber components.

a measuring cup is used for the catapult
a mousetrap attaches to any cardboard box

Using the following Arduino code and corresponding wiring, you can create your own dice catapult.


#include "<"servo.h">" // include the servo library
Servo servoMotor; // creates an instance of the servo object to control it
int servoPin = 3; // Control pin for servo motor
int buttonPin = 11; // control pin for button
int catState = 1; // state of the catapult (1 or -1)

void setup() {
Serial.begin(9600); // initialize serial communications
servoMotor.attach(servoPin); // initialize servo as attachement
servoMotor.write(0); // set servo to 0
pinMode(1, INPUT); // initialize the button pin
}
void loop()
{
//Potentiometer control of catapult
int analogValue = analogRead(A0);
int servoThrow = map(analogValue, 0, 1023, 0, 180);
delay(15);
//Button control of catapult
if (digitalRead(buttonPin) == HIGH) // if button is pressed - normally in LOW state
{ catState = -1 * catState; // toggle catState variable
servoMotor.write(servoThrow); //THROW THE DICE
delay(2000); // delay so it doesnt freak out
servoMotor.write(0); //return motor to ready position
}
}

Still reading? Here is a Dice Catapult 4000, a previous version of dice Catapult:

…and here is 3000, the original functioning dice catapult:

 

2 replies on “Dice Catapult 5000”

Leave a Reply

Your email address will not be published. Required fields are marked *