Robotic Ball Bouncer
This is a simple ball bouncing robot using only one servo, an Arduino Uno and some scrap lumber, epp foam and a section of fishing pole. Ball is two centimeter steel ball-bearing.
I originally wanted to construct a Claude Shannon juggling machine and wasn't having much luck but stumbled across this way to bounce a steel ball in a couple of ways.
This project is easy to build and would be a wonderful project to scale up using overinflated basketballs.
Second video shows bouncing two balls one after the other.
Build "mitts"
My pendulum is just a section of fishing pole about 56 centimeters long with a hole drilled near the center for a bolt to serve as an axle. The mitts to catch and release the ball are made from some soft material like computer packing or epp foam. The shape is v-shaped and does not have to have any specific dimensions though mine are about 14 centimeters long. They are then glued to a couple of chopsticks which are attached through two holes in the pendulum bar. I hotglued the epp mitts to the chopsticks.
Mount Servo and Attach to Pendulum Bar
Construct some kind of mount to hold the servo then construct the linkage. I attached a short section of wood to the servo to give about 3 cm attachment point for another 9 cm section of fishing pole to attach to the pendulum bar. You have to play around with the attachment points until you can get the bar to move up and down about 30 cms from top to bottom. Exact dimensions are not necessary, just ballpark, because the real accurate adjustments are made int the arduino program.
Wire Servo to Arduino
Attach wires from servo to 5 vcc, gnd and signal to arduino digital pin 11.
Finally Load Arduino Sketch and Adjust Program Parameters
Here is my sketch, I have a subroutine to run the servo at slower speeds.
You will notice that single bounce code just raises the pendulum bar to a certain height. The double bounce routine raises it to one height at a slower speed so the ball releases slower and then moves the rest of the way down to catch the ball on it's second bounce.
Have fun!
#include
Servo servo1,;
int servangle = 0;
int potPin = 4;
int ledPin = 13; // select the pin for the LED int val = 0; // variable to store the value coming from the sensor int
int delayTime = 0; //Analog read pins const int buttonPin = 2;
void myServo(int curAngle,int newAngle,int angleInc,int incDelay,int servoNum)
{ if (curAngle < newAngle) {
for(int angle=curAngle;angle < newAngle;angle += angleInc) {
if (servoNum == 1) servo1.write(angle);
if (servoNum == 2) servo2.write(angle);
delay(incDelay); } }
else if (curAngle > newAngle) {
for(int angle=curAngle;angle > newAngle;angle -= angleInc) {
if (servoNum == 1) servo1.write(angle);
if (servoNum == 2) servo2.write(angle);
delay(incDelay); } } }
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
// declare the ledPin as an OUTPUT
//pinMode(buttonPin,INPUT);
servo1.attach(11);
delay(10);
servo1.write(90); delay(5000);
randomSeed(analogRead(0)); }
void loop() {
// Serial.print(" delay val= ");Serial.print(val);Serial.print(" angle val= ");Serial.println(valPot2); digitalWrite(ledPin,HIGH);
// bounce twice to left myServo(120,73,1,20,1);
//left delay(500);
myServo(73,65,1,20,1);
//left delay(2000);
// bounce once to right
myServo(65,120,1,20,1);
//right delay(2000);
// bounce once to left
myServo(120,65,1,20,1);
//left delay(2000);
// bounce once to right
myServo(65,120,1,20,1);
//right delay(2000);
digitalWrite(ledPin,LOW);
//cli();
}