Motor Control Tools

Current Loop PI Tuning

Derive Kp and Ki gains for a current controller using pole-zero cancellation and a target bandwidth.

Ω
mH
mH
Hz
Bandwidth unit
Hz

These values are initial engineering estimates and must be validated on the actual inverter/motor system.

Bandwidth1000Hz
PWM / bandwidth ratio20:1

D-axis gains

Kp_d0.94248V/A
Ki_d1256.63706V/(A·s)

Q-axis gains

Kp_q1.5708V/A
Ki_q1256.63706V/(A·s)

Tuning methodology

Pole-zero cancellation on the first-order RL plant

G(s) = 1 / (Rs + s·L) Kp = ωc · L Ki = ωc · Rs

Rs
Stator phase resistance (same for both axes) [Ω]
L
Axis inductance — Ld for the d-axis loop, Lq for the q-axis loop [H]
ωc
Target closed-loop bandwidth [rad/s]

Choosing Ki/Kp = Rs/L cancels the plant pole exactly, leaving a first-order closed loop with bandwidth ωc = Kp/L. Applied per axis with that axis's own inductance and the same Rs for both — this is a continuous-time result with no discrete-controller scaling folded in.

Firmware implementation is a separate step

The Kp/Ki values above are the continuous-time analog result. Deploying them in firmware typically requires additional, separate work this calculator does not perform:

  • Discretization — converting the continuous PI controller to a discrete-time form (e.g. Tustin/bilinear or forward Euler) at your actual current-loop sample rate.
  • Sample-time consideration — the PWM/bandwidth ratio warnings on this page assume the loop update rate keeps pace with ωc; a slower control-loop update rate than the PWM rate needs its own margin check.
  • Fixed-point scaling — Q-format or integer scaling of Kp/Ki for MCUs without hardware floating point.
  • Controller-specific normalization — many motor-control firmware stacks (e.g. per-unit systems, duty-cycle-normalized gains) expect Kp/Ki in a scaled or normalized form rather than raw V/A and V/(A·s).

Worked example

Rs = 0.2 Ω, Ld = 0.15 mH, Lq = 0.25 mH, target bandwidth = 1000 Hz, PWM = 20 kHz (ratio 20:1, comfortably under PWM/10):

  • ωc = 2π × 1000 ≈ 6283 rad/s
  • Kp_d = 6283 × 0.00015 ≈ 0.943 V/A, Ki_d = 6283 × 0.2 ≈ 1257 V/(A·s)
  • Kp_q = 6283 × 0.00025 ≈ 1.571 V/A, Ki_q = Ki_d ≈ 1257 V/(A·s)