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.
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:
#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);
}
//citation: https://www.arduino.cc/en/Tutorial/Sweep
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.
Leave a Reply
You must be logged in to post a comment.