Servo Systems and Tuning

Cascaded position, velocity and current loops, PID terms, tuning methods, following error, inertia ratio and stability.

What a servo system is

A servo is a closed-loop system that makes a mechanical quantity (position, speed or torque) follow a command. A servo motor is only one part: the servo drive compares the command with the feedback and adjusts the motor current to remove the error, many thousand times a second. A good servo holds position against a disturbance, follows a moving profile closely and responds to a step in a few milliseconds. A badly tuned one hums, overshoots or oscillates. This page explains the loops, the tuning method and the numbers behind them. The motors are in Choosing a Motor Technology and the encoders in Encoders, Resolvers and Feedback.

The cascaded loops

Cascaded servo loops: position outside, velocity in the middle, current insideposition command+Position loopP gain+Velocity loopPI controller+Current loopPI, fastMotorvelocity commandcurrent commandEncoderpositionspeed (derived from position)motor current (current sensor)Each inner loop is faster than the one outside it (current: kilohertz, velocity: hundreds of hertz, position: tens of hertz),so that each one sees the inner loop as an almost instant actuator. Tune from the inside out.
Three nested loops: position outside, velocity in the middle, torque (current) inside.
LoopMeasuresControlsTypical bandwidthTuned by
Current (torque)Motor phase currentVoltage applied to the windingsKilohertz (1 to 3 kHz)The manufacturer, from motor data (rarely changed)
VelocitySpeed from the encoderCurrent (torque) command50 to 500 HzYou: the most important loop
PositionPosition from the encoderVelocity command5 to 50 HzYou: usually just a gain

Each loop sees the loop inside it as an ideal actuator because it is faster. This is why the loops are tuned from the inside out: current first, then velocity, then position. The position loop bandwidth must stay well below the velocity loop (a third to a fifth is common), which is in turn well below the current loop.

Proportional, integral and derivative

TermWhat it doesToo much causesToo little causes
P (proportional)Output proportional to the error: stiffnessOscillation, whine, saturation of the currentSluggish, soft, a large error under load
I (integral)Accumulates the error over time and removes a steady errorOvershoot, slow oscillation, windupA small steady error remains (for example against gravity)
D (derivative)Reacts to the rate of change of error: dampingNoise amplified, jitter, motor buzzOvershoot and ringing

The velocity loop is usually PI (proportional plus integral), and the position loop usually P only. Derivative action is used sparingly because it amplifies encoder quantization noise. Many drives add a low-pass filter on the velocity feedback and notch filters to cancel a mechanical resonance (see below).

Worked example: velocity-loop gain from the physics

  • The loop must supply torque in proportion to velocity error. The proportional gain that gives a velocity-loop bandwidth fbw for a total inertia J is Kp = 2π × fbw × J (N·m per rad/s).
  • For the ball-screw axis of Motion Control Basics (J = 6.27 × 10-5 kg·m²) and a target bandwidth of 100 Hz: Kp = 2π × 100 × 6.27 × 10-5 = 0.039 N·m per rad/s.
  • With a motor torque constant of 0.35 N·m/A the drive’s gain is 0.039 ÷ 0.35 = 0.112 A per rad/s. Drives scale this in their own units, but the idea stands: the gain is proportional to the inertia. A higher load inertia needs a proportionally higher gain for the same bandwidth, and a drive tuned for one inertia is wrong for another.
  • A drive with auto-tuning measures the inertia by applying a test torque, then computes gains like this.

Tuning step by step

  • Prepare. Confirm motor and feedback data are correct (pole count, encoder counts, direction), the axis can move safely, and the emergency stop works. Limit torque, travel and speed for the first moves.
  • Run auto-tune if the drive has it, for inertia estimation and a first set of gains. For many axes this is enough.
  • Tune the velocity loop. Command a small square-wave speed (for example ±10 percent of maximum) and watch the speed response on the drive’s scope. Raise the proportional gain until the response is fast but starts to ring, then back it off by 30 to 50 percent.
  • Add integral action. Increase the integral gain (or shorten the integral time) until the steady error disappears quickly without adding overshoot. Typical integral time is a few times the velocity-loop response time.
  • Add filters. If the motor whines or a resonance appears, apply a notch at the resonance frequency and a low-pass filter on the speed feedback.
  • Tune the position loop. Raise the position gain Kv until the step response is quick with only a few percent overshoot, but well below the velocity-loop bandwidth.
  • Add feedforward (next section) to cut the following error during moves.
  • Test the real motion at full speed, with the real load, in both directions and at both ends of travel; then repeat with the load at its worst (heavy, hot, fully extended).
Step response: under-damped, well tuned and over-damped0246810120.00.51.01.5time (in units of one natural period ÷ 2π)position (fraction of the step)ζ = 0.3: overshoot 37 percent, ringsζ = 0.7: overshoot 4.6 percent, settles fastζ = 2: no overshoot, slow
Step responses of an under-damped, well-damped and over-damped axis.

The aim is a response like the green curve: a small overshoot (a damping ratio around 0.7 gives 4.6 percent) and quick settling. The red curve, with a damping ratio of 0.3, overshoots by 37 percent and rings; the blue curve is stable but slow. Overshoot of the position is usually unacceptable in a machine, so tuning often errs toward the damped side.

Following error and feedforward

During a move the actual position lags the command by the following error. With a proportional position loop the error needed to produce a velocity v is e = v ÷ Kv, where Kv is the position-loop gain in 1/s. A drive trips a following-error fault when the error exceeds a limit, which is a useful warning of a stall or a crash.

Worked example: following error at speed

  • The axis runs at 4 000 rpm = 66.7 rev/s with a 10 000 counts per revolution encoder, so the command is 666 667 counts/s. With Kv = 100 s-1, the following error at cruise is 666 667 ÷ 100 = 6 667 counts = 0.67 rev, which on the 10 mm screw is 6.7 mm.
  • Velocity feedforward adds the commanded speed straight to the velocity command, so the position loop only has to correct the small remainder. With 98 percent feedforward the error falls to about 0.13 mm. Acceleration feedforward does the same for the torque needed to accelerate the inertia (J × α, from Motion Control Basics).
  • Feedforward does not affect stability, because it is outside the feedback loop. That is why it is the safe way to reduce error when the loop gain cannot be raised.
  • The error does not matter if the target is reached: it only matters for contouring (two axes that must stay in step), where the errors of different axes must match.

Inertia ratio and resonance

The inertia ratio is the load inertia reflected to the motor shaft divided by the rotor inertia. A rule of thumb for good response is a ratio below 10:1 for general machines, below 5:1 for fast, accurate axes, and near 1:1 for the best dynamics. A large ratio means the load is hard to control with a small motor, and the loops detune easily when the load changes.

Worked example: gearing to fix the ratio

  • In the ball-screw axis the reflected load inertia is 1.27 × 10-5 kg·m² against a rotor of 2.00 × 10-5: a ratio of 0.63:1, excellent.
  • A rotary table with a load inertia of 0.01 kg·m² driven directly by the same motor would have a ratio of 500:1: unmanageable.
  • A gearbox of ratio N reduces the reflected inertia by N². With 10:1 the ratio becomes 0.01 ÷ 10² ÷ 2.00 × 10-5 = 5.0:1. The motor runs 10 times faster and delivers 10 times less torque for the same output. See Mechanical Transmission: Screws, Belts and Gearboxes for the full method.

Resonance. Couplings, shafts, belts and frames are springs. The load and the motor can oscillate against each other at a mechanical resonance frequency (typically 100 to 1 000 Hz), and raising the gain until the loop reaches that frequency produces a whine or a violent vibration. Cures: a stiffer coupling or a shorter shaft, a lower gain, a low-pass filter, or a notch filter set at the resonance. A load connected through a belt or long shaft has a lower resonance, so the achievable bandwidth is lower.

Drive modes and interfaces

ModeThe controller sendsThe drive closesUse when
Torque (current) modeA current or torque commandCurrent loop onlyThe controller closes the speed and position loops itself (a motion controller)
Velocity modeA speed command (±10 V, fieldbus)Velocity and current loopsThe controller closes the position loop (older motion cards, spindles)
Position modeStep and direction, or position over a fieldbusAll three loopsA PLC or controller that only sends targets
Cyclic synchronous modes (CSP, CSV, CST)Position, velocity or torque every cycle over EtherCAT, PROFINET IRT or CANopenChosen loops, synchronizedMulti-axis machines with tight coordination (see Industrial Ethernet)
  • Analog ±10 V commands are simple but pick up noise and drift; pulse and direction are digital but carry no feedback to the controller; fieldbus commands carry setpoints and diagnostics both ways. The standard profile for drives is CiA 402 (CANopen over EtherCAT).
  • Connect the drive to a PLC following Motors, Drives and PID Control and the platform recipes in Connecting PLCs, Drives and HMIs.

Troubleshooting a servo axis

SymptomLikely causeFix
High-pitched whine or buzzGain too high, resonance, noisy feedbackLower the velocity gain, add a notch or low-pass filter, check encoder wiring and shielding
Low-frequency hunting, slow oscillationIntegral gain too high, backlash in the transmissionLower the integral term; remove or reduce backlash
Overshoot on a stepPosition gain too high for the velocity loop, or too little dampingLower Kv, add feedforward instead
Motor runs away or runs the wrong wayFeedback direction reversed, wrong motor or encoder phasingCheck the encoder direction and the commutation set-up; test with torque limited
Following-error faultMechanical jam, torque limit reached, gains too low, brake still onCheck the mechanics, current limit, brake release and the move profile
Axis drifts at standstillZero offset on an analog input, no integral actionAuto-zero the input, enable integral, use digital commands
Vertical axis drops when disabledNo holding brakeAdd a brake (see Braking, Safe Stopping and Troubleshooting)
Works cold, oscillates warmResonance or friction changes with temperatureTune with the axis warm, reduce the gain margin

Related

FAQ

What should the inertia ratio be?

Keep it below 10:1 for general machines and below 5:1 for fast or precise axes, with a gearbox if needed. Higher ratios can work with soft tuning and a stiff transmission, but the performance and the margin suffer.

Do I need to tune the current loop?

Normally not: the drive sets it from the motor data. Tune it only if a motor’s inductance is unusual or the manufacturer says so.

What is windup and how do I avoid it?

Integral windup is when the integral term keeps growing while the output is saturated (current limit), then overshoots when the saturation ends. Use a drive with anti-windup, a limited integral range, and avoid commands the motor cannot follow.

Is auto-tuning good enough?

Often yes as a starting point, especially for a rigid, simple load. It cannot know about a resonance, backlash or a load that changes, so check the result on the real machine and adjust.

References

  • Franklin, G. F., Powell, J. D. and Workman, M. L., Digital Control of Dynamic Systems, Addison-Wesley.
  • Kollmorgen, Servo tuning guides; Yaskawa and Siemens drive manuals (autotuning, notch filters, feedforward).
  • Åström, K. J. and Murray, R. M., Feedback Systems, Princeton University Press (free online).

Last reviewed: October 2026. Numbers are worked examples; use the drive manufacturer’s tuning procedure for the real equipment.