A servo axis is a loop of promises. The controller promises the position, the encoder reports where the load actually sits, and the motor twists the difference into motion. When the loop is tuned well, the axis lands silently and precisely at the target; when it is tuned poorly, the axis overshoots, rings, chatters, or slams into the stop. This practical tutorial covers servo system tuning and motion control the way an automation engineer does it: understanding the loop, choosing the motor and drive, selecting the feedback, setting the gains, and adding feedforward, with a precision gantry axis case study that went from ringing to rock-solid.
⚙ The mental model: a servo loop is a spring and a damper in software. The spring pulls the load to the target, and the damper keeps it from bouncing; the gains are the stiffness and the damping, set in harmony.
1. The Servo Loop: Position, Velocity, and Current
The modern servo drive runs three loops nesting like Russian dolls. The innermost current loop drives the motor torque from the current demand, the middle velocity loop turns the velocity error into the current demand, and the outermost position loop turns the position error into the velocity demand. Each loop runs progressively slower: current at many kilohertz, velocity at a few kilohertz, position at a few hundred hertz, and each inner loop must be tuned before the outer loop above it can behave.
Tuning is bottom-up for exactly this reason. A stable current loop gives the velocity loop a reliable tool; a stable velocity loop gives the position loop a trustworthy throttle. When the axis rings, the vibration usually lives in the velocity loop, and when it overshoots position, the fault sits in the position loop gains or the feedforward. Know which loop owns which symptom, and the tuning stops being trial and error.
2. Servo Motor and Drive Sizing
The motor and drive must deliver the torque and speed the axis demands with margin. Compute the worst-case torque accounting for the friction, the inertia of the load and the coupling, and the acceleration at the fastest move. The inertia match matters most: a motor with too much load inertia on a small motor responds sluggishly and pushes the gains down, while a well-matched ratio, commonly 3 to 1 load-to-rotor inertia or better, keeps the loop responsive and the gains high.
The drive current rating follows the peak torque of the fastest cycle, because the axis draws its peak current during the accelerations, while the continuous rating follows the average. Undersize the drive and the axis faults on the very move you designed it to make; oversize it and you pay for current you never use. Size from the real motion profile, a trapezoid of accel, cruise, and decel, and both the motor and the drive fall out of the calculation.
3. Feedback: Encoders, Resolvers, and Resolution
The axis knows where it is only as well as its feedback tells it. Incremental encoders count the pulses from a rotating disc and need a home move at power-up; absolute encoders report the position immediately, battery-backed or multi-turn, saving the homing cycle. The encoder resolution, often 17 to 23 bit in modern drives, sets the finest position step the axis can feel, and the effective resolution at the load is the encoder count divided by the mechanical transmission ratio.
On high-precision axes, the feedback moves to the load itself. A linear encoder on the slide measures the actual table position, removing the errors of the ball screw and the coupling from the loop, and linear scales on gantry axes make sub-micron positioning practical. Resolvers survive the heat and vibration that encoders fear, at the cost of lower resolution. Match the feedback to the accuracy the axis must deliver: the encoder resolution should be ten times finer than the positioning tolerance, so the loop measures what it must control.
4. The PID Gains: Proportional, Integral, Derivative
The position and velocity loops are built on the PID family. The proportional gain, P, is the spring: higher P pulls harder against the position error and tightens the response, until the axis starts to ring or the machine compliance becomes audible. The integral, I, slowly eliminates the steady-state error that friction leaves behind, a necessary evil that can cause overshoot and slow oscillation if set too strong. The derivative, D, is the damper: it reacts to the rate of change of the error and settles the axis, at the cost of amplifying the high-frequency noise from the encoder.
Practical tuning goes in order: raise the velocity loop P until the axis response is crisp without ringing, add the I to kill the droop, then raise the position P and balance with the position D. Modern drives offer autotuning, a measurement routine that injects a test signal and sets the gains from the observed response, which delivers a good starting point, and then the human tunes the last twenty percent by listening and watching the step response. A step response that settles in one clean motion with a single small overshoot is the signature of an axis in harmony.
5. Feedforward: Taking the Error Out Before It Happens
Feedback reacts; feedforward anticipates. The velocity feedforward feeds the commanded velocity into the velocity loop so the motor starts moving with the command instead of chasing its error; the acceleration feedforward handles the torque needed to accelerate the load, so the axis does not lag during the ramps. A well-tuned feedforward collapses the tracking error in the middle of a move, where feedback alone would trail behind like a car following at too close a distance.
Feedforward does not fix instability; it fixes lag. Raise the velocity and acceleration feedforward while watching the following error in the controller: the error shrinks toward zero through the move, and when it starts to ring or overshoot at the corners, the feedforward is too strong. The best motion controllers tune feedforward with a following-error display, and the display turns the tuning from a guess into a target. A precision axis with good feedforward holds its path in the moving middle, not just at the stationary ends.
6. Mechanical Resonance and Filter Settings
The stiffest servo loop in the world cannot outrun a floppy coupling. The mechanical structure transmits motion with its own resonances, and when the servo excites a resonance, the axis rings at that frequency, audibly and sometimes destructively. The drive responds with notch filters: narrow frequency-band filters tuned to the resonant peak that remove the excitation while leaving the rest of the response intact. A late-generation drive measures the resonance automatically and plants the notch in one button press.
Respect the mechanical side before the filter side. A rigid coupling, a short direct drive, and a massive table raise the resonant frequency and give the loop room to work, while a long shaft and a springy coupling drag the resonance down into the control band and demand aggressive filtering. The best tuning starts on the drawing board: shorten the mechanical chain, stiffen the connection, and the gains, not the filters, do the work.
7. The Precision Gantry Axis Case Study
A gantry with two parallel motors moved a 30 kg inspection head, and the axis refused to settle: it rang at every stop, overshooting the target by a millimeter and taking half a second to forgive itself, which was too slow for the cycle and too fat for the tolerance. The first suspicion, bad gains, was only half right. The autotune raised the velocity loop gains until the resonance of the long gantry beam showed up as a squeal, and the following error grew exactly at the ramp corners.
The fix combined all the tools. The resonance was measured and the notch filter set, the velocity feedforward tuned so the tracking error in the moves fell from 0.4 mm to 0.05 mm, and the position gains raised now that the mechanical ring was silenced. The axis settled in a single clean step, the overshoot vanished, and the inspection head hit its 0.02 mm repeatability in the measured run. It was never one setting; it was the whole recipe in order, mechanical resonance, filter, feedforward, then gains.
8. Common Tuning Mistakes and Their Symptoms
Three mistakes dominate the tuning bench. Raising the position P until the axis rings always fails, because the ring is a mechanical resonance that the position loop cannot silence. Ignoring the velocity loop, tuning position on top of a shaky velocity loop, produces oscillation that no outer filter fixes. And relying on autotune alone leaves the feedforward untouched, so the axis is stable but lags all through the move, then jumps at the corners. The symptom list maps to the fix list: ring means resonance and filters, lag means feedforward, steady offset means integral or an uncalibrated homing.
Change one parameter at a time and observe the step response and the following error after every change. The discipline isolates the cause, and the observation confirms the cure. A tuning session that ends with the same axis it started, only faster and quieter, is the session that was done in order.
9. Motion Profiles, Jerk, and the Path
Beyond the loop sit the motion profiles that command it. A trapezoidal profile accelerates at full rate, cruises, and decelerates, simple and quick but with a jerk spike at each corner that excites resonances and wears the mechanics. S-curve profiles round the corners by ramping the acceleration, producing a smoother, quieter move that lands faster in practice because the axis can run higher peak acceleration without ringing. Modern controllers call it jerk control, the rate of change of acceleration.
On multi-axis paths, profile smoothness becomes path accuracy. A rounded corner in a contour wastes tolerance that the process cannot afford; exact stop cornering costs time; and a good controller with lookahead blends the moves while keeping the path error inside the allowed window. The choice of profile, trapezoid for raw speed, S-curve for smoothness, lookahead blends for accuracy, belongs at the motion planning table, not as an afterthought in the tuning session.
10. Diagnostics, Commissioning, and Documentation
A servo axis commissions in a fixed rhythm: verify the wiring and the polarity, set the motor parameters from the nameplate, run the autotune, tune the filters for the measured resonance, tune the feedforward on the following-error display, and finally verify the absolute path accuracy with a measurement. Log the final gains, the filter settings, and the profile in the machine documentation, because the next engineer inherits the recipe and the axis behaves the same after a drive replacement.
Diagnostics live in the drive: the following error that grows over time announces a slipping coupling or a dragging brake, and the current that climbs on the same move announces rising friction. Watch the drive variables against their baseline, and the servo axis reports its own health months before the failure. A documented, monitored axis is a predictable one, and a predictable axis is the foundation of every machine that runs the same shift after shift.
Conclusion
Servo system tuning and motion control are the art of making the software spring and damper match the mechanical reality. Size the motor and drive from the real motion profile, choose a feedback that measures what the axis must control, tune the loops bottom-up, silence the mechanical resonance with filters, and remove the tracking lag with feedforward. The gantry case study went from ringing and overshooting to a clean settling axis by applying the recipe in order. Choose the motion profile to match the path, and document the commissioned values before the engineer leaves. An axis tuned this way is not just fast and accurate; it is calm, and a calm axis is the quiet proof that the whole machine was designed with the loop in mind.
Automation rule: tune the loop bottom-up, filter the mechanical resonance, and feed the feedforward before you blame the gains.