Ball and Beam Demo
The ball and beam is a classic control theory problem,
consisting of a beam held in place at one end and
attached to a servo or other device that tilts it up or down at the other end,
and a ball that rolls along its length.
The incline angle of the beam determines the motion of the ball.
Ball and beam system.
The objective is to bring the ball to rest
at some specified position.
More information about this problem, including detailed mathematical
modeling, can be found here.
We have built an automatically controlled ball and beam system
using LEGO Mindstorms. The following picture shows our setup.
Ball and beam robot
We used a yardstick for the "beam", and a wheeled cart for the "ball".
A piece of cardboard attached to the ball provides a large flat reflecting surface for the sonar
sensor, which measures the ball's current position.
A pulley mechanism attached to the gears up above controls the beam's angle.
The beam is hinged with duct tape to a pedestal on one end
and held in place with the pulley and some fishing line at the other.
Sonar sensor and pulley
The Mindstorms NXT brick receives the distance data from the sonar sensor,
then calculates the proper control action, and then transmits its
instructions to the servos. The servos spin the gears,
raising or lowering the pulley, which raises or lowers the beam.
This happens several times every second, each of the adjustments
coordinated to bring the ball to rest at exactly the right spot.
Coming soon: Video of PID controllers and
new, easily-tuned control algorithms in action
controlling this system as well as several other
well-known process control problems.
The RobotC code for the PID controller
used to control this system is posted here.