This is a simple mechanism that allows the ball move along a random path and finally falls into a hole.

The angle of the swing is randomized so that the motion of the ball is unpredictable. The top surface is a bit slanted in order to prevent the ball from moving back and forth for many times in the same place. A piece of wood is attached to the servo horn in order to amplify the swing effect of the servo to the model.

three-corner view
the pattern on the top surface
bottom view
side view


Future Improvements & Exploration:

  • A bigger top surface: the ball won’t fall into the hole so fast
  • A more complex path: adding more zigzags or a maze-like pattern to make it more interesting
  • Improved algorithm: the movement can be more dynamic through introducing different levels of violence

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <Servo.h>
 
Servo myservo; 
 
void setup() {
  myservo.attach(9); 
}
 
void loop(){  // rotating with random angles
  long pos=random(25,65);  
  myservo.write(pos);
  delay(200);
}
 

Previous Iteration

In this previous iteration, I tried to make the ball moving horizontally. However, it was not balanced enough because we are only allowed to use one servo. I began to think if I could utilize such restriction and create something that is unbalanced. That’s how I came up with my final model above by taking advantage of the unbalanced nature of using one servo.