Motion
A servo system is a closed-loop actuator that continuously measures its own position and corrects any error. From the 50 W spindle motor on a CNC to the 15 kW axis drive on a stamping press, the same fundamental physics, control theory, and commissioning principles apply. This guide covers everything — mechanics, electronics, control loops, tuning, programming, faults, and safety.
Adjust Kp, Ki, Kd and watch the servo axis step response in real time. See overshoot, settling time, and following error react to every change. Enable feed-forward to see how VFF eliminates ramp lag.
Build and compare trapezoidal vs S-curve profiles. Adjust distance, speed, acceleration, and jerk. See position, velocity, and acceleration curves simultaneously. Observe how S-curve eliminates jerk spikes at phase transitions.
Walk through the standard servo drive state machine step by step. This is the sequence every drive follows from power-on to motion — understanding it prevents 90% of "drive won\'t enable" problems.
Visualise how changing loop gain and adding notch filters affects servo stability. The red vertical line is the gain crossover frequency. Phase margin is read at that point. Green = stable, orange = marginal, red = unstable.
A servo system is a closed-loop control system. The motor moves, an encoder measures the result, and the drive compares the measurement to the command — correcting the error every microsecond. This is what separates a servo from a stepper or a plain induction motor: continuous, real-time self-correction.
Every servo system has the same four nodes: Controller (PLC / CNC / motion card) → Drive (amplifier + DSP) → Motor (converts current to torque) → Load (the machine). Feedback flows back from the encoder/resolver on the motor shaft (or a separate linear encoder on the load) to the drive, closing the loop. The drive may run three nested loops: Position → Velocity → Current (torque) — each faster than the one above it.
// The three-loop servo architecture (from outer to inner)
//
// [Position loop] ~0.5–4 kHz bandwidth typical
// ↓ position error → velocity setpoint
// [Velocity loop] ~1–8 kHz bandwidth
// ↓ velocity error → current (torque) setpoint
// [Current loop] ~10–100 kHz bandwidth (inside drive DSP)
// ↓ current error → PWM duty cycle
// [Power stage] IGBT / SiC switching ~8–20 kHz PWM
// ↓ 3-phase AC to motor windings
// [Motor + Load]
// ↓ shaft position
// [Encoder] reads position every ~125 ns (8 MHz clock)
// ↑ fed back to all three loops
// Key rule: each inner loop must be ≥ 5-10× faster
// than its outer loop for stable operation.
PMSM (Permanent Magnet Synchronous Motor) — also called BLAC or AC servo — is the industry standard. Sinusoidal back-EMF, field-oriented control (FOC), high torque density, low cogging. BLDC (Brushless DC) uses trapezoidal commutation — simpler control, slightly more torque ripple. Linear servo motors eliminate the ballscrew, giving direct-drive linear motion at high speed and zero backlash. Voice-coil actuators are short-stroke direct-drive linear servos used in injection moulding needle valves and semiconductor wafer handling.
// PMSM motor nameplate data — what every value means
//
// Rated power: 1.5 kW (shaft output at rated conditions)
// Rated speed: 3000 RPM (continuous operating speed)
// Peak speed: 6000 RPM (brief, e.g. rapid traverse)
// Rated torque: 4.8 Nm (continuous without derating)
// Peak torque: 14.4 Nm (typically 3× rated, limited by Ipeak)
// Rated current: 6.5 A RMS (stator phase current, continuous)
// Peak current: 19.5 A RMS (drive must supply this)
// Voltage: 230/400 V (DC bus typically 280/560 V)
// Kt (torque const):0.74 Nm/A (torque = Kt × Iq — FOC)
// Ke (back-EMF): 0.74 V/rad/s (= Kt in SI)
// Encoder: 23-bit abs (8 388 608 counts/rev)
// Inertia (rotor): 1.2 × 10⁻⁴ kg·m²
// IP rating: IP64 (dust-tight, splash-proof)
// Thermal class: F (155°C winding insulation)
The feedback device is the most critical component for accuracy. Incremental encoders (A/B/Z) give position changes but lose absolute position at power-off — homing is required. Single-turn absolute encoders give position within one revolution (0–360°) at power-on. Multi-turn absolute encoders (with a battery-backed gear train or Wiegand effect) know both angle and revolution count at power-on — no homing ever. Resolvers are robust analogue devices used in hot, vibrating, or high-EMI environments. Linear encoders (glass scale, magnetic tape) measure load position directly, eliminating ballscrew pitch error and backlash from the feedback loop.
// Encoder resolution impact on positioning
// System: 20-bit single-turn absolute encoder (1 048 576 cnt/rev)
// Ballscrew pitch: 10 mm/rev, no gearbox
VAR
enc_resolution : DINT := 1048576; // counts per motor rev
screw_pitch_mm : REAL := 10.0; // mm per motor rev
gear_ratio : REAL := 1.0; // direct drive
counts_per_mm : REAL;
resolution_nm : REAL; // theoretical resolution
END_VAR
counts_per_mm := (enc_resolution * gear_ratio) / screw_pitch_mm;
// = 1 048 576 / 10 = 104 857.6 counts/mm
resolution_nm := 1.0 / counts_per_mm * 1 000 000.0;
// = 0.0095 nm theoretical — in practice, mechanical error dominates
// Real accuracy is limited by:
// • Ballscrew pitch error: ±2–5 µm per 300 mm (class C3)
// • Thermal expansion: ~12 µm/m/°C for steel
// • Ballscrew backlash: 2–15 µm (preloaded = 0)
// • Encoder mounting runout: 1–3 µm typical
The servo drive (amplifier) converts mains AC to a controlled DC bus, then chops that bus into variable-frequency, variable-amplitude AC for the motor via a three-phase inverter. Understanding its hardware — power stage, feedback interfaces, I/O, and safety terminals — is essential before any commissioning work.
| Type | Torque Density | Speed Range | Control | Best For |
|---|---|---|---|---|
| PMSM (AC Servo) | High | 0–6000 RPM | FOC (sinusoidal) | General machine, CNC, robot |
| BLDC | Medium–High | 0–10 000 RPM | Trapezoidal | Spindles, fans, cost-sensitive |
| Linear Servo | Very High (force) | 0–10 m/s | FOC (linear) | Direct-drive, zero backlash |
| Voice Coil | High (short stroke) | ±5–50 mm | Simple linear | Needle valves, wafer handling |
| Stepper (open) | Low at speed | 0–1200 RPM | Open-loop | Low cost, low speed only |
Mains → EMC filter → rectifier → DC bus capacitors → braking chopper → IGBT inverter → motor. The DC bus voltage is approximately 1.35 × Vline_RMS (280 V for 200 V drives, 560 V for 400 V drives). Capacitors store energy for transient demands. The braking chopper switches a resistor across the bus when regenerative braking energy causes bus voltage to rise above ~110% nominal. Without this, the drive trips on "DC Bus Overvoltage" when stopping a high-inertia load. Shared DC bus systems allow one axis to feed regenerated energy to another, eliminating resistors entirely.
// DC bus voltage thresholds — 400 V class drive (typical)
//
// Nominal DC bus: 560 V (400 V × √2 × 1.35 / √3 ≈ 565 V)
// Under-voltage trip: 400 V → mains failure or sag
// Over-voltage warning: 600 V
// Over-voltage trip: 750 V → braking resistor insufficient
// Braking chopper on: 620 V → chopper switches resistor in
// Braking chopper off: 600 V → hysteresis prevents chatter
// Braking resistor sizing:
// P_resistor = 0.5 × J_total × (ω_max² - ω_min²) / t_decel
// where J_total = J_motor + J_load_reflected (kg·m²)
// ω = angular velocity (rad/s)
//
// Example: J=0.05 kg·m², ω_max=314 rad/s (3000 RPM), t_decel=0.5 s
// P = 0.5 × 0.05 × (314² - 0) / 0.5 = 4930 W peak
// → use 5 kW resistor rated for duty cycle
Encoder signals are the most noise-sensitive wiring in a servo system. Rules: always use manufacturer-specified cable (twisted pairs, individually shielded for differential RS-422 signals). Keep encoder cable away from motor power cables by ≥ 100 mm, or use a metallic separator. Ground the shield at the drive end only (single-point ground) for incremental encoders. Connect shield at both ends for absolute serial encoders (BiSS-C, Hiperface, EnDat). Maximum cable lengths: incremental A/B → 50 m at 1 MHz. Always measure actual encoder signal quality with an oscilloscope at the drive terminals during commissioning.
// Incremental encoder wiring — 5 V differential (RS-422)
// Signal pairs: A+/A- B+/B- Z+/Z- (quadrature + index)
// Typical Hirose or D-sub connector on drive
// Wiring check procedure:
// 1. With motor free to rotate by hand, turn shaft slowly
// CW → channel A leads B (A rises before B)
// CCW → channel B leads A
// Wrong phasing → motor will run away on first enable
// 2. Check differential voltage: A+ minus A- must be ±5 V
// If only 0.5 V → single-ended connection (wrong)
// If signal inverted → swap A+ and A- at connector
// 3. Check index pulse Z: one pulse per revolution,
// typically 90° wide. Used for homing.
// 4. Oscilloscope test: at max motor speed,
// count frequency: f = (ppr × RPM) / 60
// At 3000 RPM with 2500 ppr: f = 125 kHz
// Missing pulses → cable fault or EMI issue
Beyond power and encoder, the drive has: digital inputs (enable, reset, limit switches, home sensor), digital outputs (ready, fault, brake control), analogue inputs (±10 V speed/torque reference for legacy systems), pulse/direction input (CNC and stepper-replacement mode), and fieldbus (EtherCAT, PROFINET, CANopen). Safety terminals: STO_A and STO_B (dual-channel, 24 V, connect to safety relay output). Most modern drives also offer SS1, SS2, SOS, SLS as certified safety functions via the safety fieldbus (PROFIsafe, FSoE).
// Drive parameter map — key categories (generic naming)
// Most drives organise parameters in groups:
// GROUP P0 — Identification & Status (read-only)
// P0.001 Drive model / firmware version
// P0.010 DC bus voltage (live)
// P0.011 Output current (live)
// P0.012 Motor speed (live)
// P0.020 Active fault code
// GROUP P1 — Motor Data (set to motor nameplate values)
// P1.001 Rated power (kW)
// P1.002 Rated voltage (V)
// P1.003 Rated current (A)
// P1.004 Rated speed (RPM)
// P1.005 Rated torque (Nm)
// P1.010 Encoder type (0=inc, 1=abs-SSI, 2=EnDat, 3=Hiperface)
// P1.011 Encoder resolution (PPR or bits)
// GROUP P2 — Control Loop Gains
// P2.001 Position Kp (1/s) [position loop P gain]
// P2.002 Velocity Kp (A·s/rad)
// P2.003 Velocity Ki (A/rad)
// P2.004 Velocity Kd (damping)
// P2.010 VFF — velocity feed-forward (%)
// P2.011 AFC — acceleration feed-forward (%)
// P2.020 Notch filter 1 frequency (Hz)
// P2.021 Notch filter 1 bandwidth (Hz)
// GROUP P3 — Limits & Protection
// P3.001 Max speed (RPM)
// P3.002 Max current (A)
// P3.003 Following error limit (counts)
// P3.004 Software limit + (counts)
// P3.005 Software limit - (counts)
Understanding the mathematics behind PID control is not optional for a servo engineer — it is the difference between a system that works and one that vibrates itself apart. This section covers the theory, the practical meaning of each gain, and the exact tuning procedures used in industry.
P (Proportional): output = Kp × error. The motor pushes harder the further it is from target. Too much Kp → oscillation. Too little → slow, lagging response. I (Integral): output += Ki × ∫error·dt. Eliminates steady-state position error (e.g. from gravity on a vertical axis). Too much Ki → integral windup, slow oscillation. D (Derivative): output = Kd × d(error)/dt. Reacts to the rate of change of error — it is a velocity damper. Reduces overshoot. Very sensitive to noise: always pair with a low-pass filter.
// Discrete PID implementation (runs in servo drive DSP)
// Sample time Ts = 0.000125 s (8 kHz velocity loop)
VAR
Kp : REAL := 80.0; // (A·s/rad)
Ki : REAL := 400.0; // (A/rad)
Kd : REAL := 0.002; // (A·s²/rad)
Ts : REAL := 0.000125;
error : REAL; // velocity_setpoint - velocity_actual
error_prev : REAL := 0.0;
integral : REAL := 0.0;
derivative : REAL;
output : REAL; // torque/current command
I_limit : REAL := 19.5; // peak current A
END_VAR
error := velocity_sp - velocity_actual;
// Anti-windup: only integrate when output is not saturated
IF ABS(output) < I_limit THEN
integral := integral + Ki * error * Ts;
END_IF;
derivative := Kd * (error - error_prev) / Ts;
output := Kp * error + integral + derivative;
output := LIMIT(-I_limit, output, I_limit);
error_prev := error;
PID is reactive — it can only correct error after it exists. Feed-forward is proactive — it predicts the required output from the motion command itself. Velocity Feed-Forward (VFF) adds a term proportional to the commanded velocity, reducing velocity tracking lag to near zero. Acceleration Feed-Forward (AFF) adds a term proportional to commanded acceleration, compensating for the inertia of the load. With well-tuned VFF and AFF, the following error during motion drops by 80–95%, and the PID gains only need to handle disturbances.
// Feed-forward terms in velocity loop
VAR
vel_cmd_now : REAL; // Current velocity setpoint (rad/s)
vel_cmd_prev : REAL; // Previous setpoint
accel_cmd : REAL; // Estimated command acceleration
Ts : REAL := 0.000125;
VFF : REAL := 0.95; // 95% velocity FF (tune to 1.0 = perfect)
AFF : REAL := 0.80; // 80% acceleration FF
J_total : REAL := 0.006; // Total reflected inertia kg·m²
Kt : REAL := 0.74; // Motor torque constant Nm/A
ff_torque : REAL;
ff_current : REAL;
END_VAR
accel_cmd := (vel_cmd_now - vel_cmd_prev) / Ts;
// AFF: how much current needed just to accelerate the inertia
ff_torque := AFF * J_total * accel_cmd;
ff_current := ff_torque / Kt;
// VFF: add velocity reference directly to output (bypasses integrator)
// Implemented inside drive: current_cmd += VFF × (vel_cmd / Kv)
// where Kv is the velocity loop gain in current units
// Total output = PID_output + ff_current
// Result: following error during constant-velocity move ≈ 0
Servo engineers analyse loop stability using Bode plots: gain (dB) and phase (°) vs. frequency (Hz). Closed-loop bandwidth is the frequency at which the loop gain drops to -3 dB — it defines how fast the axis responds to commands. Phase margin (should be ≥ 45°) and gain margin (should be ≥ 6 dB) define stability. Mechanical resonances appear as gain peaks — if a resonance peak crosses 0 dB before the loop rolls off, the system oscillates. Notch filters cut these peaks. Most modern drives have an auto-tuning sweep (frequency response analyser) built in that sweeps a chirp signal and plots the open-loop Bode plot automatically.
// Stability margins — what the numbers mean
//
// Phase margin (PM):
// PM ≥ 60°: very stable, sluggish response
// PM = 45°: good balance — industry target
// PM = 30°: marginal — any load change may oscillate
// PM < 20°: unstable in practice
//
// Gain margin (GM):
// GM ≥ 12 dB: very stable
// GM = 6 dB: minimum acceptable
// GM < 6 dB: likely to oscillate on load change
//
// Bandwidth (BW):
// Typical servo velocity BW: 100–500 Hz
// High-performance direct-drive: up to 2000 Hz
// Position loop BW ≈ velocity BW / 10 (rule of thumb)
//
// Notch filter example — suppressing 280 Hz resonance:
// Centre frequency f0 = 280 Hz
// Bandwidth Q = 5 (narrow notch — less phase loss)
// Depth = -20 dB (attenuate resonance by 10×)
// Phase loss at 200 Hz ≈ 3° (acceptable)
// Phase loss at 280 Hz ≈ 90° (at notch, but loop gain = 0 there)
PLCopen Motion Control (IEC 61131-3 Part 4) defines a library of function blocks for controlling servo axes in a PLC-independent way. CiA 402 (DS402) is the drive profile that defines operating modes and state machine in the drive. Together, they form the complete programming model for industrial servo systems.
Every PLCopen axis goes through a defined state sequence before motion is possible: Disabled → StandStill → Homing → DiscreteMotion / ContinuousMotion / SynchronizedMotion. Each state has allowed function blocks. You cannot command motion from the Disabled state — the drive must first be enabled (power applied, STO released, no faults). Understanding this state machine is mandatory — calling MC_MoveAbsolute on a disabled axis does nothing, which is a common beginner mistake.
// PLCopen axis state machine — full sequence
VAR
Axis1 : AXIS_REF; // Axis reference (drive mapped here)
fbPower : MC_Power;
fbHome : MC_Home;
fbMoveAbs : MC_MoveAbsolute;
fbMoveRel : MC_MoveRelative;
fbHalt : MC_Halt;
fbReadStatus: MC_ReadStatus;
fbReadError : MC_ReadAxisError;
fbReset : MC_Reset;
seq_state : INT := 0;
END_VAR
// Step 1: Power on the axis (enable drive)
fbPower(Axis:=Axis1, Enable:=TRUE, EnablePositive:=TRUE, EnableNegative:=TRUE);
// Step 2: Wait for axis to reach StandStill
fbReadStatus(Axis:=Axis1);
CASE seq_state OF
0: // Wait for drive ready
IF fbPower.Status THEN seq_state := 1; END_IF;
1: // Home the axis
fbHome(Axis:=Axis1, Execute:=TRUE, HomingMode:=MC_Direct);
IF fbHome.Done THEN
fbHome(Axis:=Axis1, Execute:=FALSE);
seq_state := 2;
ELSIF fbHome.Error THEN
seq_state := 99;
END_IF;
2: // Move to position 100 mm at 500 mm/s
fbMoveAbs(Axis:=Axis1, Execute:=TRUE,
Position:=100.0,
Velocity:=500.0,
Acceleration:=2000.0,
Deceleration:=2000.0,
Jerk:=10000.0);
IF fbMoveAbs.Done THEN
fbMoveAbs(Axis:=Axis1, Execute:=FALSE);
seq_state := 3;
ELSIF fbMoveAbs.Error THEN
seq_state := 99;
END_IF;
99: // Fault handling
fbReset(Axis:=Axis1, Execute:=TRUE);
IF fbReset.Done THEN
fbReset(Axis:=Axis1, Execute:=FALSE);
seq_state := 0;
END_IF;
END_CASE;
A trapezoidal profile has three phases: constant acceleration, constant velocity, constant deceleration. Simple to calculate but the instantaneous jerk (rate of change of acceleration) is infinite at phase transitions — this excites mechanical resonances and creates vibration. An S-curve (jerk-limited) profile adds a jerk phase at each corner, limiting how quickly acceleration builds. This dramatically reduces vibration in high-speed positioning applications. The trade-off: slightly longer move time. Jerk units are typically mm/s³ or rad/s³.
// S-curve motion profile — jerk-limited trapezoidal
// Parameters for a 200 mm move:
VAR
distance : REAL := 200.0; // mm
v_max : REAL := 1000.0; // mm/s
a_max : REAL := 5000.0; // mm/s²
jerk_max : REAL := 50000.0; // mm/s³
// Calculated phase times:
t_jerk : REAL; // Time to reach a_max from 0
t_accel : REAL; // Constant acceleration phase
t_vel : REAL; // Constant velocity phase
t_total : REAL; // Total move time
v_reached : REAL; // Actual peak velocity (may be < v_max for short moves)
END_VAR
t_jerk := a_max / jerk_max; // = 0.1 s
// Velocity gained during jerk phase:
// v_jerk = 0.5 × a_max × t_jerk = 0.5 × 5000 × 0.1 = 250 mm/s
// Full accel phase only needed if v_max > 2 × v_jerk
// 1000 > 500 → YES, constant-accel phase exists
t_accel := (v_max - 2 * (0.5 * a_max * t_jerk)) / a_max; // = 0.1 s
t_vel := (distance - v_max * (t_jerk + t_accel + t_jerk)) / v_max;
// Verify t_vel > 0; if not, reduce v_max (short-move case)
t_total := 2*(t_jerk + t_accel + t_jerk) + t_vel; // = 0.8 s (approx)
// Compare to trapezoidal: t_total ≈ 0.74 s — S-curve ~8% longer
// Trade-off: vibration reduced by ~60% at mechanical resonance
Electronic gearing (MC_GearIn) locks one axis as a slave to follow a master at a defined ratio without physical gears. Electronic cam (MC_CamIn) uses a lookup table to define a non-linear relationship — essential for rotary cutting, label application, flying shear, and packaging. The cam table maps master position to slave position; the drive interpolates between table points every cycle. The key parameter is the cam table resolution — more points = smoother interpolation but larger data.
// Electronic CAM example — flying shear (servo follows product,
// cuts at product speed, then returns for next cycle)
// Master = conveyor encoder (virtual axis)
// Slave = knife/cut axis
// CAM table: 360° master = one product pitch
// Phase 0–90°: slave accelerates to match product speed
// Phase 90–180°: slave moves WITH product (cut window)
// Phase 180–360°: slave returns home at high speed
VAR
camTable : MC_CAM_REF; // Cam table data structure
fbCamIn : MC_CamIn;
fbCamOut : MC_CamOut;
masterAxis : AXIS_REF; // Encoder/virtual master
slaveAxis : AXIS_REF; // Physical servo axis
syncPhase : REAL := 0.0; // Phase offset for registration
END_VAR
// Engage cam on trigger (e.g. product sensor)
fbCamIn(
Master := masterAxis,
Slave := slaveAxis,
CamTable := camTable,
Execute := trigger_sensor,
MasterScaling := 1.0, // 1:1 master
SlaveScaling := 1.0,
MasterOffset := syncPhase, // Registration correction
MasterStartDistance := 50.0 // Look-ahead: engage 50 mm before cut
);
// Registration correction from vision sensor:
// If product arrives 2 mm early → syncPhase := 2.0 * (360/pitch_mm)
Even perfect hardware fails if the drive parameters are wrong. Commissioning is a structured process — skip a step and you will spend hours chasing mysterious faults. The order matters: motor data first, then encoder verification, then current loop, then velocity loop, then position loop. Always test at reduced speed before full speed.
The commissioning sequence must always follow this order. Each step validates the previous one. Reversing the order or skipping steps is the most common source of servo drive faults during startup.
// COMMISSIONING CHECKLIST — servo axis from scratch
//
// ── STEP 1: Motor data entry ────────────────────────────────
// Enter ALL nameplate values into drive parameter group:
// Rated V, I, RPM, torque, encoder type & PPR
// Set current limit = motor peak current (from datasheet)
// DO NOT set higher — motor winding damage risk
//
// ── STEP 2: Encoder verification (motor free/decoupled) ─────
// Enable drive at zero speed reference
// Rotate shaft by hand 1 full revolution
// Check: position counter increases by exactly 1 × PPR
// If counter decreases: invert encoder direction param
// If counter shows ×4 PPR: encoder in 4× interpolation mode
// If random noise: check cable shielding, differential wiring
//
// ── STEP 3: Current loop auto-tune ──────────────────────────
// Run drive built-in current loop auto-tune (motor stationary)
// This sets bandwidth, dead-time compensation automatically
// Verify: step response — no oscillation, <5 ms settling
//
// ── STEP 4: Velocity loop — start conservative ──────────────
// Set Kp = 20% of auto-tune suggestion
// Command velocity step 100 RPM → measure overshoot
// Increase Kp until 10–15% overshoot, then add Ki
// Target: step 0→rated speed, overshoot <10%, settle <50 ms
//
// ── STEP 5: Position loop ───────────────────────────────────
// Set Kp_pos = velocity_BW (Hz) × 0.3 (conservative start)
// Command 1 mm step, check following error and settling
// Add VFF: increase until following error during ramp ≈ 0
//
// ── STEP 6: Full-speed test with load connected ──────────────
// Repeat steps 4-5 with actual mechanical load
// Inertia changes — re-tune if needed
// Check temperature after 30 min run: motor < Tmax class
In the field without software tools, you can tune by ear and feel. Over-tuned position loop (Kp too high): axis "buzzes" at standstill, audible high-frequency tone, drive current is elevated. Over-tuned velocity loop: axis hisses or squeals during motion. Under-tuned (Kp too low): axis feels "springy" when pushed by hand, returns to position slowly. VFF too low: axis lags on ramp, catches up at target (overshoot on decel). VFF too high: axis leads on ramp, overshoots at target. Use the drive status display to watch following error, current, and speed in real time.
// Fault diagnosis by symptom — field reference
//
// SYMPTOM: Buzzing at standstill
// CAUSE: Position Kp too high, velocity loop excited
// FIX: Reduce position Kp by 20%, or add notch filter
// Check for backlash (axis hunts across deadband)
//
// SYMPTOM: Oscillation at end of move (ringing)
// CAUSE: Low system damping, mechanical resonance
// FIX: Reduce Kp, add Kd, use S-curve (reduce jerk input)
// Add notch filter at resonance frequency
//
// SYMPTOM: Axis overshoots target then hunts
// CAUSE: VFF too high, or Ki causing windup
// FIX: Reduce VFF by 5% steps, implement anti-windup
//
// SYMPTOM: Large following error during high-speed move
// CAUSE: VFF too low, or insufficient peak current
// FIX: Increase VFF toward 100%, check peak current limit
//
// SYMPTOM: Consistent position offset at standstill
// CAUSE: Gravity/friction not compensated, Ki = 0
// FIX: Add small Ki, or use gravity compensation
// (torque offset = J × g × sin(θ) / Kt)
//
// SYMPTOM: Following error fault on fast moves only
// CAUSE: Acceleration/velocity profile exceeds motor capability
// FIX: Reduce max acceleration or increase peak current limit
Modern drives (Siemens S120 SINAMICS, Beckhoff AX5000, Fanuc αi, Yaskawa Sigma 7) have built-in auto-tuning. A frequency response sweep injects a chirp (swept-frequency) signal into the velocity loop, measures the output, and computes the open-loop Bode plot in milliseconds. The algorithm identifies resonances, computes optimal gains for a target bandwidth, and sets notch filters automatically. The user specifies only a "stiffness level" (1–9 or similar). Always validate auto-tune results with a step response test before full-speed production.
// Auto-tune modes in typical servo drive
//
// MODE 1 — Inertia identification only (safe, axis oscillates briefly)
// Duration: 2–5 seconds
// Output: J_load/J_motor ratio
// Use when: unknown load, before manual tuning
//
// MODE 2 — One-button tuning (standard production use)
// Duration: 5–15 seconds
// Output: Kp, Ki, Kd, VFF, notch filters
// Requirements: axis must be free to move ±5 mm or ±5°
// Caution: ensure no mechanical stops in range!
//
// MODE 3 — Advanced frequency sweep (engineering tool)
// Duration: 10–60 seconds
// Output: full Bode plot (gain + phase vs frequency)
// Saved to: drive memory or USB / PC software
// Use: identifying resonances > 50 Hz, diagnosing instability
//
// After auto-tune, ALWAYS verify:
// 1. Step response: command 10% of full travel
// Overshoot < 5%, settling < 3 × move time
// 2. Following error during full-speed move < 0.1 mm
// 3. Current during constant-velocity move < 30% rated
// (should be friction only — not fighting resonance)
// 4. Motor temperature after 1 hour < rated winding class
Servo systems in machines are governed by IEC 61800-5-2 (functional safety for drives), ISO 13849-1 (safety-related control systems), and IEC 62061 (machinery safety). Understanding the fault model and safety architecture is as important as the control theory.
Most servo drive faults fall into five categories: electrical (over-voltage, under-voltage, over-current), thermal (motor over-temperature, drive over-temperature), mechanical (following error exceeded, hardware limit), communication (fieldbus timeout, encoder signal loss), and safety (STO activation, safety watchdog). Fault codes are drive-manufacturer specific, but the root causes are universal.
// Universal servo fault reference
//
// FAULT: Over-current (OC) / Short circuit
// Root cause: motor winding fault (measure phase-to-phase R)
// IGBT failure (drive replacement needed)
// Kp too high causing current saturation
// Motor cable short or phase-to-earth fault
// Field test: disconnect motor, re-enable — fault persists?
// YES → drive fault. NO → motor/cable fault.
//
// FAULT: Over-voltage (OV) on DC bus
// Root cause: braking resistor too small or open-circuit
// Deceleration ramp too short for load inertia
// Regenerative load (e.g. vertical axis going down)
// Fix: increase decel time, add/check braking resistor
//
// FAULT: Following error (F-ERR / Deviation Fault)
// Root cause: mechanical jam, belt broken, brake not released
// VFF too low for the commanded velocity
// Peak current limit too low (motor can\'t keep up)
// Encoder failure (drive sees no movement)
// Field test: manually push axis during fault — does position change?
// YES → encoder OK, mechanical issue.
// NO → encoder wiring fault.
//
// FAULT: Encoder error / Signal loss
// Root cause: cable break (most common — flex cables fatigue)
// Connector corrosion or contamination
// EMI from motor cable (check separation/shielding)
// Fix: check cable continuity; replace cable if flex life exceeded
//
// FAULT: Motor over-temperature (OT)
// Root cause: motor undersized for actual duty cycle
// Blocked motor cooling vents
// Ambient temperature > rated
// Sustained current due to oscillation (tuning fault)
// Prevention: monitor motor thermal model in drive (I²t register)
IEC 61800-5-2 defines six safety functions for drives. STO (Safe Torque Off): removes torque — motor coasts, no movement. SS1 (Safe Stop 1): controlled deceleration then STO at stop. SS2 (Safe Stop 2): controlled deceleration, then holds position in SOS. SOS (Safe Operating Stop): position controlled with drive enabled — motor resists movement. SLS (Safely Limited Speed): monitors that speed never exceeds a threshold — used for maintenance access at low speed. SDI (Safe Direction): prevents motion in one direction. All are dual-channel, monitored, and achieve at minimum SIL 2 / PLd in certified implementations.
// Safety function implementation — Beckhoff TwinSAFE example
// (PROFIsafe / FSoE — Functional Safety over EtherCAT)
VAR
// Safety PLC inputs (SAFEBOOL type)
estop_1 : SAFEBOOL; // E-Stop button channel 1
estop_2 : SAFEBOOL; // E-Stop button channel 2
guard_door : SAFEBOOL; // Guard door interlock
maint_key : SAFEBOOL; // Maintenance mode key switch
// Safety outputs to drive (over FSoE)
cmd_STO : SAFEBOOL; // Safe Torque Off
cmd_SS1 : SAFEBOOL; // Safe Stop 1 (decel + STO)
cmd_SLS : SAFEBOOL; // Safely Limited Speed (maintenance)
cmd_SLS_limit : REAL := 50.0; // RPM limit in SLS mode
// Drive feedback (monitored)
fb_STO_active : SAFEBOOL; // Drive confirms STO state
fb_speed_ok : SAFEBOOL; // Drive confirms within SLS limit
END_VAR
// E-Stop: dual-channel → STO immediately (no decel = dangerous on vertical)
cmd_STO := NOT (estop_1 AND estop_2);
// Guard door open: SS1 (controlled stop) unless already stopped
cmd_SS1 := NOT guard_door AND (axis_speed > 0.1);
// Maintenance mode: guard door open + key → SLS at 50 RPM
cmd_SLS := NOT guard_door AND maint_key;
// Safety PLC monitors fb_STO_active within 200 ms of cmd_STO
// Discrepancy → safety fault, lock-out until manual reset
Key standards every servo engineer must know: IEC 61800-5-2 (2016) — functional safety for drives, defines STO/SS1/SS2/SOS/SLS/SDI safety functions and PFH values. ISO 13849-1 (2015) — Performance Levels PLa–PLe for safety-related control systems. IEC 62061 (2021) — SIL-based safety for machinery control systems. IEC 61131-3 (2013) — PLC programming languages including Structured Text used for motion. IEC 61800-7-201/203 (CiA 402, PROFIDRIVE) — drive profiles for fieldbus control. EN ISO 10218-1/2 — robot safety (applicable to servo-driven robot axes).
// Safety integrity quick-reference
//
// Function Min. Architecture PFH range (per hour)
// STO single axis Cat.3 / PLd 10⁻⁷ ≥ PFH > 10⁻⁶
// SS1 Cat.3 / PLd 10⁻⁷ ≥ PFH > 10⁻⁶
// SLS (maintenance) Cat.2 / PLc 10⁻⁶ ≥ PFH > 10⁻⁵
// E-Stop (cat.0) Cat.3 / PLd 10⁻⁷ ≥ PFH > 10⁻⁶
// Guard interlock Cat.3 / PLd 10⁻⁷ ≥ PFH > 10⁻⁶
//
// To achieve PLd Cat.3 on an E-Stop:
// - 2× NC contacts (dual channel) on button
// - Safety relay or safety PLC monitors both channels
// - Cross-fault detection (detects one channel shorted)
// - Proof-test interval ≤ 20 years (for B10d components)
// - MTTFD (Mean Time To Dangerous Failure): HIGH
// Use certified safety components with published B10d values
//
// Document: Safety Function Assessment Report per ISO 13849-1
// Must include: block diagram, component MTTFd, CCF score,
// achieved PL, required PL from risk assessment (ISO 12100)
From encoder maths to safety functions — all topics covered. Each answer reveals a detailed technical explanation.
A servo motor encoder reads 4096 counts/revolution and the load is connected via a 1:5 gearbox. How many encoder counts correspond to 1 mm of linear travel on a 5 mm pitch ball-screw?
During commissioning you increase the position-loop P gain (Kp). The axis starts to oscillate at the target position. What is the correct next action?
What does "STO" (Safe Torque Off) do on a servo drive, and what does it NOT do?
A servo axis following error (actual position - commanded position) is growing larger during a high-speed move. What is the most likely cause?
What is the purpose of a "notch filter" in a servo drive's velocity loop?
You command a servo to move 100 mm. The actual position after the move is consistently 98.5 mm. This is most likely caused by:
A servo motor is rated 400 V, 5 A continuous, 15 A peak (stall). Your application requires 14 A for 500 ms during acceleration, then drops to 3 A. Is this acceptable?
In EtherCAT/CiA 402, what is the "Cyclic Synchronous Position" (CSP) mode?
What is the inertia ratio, and why does it matter for servo tuning?
A servo axis has a holding brake. When should the brake be released and applied relative to the drive enable signal?