ball and beam system
This project is a “ball and/On Beam” system.So this project is basically a PID controlled system where you have a linear beam or 1D surface ( can be extended to a plane /2D) and you have to balance a ball that is in motion at any position of the beam desired by the user.Now there are various methods to give that “desired position” some use potentiometer converted to a distance (by doing ADC mapping) etc. We used a simple hand gesture to set the ball’s position on the beam which is found out using image processing. We take a colored ball and using HSV threshold and some “moments” calculation we find the center of the ball.
My setup had following things:
- A laptop with webcam
- A PIC microcontroller (PIC16f877a)
- A USB to Serial module
- A ball and beam setup.
I actually implemented this algorithm in my laptop using a python script which you can find at the end of the the post The beam is a cheap wire-cover having a little groove enouhg for a round tennis ball to move in a straight path. It is attached to a fixed support and is moved about the mean position with a Servo motor attached to it. The servo is controlled by a PIC microcontroller and the extent of movement is actually send from my laptop to PIC serially via a USB-Serial module .The data sent from PC is the angle with which the servo has to move, which is determined by calculating the position of ball and the setpoint. PID control is used for providing control feedback to the whole system. All the PIC does is change that angle into appropriate electrical signal to drive the servo meter.