Servo control is not that simple, there a lot in control theory that you
must deal of.
Closed loop instability is common and you must address it with a more
sophisticated algorithm.
It seems that a PID controller may be better suited for your problem.
Have you tried to add a dead-band to your logic (simply tolerate the 3
degree error. If the position is inside the 3 degree band, then stop
trying to correct it).
Isaac
Em 23/5/2012 00:11, yamanoor sairam escreveu:
{Quote hidden}> Hello All,
>
> I had written to the list long time back regarding the drive of servo motor using a potentiometer and a PIC12F675. I was successful in doing driving the same. I got back to working on this project and I am happen to face a new problem.
>
> When there is no load on the motor, it works perfect. When I load the motor, it keeps wobbling. I think the motor is not able to drive the load or there is a small slippage that is causing the problem. All I wanted to do was that the motor should rotate between 90 and 180 degrees when a switch is toggled.
>
> Should I just switch off the motor when it is near the desired position? It looks like the motor has reached 3 degrees and trying to correct the angle and slipping off to -3 degrees. It keeps repeating this cycle.
>
> I am posting a snippet of the code:
>
> if(GPIO & (1<<3))
> {
> if(servoVal>=(1499))
> {
> servoVal = servoVal-(quotient*10);
> }
> // do_servo();
> }
> else if(!(GPIO & (1<<3)))
> {
> if(servoVal<=(2300))
> {
> servoVal = servoVal+(quotient*10);
> }
> //do_servo();
> }
>
> Sai
>