PID Motion Control Equations for CNC and Servo Systems

PID Motion control equations visualized on screen with servo motor & real-time response curves in industrial automation setup

Understanding PID Motion Control in Real Industrial Applications

Author: Mehdi Hasanzade | Radonix Automation Company

Precise motion control in servo systems, CNC machines, PLC-based automation, and MCU/DSP platforms relies fundamentally on PID control. While advanced strategies such as feedforward, resonance suppression, and trajectory shaping improve performance, PID remains the mathematical backbone of industrial motion loops.

This article presents complete PID motion control equations used in industrial servo and CNC systems, including continuous, Laplace-domain, digital, filtered-derivative, and anti-windup implementations

What PID Means in Motion Control

In motion control, the controller continuously evaluates:

  • Current position or velocity
  • Target reference (setpoint)
  • The difference between them (error)

Error definition:

e(t) = r(t) − y(t)

The controller output (torque, current, or voltage command) is calculated to minimize this error.

Proportional Term (P) – Immediate Reaction

The proportional component responds to present error:

uP(t) = Kp · e(t)

Higher Kp → stronger corrective action.
Excessive Kp → oscillation risk.

In motion systems, Kp behaves similarly to stiffness: increasing Kp makes the axis hold position more aggressively.

Integral Term (I) – Eliminating Steady-State Error

Integral action accumulates error over time:

uI(t) = Ki · ∫ e(t) dt

It compensates for:

  • Friction
  • Constant load
  • Backlash
  • Calibration offsets
  • Torque limits

Risk: Windup occurs if actuator saturation prevents output growth while integral continues accumulating.

Derivative Term (D) – Predictive Damping

Derivative reacts to the rate of change of error:

uD(t) = Kd · d e(t) / dt

Advantages:

  • Reduces overshoot
  • Increases damping

Limitation: Sensitive to encoder noise; therefore filtered derivative is required in industrial systems.

Full Continuous-Time PID Equation

u(t) = Kp·e(t) + Ki∫e(t)dt + Kd·d e(t)/dt

PID in Laplace Domain (Analysis and Design)

Controller transfer function:

C(s) = Kp + Ki/s + Kd·s

Alternative time-constant form:

C(s) = Kp · (1 + 1/(Ti·s) + Td·s)

Where:

Ki = Kp/Ti
Kd = Kp·Td

Filtered Derivative (Industrial Servo Implementation)

Pure derivative amplifies noise. Practical implementation:

CD(s) = (Kd·s) / (1 + s/ωf)

Where:

ωf = derivative cutoff frequency (rad/s)

Higher ωf → sharper response but more noise sensitivity.

Digital (Discrete) PID for PLC / MCU / CNC

Sampling time: Ts

Position Form

u[k] = Kp·e[k] + Ki·Ts·Σe[k] + Kd·(e[k] − e[k−1]) / Ts

Incremental Form

Δu[k] = Kp·(e[k] − e[k−1]) + Ki·Ts·e[k] + (Kd/Ts)·(e[k] − 2e[k−1] + e[k−2])

Anti-Windup in Motion Control

If actuator saturates:

u = sat(u_raw)

Integral must be limited.

Clamping Method

Stop integrating when saturation increases error.

Back-Calculation Method (Continuous)

dI/dt = Ki·e(t) + Kaw·(u − u_raw)

Back-Calculation (Discrete)

I[k] = I[k−1] + Ki·Ts·e[k] + Kaw·Ts·(u[k] − u_raw[k])

PID for Axis Position Control (Mechanical Model)

Mechanical axis dynamics:

τ = J·ω_dot + B·ω

Where:

J = inertia
B = viscous friction

And since:

ω = dx/dt

The system becomes second order. Therefore cascaded loops are preferred in servo drives:

  • Current/Torque loop (fastest)
  • Velocity loop
  • Position loop (slowest)

Practical PID Tuning Notes

  • Use derivative on measurement to avoid derivative kick
  • Always implement anti-windup
  • Reduce Ki if overshoot persists
  • Increase damping before aggressively increasing Kp
  • Combine PID with feedforward and resonance filters for optimal CNC performance

Key Formula Checklist

Continuous PID:

u(t) = Kp·e(t) + Ki∫e(t)dt + Kd·d e(t)/dt

Laplace Form:

C(s) = Kp + Ki/s + Kd·s

Filtered Derivative:

CD(s) = (Kd·s) / (1 + s/ωf)

Incremental Digital Form:

Δu[k] = Kp·(e[k] − e[k−1]) + Ki·Ts·e[k] + (Kd/Ts)·(e[k] − 2e[k−1] + e[k−2])

Anti-Windup Back-Calculation:

I[k] = I[k−1] + Ki·Ts·e[k] + Kaw·Ts·(u[k] − u_raw[k])


Modern industrial motion control requires deterministic execution, numerical stability in discrete implementation, and proper encoder noise filtering. PID remains the structural foundation of servo loops, but its effectiveness depends on architecture, filtering, and saturation management.

For advanced servo architecture or industrial CNC motion integration, contact Radonix or use the chatbot in the bottom right corner.