please dont rip this site

PID Servo Tuning / Troubleshooting

There are generally three settings you must adjust to make a PID based controller work correctly:

Ziegler / Nichols Starting Point: There are several ways to tune a PID controller, these steps present the Ziegler / Nichols closed loop method as a starting point. Further "trial and error" tuning should certainly be used: (Commands for the BOB PID system will be shown in parenthesis after each step... your systems commands may vary. For e.g. Arduino or other hard coded systems, adjust the parameters in the sketch before programming each time.)

  1. No I or D, Little P Start with the I and D terms set to 0 and P set to a very small value. (0i0d1p)
  2. Power up, set desired position to 1 (1{enter}) and make sure you have direction set correctly (216w or 286w) and enable the driver (e), If the servo just spins and spins, it's doing a zig when it should zag... the direction is probably wrong; disable the driver ({space}) and try the other direction before enabling again.
  3. While(!Oscillating) P++; Slowly increase the P constant while moving from one point to another and back until the unit starts to oscillate with a consistent motion, back and forth the same amount. (1p100{enter}1{enter}2p100{enter}1{enter}...) To save time, you can use an exponential and then binary search. Start with 1, then 10, then 100, then 1000, etc… until you get oscillation. Then divide that number in 2; if it still oscillates, divide by two again, otherwise, add half the current value back. E.g. from 100, try 50, if it oscillates, try 25, if not, try 75 = 50/2+50. And so on.
  4. This setting for P is called the Ku or "ultimate gain". Record it, and count the number of oscillations per second, which is called the frequency or Tu. Be sure to then change Tu into units matching the sample time used in the controller. E.g. the BOB PID uses ¼ second updates, so divide your measurement by 4.
  5. Now you can use these values to calculate good starting points for the P, I, and D terms:

Now try moving back and forth and see how the system reacts. Make both short and long jumps, small and large movements. e.g. (10{enter}1{enter}200{enter}1{enter}...) If it starts oscillating out of control, disable the motor and continue with troubleshooting below. ({space}) Be sure to give it time to settle at each point, and ensure it really does make it to exactly the desired point (mark the shaft if you can).

Once you have the tuning done, save the values to non-volatile memory {321w}

PID Troubleshooting

Oscillation: If you have a very heavy shaft, meaning a lot of mass turning on the shaft especially away from the center of rotation; this has nothing to do with the weight of the load being moved unless that load is spinning with the shaft, then increase D until you start to hear shuddering or vibration as it approaches a new setpoint. If you have a lot of overshoot when approaching a new setpoint, decrease I. Otherwise, decrease P.

Slow approach to setpoint: If you have a lot of friction in the system, increase I. If the system "grinds" or "shudders" or vibrates as it approaches the setpoint, decrease D. Otherwise increase P.

Overshoot (without oscillation): Decrease P.

See also:

file: /Techref/io/servo/PID-tuning.htm, 6KB, , updated: 2016/5/9 09:08, local time: 2024/7/20 09:49,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PID Servo Tuning</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!