# Ball on Beam Feedback

Hi there!
My class mates and I have been given the task to design, assemble and control a ball on beam system. Basically we are meant to design a system which balanced a ball on a beam at a position we INPUT. As feedback we are using a resistive wire set-up.

My concern is, how to integrate the feedback into the system, that is, if we want it to balance at say position x, how do I integrate the feedback? I worked on a project using the Arduino last year and I can get around the programming. I figured having a resistance wire with voltage feedback I would use the ADC on the Arduino to convert it to digital resolution.

If the beam is 40cm and I want the ball to settle at 30cm, the full resolution for 40cm would be that of 1028 bits and that for 30cm would be 771 bits (75% of 1028 bits) Would the program have to be something such as;

If feedback < 771 increment +ve to 771
If feedback > 771 increment -ve to 771

I hope I am making sense, I think I am on the right track but I would like to confirm with you guys!
Thanks
Al

In principle it will be something like that, but I suspect it will be more complex. You haven’t said, but I presume you have something (perhaps a servo) to change the angle of the bar to make the ball move. Consequently your formula would have to be more like this

“If feedback < 771 raise the left end of the bar” etc.

Assuming it is a smooth bar and ball then the ball will try to run right off the end so you will need another movement to stop it. The interesting bit is how much (or how little) and how frequent the tilt corrections will need to be. And whether the combined control and feedback mechanism is sufficiently sensitive.

Sounds like a fun project. Put end-stops on the bar to start with

…R

Yes that's all taken care of it was simple (we are mech engineers so that was the easy bit ^^) yes we have a stepper motor with micro stepping driver board so it should be a smooth rotation and we have stoppers at the end of the beam which is a V beam. Thanks for the help!

In that case I probably didn't understand your original question and so am unlikely to have answered it !

...R

No really I think it helps, we have an actuator and a setup, all I wanted to confirm was if my theory of how to control the positioning made sense, the raising of the beam on the left side as you stated will be achieved through rotation of the motor

alainagius: My concern is, how to integrate the feedback into the system, that is, if we want it to balance at say position x, how do I integrate the feedback?

The ball-on-a-beam is a classic example of a neutrally stable system (the system can remain at rest in any position without any active control). Since it is not positively stable, you need some sort of feedback system to control the position. Depending how much damping there is in the mechanism you may find you can get away with a simple proportional feedback algorithm, ("if the ball is too close to the left end, raise the left end") but this may not be adequate because the feedback will tend to amplify any oscillations. The Proportional + Integral + Derivative (PID) feedback algorithm is ideal for this problem and this scenario is often used as a thought experiment to demonstrate how it works. If you've been set a problem that requires closed loop control you will surely have been told about PID - if not, you can expect to be told about it shortly.

There is a PID library for the Arduino.

Yes indeed we have already derived the transfer function and used MATLAB to apply PID actors and we got a realistically stable result. However I never used PID with the Arduino I'll try look into that if my plan doesn't work.

Thanks Al