How do I tune servo PID gains step by step? Order of tuning, rules of thumb and a worked example
Tune the current loop, then the velocity loop, then the position loop, raising each gain until the response is fast without ringing. Covers the order, rules of thumb and a worked example.
Updated 2026-11-28
The short answer
Tune from the inside out. Most servo drives run three nested loops: current, velocity and position. Tune each inner loop first, because the outer loop is only as fast as the loop inside it. Raise a proportional gain until a small step shows overshoot or audible ringing, then back it off to about 60 to 70 percent of that value. Use the drive's auto-tune as a first pass, then refine by hand on the real machine.
Set the inertia ratio first
The load-to-motor inertia ratio tells the drive how heavy the load is compared with the rotor. Every velocity gain scales with it. If the ratio is wrong, the gains you find will be wrong too. Calculate it as J_load / J_motor, using the reflected inertia after any gearbox (J_reflected = J_load / i squared). Check the value by watching a step response: a ratio that is too low makes the loop look too slow, and one that is too high makes it look too aggressive.
Step-by-step procedure
- 1. Confirm the current loop is tuned (usually done by auto-tune) and the inertia ratio is set.
- 2. Set velocity integral and derivative terms to zero. Raise velocity proportional gain until a small step command shows overshoot or ring, then reduce it to about 60 to 70 percent.
- 3. Add velocity integral action only until the steady speed error disappears within a few tens of milliseconds, without overshoot.
- 4. Raise position loop gain until the move reaches target with little overshoot. Keep it below about one quarter of the velocity loop bandwidth.
- 5. Add velocity and acceleration feedforward to cut following error during moves, then keep feedback gains moderate.
- 6. Test at the lowest and highest speed, with the real payload and the real coupling, and record every gain.
Worked example
A motor has J_motor = 0.0002 kg·m² and the load reflects J_load = 0.0006 kg·m², so the ratio is 3:1. Without feedforward, a position gain of 40 1/s at 100 rpm (10.5 rad/s) leaves a following error of 10.5 / 40 = 0.26 rad, about 15 degrees. Velocity feedforward removes most of that error. Doubling the position gain to 80 1/s halves the lag, but if the velocity loop is slow, the move will overshoot. That is why the velocity loop must be tuned first.
Symptoms and what to change
- Overshoot and ringing at stop: reduce position gain first, then velocity proportional gain. Check for a mechanical resonance before adding derivative.
- Slow, sluggish settling: raise velocity proportional gain, or shorten the velocity integral time.
- Whine or vibration at one speed: this is usually a mechanical resonance. Use the drive's notch filter at that frequency rather than cutting all gains.
- Hunting at standstill: integral gain is too high, or the deadband is too small. See the oscillation page for detail.
Common mistakes
- Tuning the position loop before the velocity loop.
- Using a wrong inertia ratio, so every other gain is wrong.
- Tuning on an empty machine, then running with the full payload.
- Using high gain to hide a loose coupling or backlash, which turns a mechanical fault into a control problem.
- Changing several gains at once and losing track of what worked.
How to check the result
Record a step response with the drive's scope or a logging tool, and check overshoot, settling time and following error at the working speed. For most positioning axes, a small overshoot that settles within a few milliseconds is a good target. Re-check after any change to load, belt tension or coupling, because the inertia ratio and resonance move with them.
Inertia matching
Reflected J' = J_L / i²; ratio = J' / J_M
High — lower the gains; response will be slower
Sourcing a motor or production equipment from China? We can find and contact the right factories for you in Chinese. Ask on WhatsApp →