PID Controller of servo motor

Discussion in 'The Projects Forum' started by mohamed.amin, Dec 26, 2011.

  1. mohamed.amin

    Thread Starter New Member

    Dec 26, 2011
    5
    0
    Hello....

    i have a problem with my controlling code i control a servo motor using an arduino, the thing is that the output of the controller is increasing by large values i can't understand or predict !!! i need the output to be bounded between
    25-135!!

    Thanks
     
  2. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    Need a diagram of what you are trying to control.

    25-135 what?
     
  3. mohamed.amin

    Thread Starter New Member

    Dec 26, 2011
    5
    0
    i am controlling a ball and beam system, i need the output of the pid controller to be bounded between these values , this value represents the angel of the servo motor !!
     
  4. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    So you have a program that simulates the PID controller? Does it have proportional, integrator, and differential loops?

    We need a lot more info about what you are doing before we can help by other than just guessing.:rolleyes:
     
  5. mohamed.amin

    Thread Starter New Member

    Dec 26, 2011
    5
    0
    sorry i am new at this , the pid controller for me changes the value of the error into an angel which corresponds to a desired motion of the ball , i need the output of the controller to be bounded between between the two values i gave u before.
    i am using a simulink for simulation, kp ki kd all= 20 the reference value is 15, the problem for me is when i write the code on the arduino ( which i am using for the control) i monitor the output of the controller and it some times reaches 9 digits , i decreased the value of the gains , and made Ki with very small value , the output of the controller increases slowly but still it can reach a very large value by time , i just need to know how to bound this output
    Regards
    Mohamed
     
  6. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    A simple way is just to do a comparison of the output value with the maximum you want it to be using an If-Then-Else type of statement. When the output tries to exceed this value you just output the maximum allowed value instead.
     
  7. mohamed.amin

    Thread Starter New Member

    Dec 26, 2011
    5
    0
    yeah. that's what i thought of , i thought there were another method !!
     
  8. mohamed.amin

    Thread Starter New Member

    Dec 26, 2011
    5
    0
    Thanks for ur effort
    :)
     
Loading...