So I have a Ball on Beam Project and I'm quite new to the Arduino however I have managed to complete a project prior to this so I have some experience. Basically the project demands that a ball is balanced at a point on a beam and the beam has to rotate clockwise and counter clockwise to raise or lower the beam to move the ball closer to the set point. We have a feedback system that will give an analog input, using the ADC we plan on getting it close to a set resolution number. For example if the position we require translates to the resolution number of 771, then when the analogread is > 771 the motor drives clockwise and vice versa.
The problem is that for every bit of resolution it is away from the set resolution, I would like the angle to change. For example if the set point is 771 and the analog read is reading 800 then the angle will be 'x', but as it decreases towards 771 and reaches say 780, then the angle decreases because it is closer to the set point, it can be considered a method of damping I guess, instead of leaving the angle the same and letting the system overshoot and compensating with changing the motor direction, it reduces the overshoot by reducing the angle.
Unfortunately I'm no pro at this and I am a bit lost on what to do. If anyone can guide me at least on the concept of what i should be doin or what commands to look into it would be much appreciated.
Al
I'm quite new to the Arduino
That's no excuse for not reading the stickies at the top of the forum. The ones that say "POST YOUR CODE" in real big letters, bold and red.
Unfortunately I'm no pro at this and I am a bit lost on what to do. If anyone can guide me at least on the concept of what i should be doin or what commands to look into it would be much appreciated.
Since a review of your code reveals no clues as to how you are currently driving the stepper, or how number of steps relates to angle, you are on your own.
It shouldn't be too hard, though, to define a number of steps based on the difference between the current position and the desired position. It isn't obvious what you are measuring, though, and how that relates to the beam angle. A picture is worth a thousand words.
alainagius:
Unfortunately I'm no pro at this and I am a bit lost on what to do.
What you're describing is a simple proportional feedback system. Given that you have been set the problem I would have thought that by now you will have been taught how feedback control systems work, probably introduced to the concept of a transfer function and have a general idea of how to prevent oscillations and steady-state errors. This will probably lead you to a PID algorithm, and under the circumstances I would not be surprised if you are expected to code this for yourself.
Yes we derived everything and we are expected to code it for ourselves, would you suggest i look into the PID libraries or do you think there is some other way around it?
Thanks
Al
alainagius:
would you suggest i look into the PID libraries or do you think there is some other way around it?
Well, it's not difficult to code the PID algorithm yourself, and you should have a sufficient understanding of the algorithm to make it fairly easy to write, and I imagine that you would get more credit if you implemented it yourself - as long as you succeed in making it work. You do have the fallback option of using the standard PID library if you can't manage that or run out of time.