Tuning a servo without a control theory degree
The three loops, what inertia ratio does to all of them, and a tuning order that converges.
Short answer
Set the inertia ratio first, because every gain the drive calculates is scaled by it. Then tune from the inside out: current loop, which is usually fixed by the manufacturer, then velocity loop, then position loop. Raise the velocity proportional gain until the axis buzzes, back off by a third, then add integral until steady state error disappears. Only then close the position loop.
Servo tuning has a reputation for being an art, and most of that reputation comes from people adjusting gains in the wrong order and then adjusting them again.
Done in the right order, it converges quickly and the reasoning at each step is straightforward.
The three loops
A servo drive runs three nested control loops. Innermost first.
Current, or torque. How much current to put through the windings to produce the demanded torque. Runs fastest, tens of kilohertz, and is set by the manufacturer from the motor data. Leave it alone.
Velocity. How much torque to demand to reach the demanded speed. Runs at a few kilohertz. This is where most of the tuning happens.
Position. How much speed to demand to reach the demanded position. Runs slowest. Usually only a proportional gain.
Tune from the inside out. A position loop tuned on top of a badly tuned velocity loop will be tuned to compensate for it, and the compensation falls apart the moment the load changes.
Inertia ratio, first and always
The single number that matters most, and the one most often left at its default of one.
It is the load inertia, reflected through the gearbox to the motor shaft, divided by the motor's rotor inertia. Reflected means divided by the gear ratio squared, which is why a modest gearbox transforms an impossible ratio into an easy one.
Every gain the drive computes is scaled by this number. Get it wrong by a factor of ten and no amount of subsequent adjustment produces a well behaved axis.
Autotune measures it. If autotune is impossible, calculate it from the mechanical drawing; even a rough figure beats leaving it at one.
Tuning the velocity loop
The procedure that converges, with the axis making small repeated moves.
- Set integral gain to zero or its minimum.
- Raise the proportional gain until the axis audibly buzzes or oscillates, then reduce it by about a third.
- Add integral gain until the steady state error goes away. Too much shows as overshoot and a slow settle.
- If a resonance stops you raising the proportional gain far enough, find its frequency and place a notch filter on it. Then continue raising.
The position loop
Usually proportional only, and it interacts with the velocity loop directly: raising it too far causes overshoot that looks like a badly tuned velocity loop.
Raise it until the axis reaches position quickly without overshooting, and stop.
Feedforward is the useful addition here. Velocity feedforward tells the velocity loop what speed will be needed before the position error demands it, which reduces following error during a move without touching stability. On a machine that must track a profile rather than reach a point, it is worth more than any amount of gain.
Mechanics beat gains
The part that saves the most time. A large share of untunable axes are mechanical.
- Backlash in a coupling or gearbox means the loop is controlling something that is not always connected.
- A compliant belt or a long shaft adds a resonance that caps the achievable gain.
- An oversized motor on a tiny load gives a very low inertia ratio and can be twitchy rather than better.
If a rigid coupling makes the problem disappear, the problem was never the gains.
Knowing when to stop
The target is not the highest gains the axis will tolerate. It is the lowest gains that meet the requirement, because everything above that is margin spent on nothing.
Set the actual requirement first, following error during a move, settling time, position tolerance at rest, and stop when it is met.
Common questions
- What is inertia ratio and why does it matter?
- The ratio of load inertia reflected to the motor shaft, to the motor's own rotor inertia. It scales every gain in the system. A drive told the ratio is 1 when it is 20 will calculate gains an order of magnitude too low and feel sluggish no matter what else is adjusted.
- Why does my axis buzz after tuning?
- The gains are above the point where the mechanical resonance of the coupling and load is being excited. Back the velocity proportional gain off until it stops, or if the resonance is at a specific frequency, place a notch filter there and continue raising the gain.
- Should I use autotune on a servo?
- As a starting point, yes. It measures inertia and sets sensible gains, which is a better place to begin than the defaults. It rarely produces the best result on a machine with compliance or varying load, so treat it as the first iteration rather than the answer.
Keep reading
- Safety
SIL or PL: which one does your machine need?
Two standards, two scales, and one machine. Which one applies, how they map to each other, and why the answer is usually ISO 13849.
- Safety
Categories B, 1, 2, 3 and 4, in plain terms
Five architectures, what a single fault does to each, and the practical wiring that goes with them.
- Safety
Safety relay or safety PLC: how to decide
One is a wiring decision, the other is a programming one. The count of safety functions, not the size of the machine, is what settles it.