After Part 2 we can command torque with a single DC number, Iq. But commanding isn't controlling. Push voltage at a motor winding and the current that flows depends on the winding's resistance, its inductance, and whatever the rotor is doing. To actually hold Iq at a target, you need feedback.

A winding is just an R and an L

Electrically, one motor phase is a resistor R in series with an inductor L. Apply voltage v and the current obeys one tidy equation:

L · di/dt = v − R · i

The inductor resists sudden change, so current can't jump — it ramps. Our job is to choose v every control tick so i chases the target. That chooser is a PI controller: a proportional term that pushes harder the further off you are, plus an integral term that mops up the last little steady error.

One knob to tune them: bandwidth

PI controllers have two gains, Kp and Ki, and tuning them by feel is tedious and error-prone. The cleaner approach — the one the MMC uses — is to pick a single number, the bandwidth (how fast you want the loop to respond, in rad/s), and let the motor's own R and L set the gains:

Kp = bandwidth · L
Ki = bandwidth · R

That choice cancels the winding's natural time constant and leaves a clean first-order response with time constant 1 / bandwidth. Turn the bandwidth up and the motor snaps to target faster — until it runs out of bus voltage. Try it:

Current step response

Command: step Iq from 0 to 1 A (locked rotor)
Kp (V/A)1.20
Ki (V/A·s)2000
Rise 10–90%1.10 ms
Overshoot0.0%
Grounded in hardware

Those defaults — R ≈ 1 Ω, a 24 V bus, 2000 rad/s bandwidth — are the real bring-up numbers from Rhobic's STM32G474 drive. Its locked-rotor step lands at about a 1 ms rise with zero overshoot, and this loop runs 20,000 times a second inside the ADC interrupt. The curve above is the same design math, live.

Push it until the supply runs out

Raise the bandwidth and the rise time shrinks — feedback buys speed until the supply voltage runs out. Now drag the bus voltage down (try a high bandwidth first). Below some point the controller demands more volts than the supply can give; the trace flattens into a straight ramp and the rise time balloons — the loop is voltage-limited, no longer bandwidth-limited. Notice the overshoot readout stays near zero anyway: that's anti-windup doing its job (it's modeled here). Without it, the integral term would keep winding up while the supply is pinned, then slam past the target the moment it catches up. Saturation is physics; the clean recovery is design.

This is the innermost loop of the whole machine. Wrap a speed loop around it and you command RPM; wrap a position loop around that and you command angle — which is where robotics begins. Same pattern, each layer trusting the one inside it.

Next up

Everything so far assumed we know the rotor angle θ — Part 2's whole trick depends on it. But cheap, rugged motors ship with no position sensor at all. In Part 4 we estimate the rotor angle from nothing but the voltages and currents we already have, using a flux observer and a PLL. Sensorless control: coming soon.