Servo Tuning: Using Bode Plots for Stability Analysis
Servo Tuning: Using Bode Plots for Stability Analysis
Introduction
You’ve just powered up a servo system, sent a position command, and the axis shoots past the target, oscillates wildly, and triggers a following error fault. Classic symptoms of poor tuning. Servo tuning is both art and science, and the Bode plot is your most powerful diagnostic tool for understanding stability, bandwidth, and robustness.
This post is for motion control engineers tuning servo systems for packaging machines, CNC equipment, robotics, or any application requiring precise position control. We’ll cover frequency response fundamentals, gain and phase margin interpretation, and a systematic tuning workflow using Bode plots.
By the end, you’ll know how to diagnose underdamped, overdamped, or unstable systems and adjust your PI(D) controller gains for optimal performance.
Theory
Servo Control Architecture
A typical servo drive uses cascaded control loops:
- Current loop (innermost, fastest) — Controls motor torque
- Velocity loop — Controls motor speed
- Position loop (outermost, slowest) — Controls shaft position
Each loop has PI or PID compensators. Tuning proceeds from inner to outer: tune current, then velocity, then position.
What is a Bode Plot?
A Bode plot consists of two graphs:
- Magnitude plot: Gain (in dB) vs. frequency (log scale)
- Phase plot: Phase angle (in degrees) vs. frequency
The Bode plot reveals:
- Gain crossover frequency : Frequency where gain = 0 dB (where )
- Phase margin (PM): How much phase is left before -180° at
- Gain margin (GM): How much gain can increase before instability
Stability Criteria
From classical control theory:
- Phase margin > 45°: Good stability, acceptable overshoot
- Phase margin 30-45°: Marginal, some overshoot expected
- Phase margin < 30°: Likely oscillatory or unstable
Rule of thumb: Target PM = 50-60° for smooth motion.
Key Tradeoffs
- Higher bandwidth: Faster response, better disturbance rejection, but more noise sensitivity
- Lower bandwidth: More filtering, less noise, but slower tracking and potential following errors
- Increasing : Raises bandwidth but reduces phase margin (can cause instability)
Math
Open-Loop Transfer Function
For a position loop with PI velocity controller and inertia :
where:
- = proportional gain (velocity loop)
- = integral gain (velocity loop)
- = moment of inertia
Gain Crossover Frequency
The gain crossover occurs when:
For a PI controller, this simplifies to finding where:
Phase Margin
Phase margin is:
For the PI controller, phase at is:
Thus:
This is overly simplified (ignores integral effects), but illustrates the concept. In practice, use software (MATLAB, Python Control) or drive tools to plot the actual Bode response.
Damping Ratio and Phase Margin Relationship
Approximate relationship between phase margin and damping ratio :
Example: PM = 50° → (slightly underdamped, ~15% overshoot)
Flow Diagrams
flowchart TD
A[Start Tuning] --> B[Tune Current Loop First]
B --> C[Enable Velocity Loop]
C --> D[Set Low Kp, Ki]
D --> E[Run Frequency Sweep]
E --> F[Generate Bode Plot]
F --> G{Phase Margin > 45°?}
G -->|No| H[Reduce Kp or Ki]
H --> E
G -->|Yes| I{Gain Crossover at Target BW?}
I -->|No| J[Increase Kp Proportionally]
J --> E
I -->|Yes| K[Test Step Response]
K --> L{Overshoot < 10%?}
L -->|No| M[Reduce Kp by 10-20%]
M --> E
L -->|Yes| N[Enable Position Loop]
N --> O[Repeat for Position Gains]
O --> P[Validate Under Load]
P --> Q[End]
style F fill:#e1f5ff
style K fill:#ffe1e1
style Q fill:#e1ffe1
This state machine shows the iterative tuning process using Bode plot feedback.
Real Scenario Use
Tuning a Rotary Servo for a Packaging Machine
System Specs:
- Motor: 2.4 kW rotary servo with 2500-line incremental encoder
- Load inertia (reflected to motor):
- Drive: Kollmorgen AKD with built-in Bode plot tool
- Target bandwidth: 50 Hz (314 rad/s)
- Application: Intermittent motion, 200 mm index, 0.1s settle time
Step 1: Tune Current Loop (Already Done by Drive)
Modern drives auto-tune the current loop. Verify bandwidth ≈ 1 kHz (inner loop should be 10x faster than velocity loop).
Step 2: Start with Conservative Velocity Loop Gains
Set initial values:
- (proportional gain)
- (integral gain)
Step 3: Run Frequency Sweep
Use drive’s built-in frequency response tool:
- Set sweep range: 1 Hz to 500 Hz
- Inject sinusoidal velocity command
- Measure velocity feedback response
- Plot magnitude and phase
Step 4: Analyze Bode Plot (Initial)
- Gain crossover: 20 Hz (too low, target is 50 Hz)
- Phase margin: 65° (good, but bandwidth too low)
Step 5: Increase Bandwidth
Increase to raise crossover frequency:
Set , keep .
Rerun sweep.
Step 6: Analyze Bode Plot (After Adjustment)
- Gain crossover: 48 Hz (close to target)
- Phase margin: 52° (acceptable)
Step 7: Test Step Response
- Command a velocity step: 0 → 500 RPM
- Measure on scope or drive readback:
- Rise time: ~10 ms
- Overshoot: 8%
- No oscillations
Step 8: Enable Position Loop
Now tune the position loop (outermost). Use position proportional gain :
(Position loop bandwidth typically 1/5 to 1/10 of velocity loop)
Step 9: Final Validation
Run a 200 mm index move:
- Target settle time: <0.1s
- Following error during move: <0.5mm
- Final position accuracy: ±0.05mm
Adjust if needed.
Related Reading
- Field-Oriented Control: Current Loop Fundamentals and PI Tuning — Deep dive into the innermost control loop
- VFD Commissioning: A Practical Checklist for Induction Motors — Contrasts open-loop with closed-loop control
- Coming soon: “Resonance Suppression in Servo Systems: Notch Filters and Biquad Tuning”
References
- Franklin, G. F., Powell, J. D., & Emami-Naeini, A. (2019). Feedback Control of Dynamic Systems (8th ed.). Pearson. Chapter 6: The Frequency-Response Design Method.
- Kollmorgen AKD User Manual — Section 8.3: Auto-Tuning and Bode Plot Analysis
- Rockwell Automation Publication 2198-RM002 — Kinetix 5700 Servo Drives User Manual, Chapter 5: Tuning
- IEEE Control Systems Magazine (2015) — “Practical PID Tuning Using Bode Plots” by Karl Åström
- Dorf, R. C., & Bishop, R. H. (2016). Modern Control Systems (13th ed.). Pearson. Chapter 9: Frequency Response Methods.
Videos
- Brian Douglas - “Gain and Phase Margins Explained” — Excellent intuition builder
- MATLAB Tech Talk - “Understanding Bode Plots” — Part of Control Systems series
Summary + Key Takeaways
- Bode plots reveal stability through gain and phase margins
- Phase margin > 45° ensures good stability with acceptable overshoot
- Gain crossover frequency sets the effective bandwidth of the control loop
- Always tune from inner to outer: current, then velocity, then position
- Increasing raises bandwidth but reduces phase margin—balance is key
- Use frequency sweeps built into modern servo drives for real-time Bode analysis
- Validate with step response tests: Check rise time, overshoot, and settling time
- Target damping ratio (PM ≈ 50-60°) for smooth motion
Glossary
- Bode plot: Frequency domain plot showing magnitude (gain) and phase vs. frequency
- Gain crossover frequency: Frequency where open-loop gain = 0 dB (unity gain)
- Phase margin: Difference between phase at gain crossover and -180°; measures stability
- Gain margin: Amount of gain increase before system becomes unstable
- Bandwidth: Frequency range over which the system responds effectively (typically at -3 dB point)
- Underdamped: System with overshoot and ringing (damping ratio )
- Overdamped: Sluggish system with no overshoot (damping ratio )
- Crossover frequency : Same as gain crossover frequency, point where
FAQ
Q: What’s the difference between gain margin and phase margin?
A: Phase margin measures how much additional phase lag the system can tolerate before becoming unstable—it’s the difference between the actual phase at the gain crossover frequency (where magnitude = 0 dB) and -180°. For example, if phase is -135° at gain crossover, the phase margin is 45°. A phase margin of 45-60° indicates good stability with reasonable damping. Gain margin measures how much the loop gain can increase before the system becomes unstable—it’s the difference (in dB) between the actual magnitude at the phase crossover frequency (where phase = -180°) and 0 dB. For example, if magnitude is -10 dB when phase is -180°, the gain margin is 10 dB. Both margins are complementary indicators of stability robustness: phase margin primarily affects damping and overshoot, while gain margin indicates how tolerant the system is to gain variations from nonlinearities, temperature changes, or aging components.
Q: Why tune current loop first?
A: The current loop is the innermost and fastest loop in a cascaded servo control architecture (current → velocity → position) with the highest bandwidth (typically 100-1000 Hz). Its dynamic response directly affects the performance of all outer loops because velocity and position controllers command current references, not motor voltages. If the current loop is unstable, poorly damped, or has inadequate bandwidth, the outer loops cannot compensate and will exhibit unpredictable behavior like oscillation, overshoot, or limit cycles. Additionally, the current loop bandwidth sets an upper limit on the achievable velocity loop bandwidth (velocity loop BW should be 5-10x lower than current loop BW to maintain cascaded control stability). Starting with the current loop ensures you have a fast, stable foundation before adding the complexity of velocity and position feedback and feedforward terms.
Q: Can I tune without a Bode plot?
A: Yes, you can use time-domain step response tuning methods like Ziegler-Nichols, Cohen-Coon, or iterative manual tuning by adjusting gains while observing overshoot, settling time, and rise time. These methods are practical for simple systems and don’t require specialized equipment beyond a scope or trend plot. However, Bode plots provide significantly better insight into frequency-dependent behavior that’s invisible in step response tests: mechanical resonances (sharp peaks in magnitude), phase lag from computational delays or filtering, gain peaking that indicates insufficient damping, and noise sensitivity at high frequencies. Bode plots allow you to see exactly where and why stability margins are insufficient and how to adjust gains or add compensators (notch filters, lead-lag, low-pass filters) to improve performance. For high-performance servo systems with complex mechanical dynamics, Bode plots are essential.
Q: What if I see a resonance peak in the Bode plot?
A: A sharp resonance peak in the open-loop Bode plot indicates a mechanical resonance from flexible coupling compliance, belt drive dynamics, gearbox backlash, or structural flexing of the machine frame. This resonance can be excited by the control loop, causing sustained oscillation (limit cycle) or acoustic noise. The best fix is to address the root cause mechanically: increase coupling stiffness, pre-tension belts, replace worn gearboxes, or stiffen the machine structure with additional support brackets. If mechanical changes aren’t feasible, use a notch filter (also called band-stop filter) tuned to the resonance frequency to attenuate gain at that frequency without affecting overall loop bandwidth. Most modern servo drives have built-in configurable notch filters with adjustable frequency, depth, and Q-factor. Apply the notch filter carefully—it adds phase lag which reduces phase margin at other frequencies—and always verify stability margins after applying the filter.
Q: How do I know my target bandwidth?
A: Target bandwidth depends on your application’s performance requirements: faster settling time and response to disturbances requires higher bandwidth, but higher bandwidth also amplifies noise and is limited by mechanical resonances and computational delays. A common rule of thumb for cascaded control is to set velocity loop bandwidth to 5-10x the position loop bandwidth (to ensure the velocity loop appears “fast” to the position loop and doesn’t introduce significant phase lag), and current loop bandwidth to 10x the velocity loop bandwidth. For typical industrial servo applications, position loop bandwidth is 5-20 Hz (settling time ~50-200 ms), velocity loop bandwidth is 50-200 Hz, and current loop bandwidth is 500-2000 Hz. High-speed packaging machines or semiconductor pick-and-place may push position loop to 40-50 Hz. Always verify that your achieved bandwidth doesn’t excite mechanical resonances and maintains adequate stability margins (PM >45°, GM >6 dB).