← all lessons
Motors, Actuators & FOC · #40 of 48

FOC, Current Sensing & Thermals

Riding the Rotor so AC Looks Like DC

A robot finger has to close on an egg without cracking it and on a wrench without slipping. That is a torque problem, and torque in a brushless motor is just current in the right winding at the right instant. But the windings are three phases of sliding sine waves, each one zero-crossing sixty times a turn, so the “right current” is a moving target that never holds still long enough for a simple controller to grab it. Chase those sine waves directly and you will always be a beat behind the rotor.

The trick is to stop chasing. Climb onto the rotor and ride along, and the spinning AC currents freeze into steady DC you can control like a battery.

Field-oriented control (FOC) is the change of viewpoint that makes that ride possible. It is two coordinate transforms stacked back to back: one that flattens three phases into two, and one that spins those two to follow the rotor. The whole method rests on an ordering rule. You measure currents in the messy spinning frame, transform into the calm rotor frame to think and control, then transform back out to drive the inverter. Get the order right and an intimidating time-varying machine becomes two DC knobs.

By the end, you can

  1. Explain how the Clarke and Park transforms turn three AC phase currents into steady DC Id and Iq
  2. Justify holding Id ≈ 0 and using Iq to set torque on a surface-PM motor
  3. Choose a current-sense topology (low-side shunt, in-line shunt, or Hall) for a given drive
  4. Calculate the temperature-rise budget that separates a motor's continuous torque from its peak torque

Intuition first

Picture a carousel with three horses spaced evenly around the ring, and you are standing on the ground watching one particular horse. From where you stand it rises and falls, swings left, swings right, never sits still. Trying to describe its motion from the ground takes a fistful of time-varying equations, because the horse is doing two things at once: going around, and bobbing up and down.

Now step onto the carousel and walk to stand right next to that horse. The going-around part vanishes, because you are going around with it. All that is left is the gentle bob, and that you can describe with a single number that barely changes. You did not slow the carousel down. You changed your reference frame so the fast, confusing motion became invisible and the slow, useful part stood out.

That is exactly what FOC does to motor currents. From the stationary stator, the three phase currents are spinning sinusoids. Ride along with the rotor and they collapse into two steady values: one that points along the rotor’s magnet (the d, or direct, axis) and one that points ninety degrees ahead of it (the q, or quadrature, axis). On the q axis, current pushes the rotor forward, so IqI_q is torque. On the d axis, current just fights or reinforces the magnet’s own flux and makes no torque at all, so for a plain magnet motor you want IdI_d to be zero. Two DC knobs: one for torque, one you leave parked at zero.

Two transforms, three phases to two DC values

The phase currents you actually measure, iai_a, ibi_b, ici_c, are three sine waves spaced by a third of a turn. In a balanced motor they sum to zero at every instant, which is the quiet secret that lets the whole scheme work with only two sensors: if ia+ib+ic=0i_a + i_b + i_c = 0, then knowing any two gives you the third for free.

The Clarke transform is the first step. It projects the three phase currents onto two fixed axes, called α\alpha and β\beta, that sit in the plane of the motor and do not rotate. Three numbers become two, with no information lost as long as the currents are balanced:

iα=ia,iβ=13(ibic)i_\alpha = i_a, \qquad i_\beta = \frac{1}{\sqrt{3}}\left(i_b - i_c\right)

The αβ\alpha\beta currents are still AC. They trace a circle as the rotor turns, because the axes themselves are bolted to the stationary stator. You have flattened three phases into two, but you have not yet stopped the spinning.

The Park transform is the second step, and it is the one that does the riding. It takes the stationary αβ\alpha\beta vector and rotates it by the rotor’s electrical angle θ\theta, into a frame that turns with the rotor. That frame’s two axes are dd and qq:

id=iαcosθ+iβsinθiq=iαsinθ+iβcosθ\begin{aligned} i_d &= \phantom{-}i_\alpha \cos\theta + i_\beta \sin\theta \\ i_q &= -i_\alpha \sin\theta + i_\beta \cos\theta \end{aligned}

Because the frame spins at exactly the same rate as the current vector, the rotation cancels the spin. What was a circling AC vector becomes a stationary point. IdI_d and IqI_q stop oscillating and hold steady as DC, and now an ordinary proportional-integral loop, the same humble controller you would point at a heater or a battery charger, can regulate them. That is the entire payoff: the Park transform converts the machine from a time-varying problem into a linear time-invariant one you already know how to control.

Once you have computed the voltages you want in the dqdq frame, you run the whole chain backward (inverse Park, then inverse Clarke, usually folded into space-vector PWM) to get the three duty cycles the inverter drives onto the phases. Forward to think, backward to act.

Field-oriented control loop: a current setpoint drives PI controllers, then inverse Park and inverse Clarke / SVPWM modulate a three-phase inverter and motor; phase-current shunts feed Clarke and Park (rotated by encoder angle theta) back to the controllers as measured Id and Iq, with Iq setting torque and Id near zero for a surface-PM motor. Setpoint Id* = 0Iq* = torque PI current controllers(d & q axes) Inverse ParkVd,Vq → Vα,Vβ Inv Clarke + SVPWMVα,Vβ → duties 3-phase inverter(6 switches) Motor PMSM / BLDC Phase-current sense (shunts)ia, ib, ic Clarke ia,ib,ic→ iα, iβ Park iα,iβ → Id,Iquses θ Id, Iq measured encoder θ angle Iq sets torque Id ≈ 0 (surface-PM) θ = rotor angle
FOC turns three phase currents into a clean two-axis problem. Park (rotated by the encoder angle θ) makes the q-axis current set torque while the d-axis current is held near zero on a surface-PM motor; the controllers act on those steady DC quantities, then inverse Park and SVPWM map back to the three phases the inverter drives.

The one ingredient both Park transforms need, forward and inverse, is the rotor angle θ\theta. There is no riding the rotor if you do not know where the rotor is. That angle comes from an encoder or Hall sensors bolted to the shaft, or from a sensorless estimator that infers position from the back-EMF the spinning magnets induce in the undriven windings. Feed FOC the wrong angle and the Park rotation lands in the wrong frame: torque you meant for IqI_q leaks into IdI_d, the motor wastes current making heat instead of force, and in the limit it stalls or runs backward.

Portrait of Edith Clarke
Edith Clarke · 1883-1959 The first woman employed as an electrical engineer in the US, and the first female EE professor. Her Clarke transform collapses three coupled phase quantities into a clean two-axis (alpha-beta) frame, the first projection in every FOC loop and the step that makes the spinning currents tractable to compute. read more →
Portrait of Robert H. Park
Robert H. Park · 1902-1994 His 1929 two-reaction theory introduced the Park transform, the rotating-frame rotation that rides along with the rotor so a synchronous machine's oscillating currents become steady DC. A survey ranked his paper second most influential in twentieth-century power engineering; it is the heart of how a microcontroller drives a brushless motor. read more →

Sensing the current you mean to control

FOC controls current, so FOC is only as good as your current measurement. Three topologies dominate, and each trades cost against where in the circuit it can listen.

A low-side shunt is a small precise resistor between each phase’s bottom switch and ground. It is cheap and its measurement node sits near ground, which keeps the amplifier simple, but you can only read a phase’s current while that phase’s low-side switch is on. At high duty cycle the conduction window shrinks and you have to sample in a narrow slice of each PWM period, sometimes too narrow to trust.

An in-line shunt sits in series with the phase wire itself, so it reads that phase’s current continuously regardless of switch state. The catch is that the shunt now floats at the phase voltage, which swings up to the full bus rail and back many thousands of times a second. Reading a few millivolts across the shunt while its whole reference is slamming between zero and the rail is exactly the job of a differential amplifier with strong common-mode rejection (the current-sense amp you met in lesson 27): it subtracts away the giant common-mode swing and keeps only the tiny differential signal you care about.

A Hall-effect current sensor takes a different path entirely: it measures the magnetic field the phase current creates rather than a voltage across a resistor. That gives you galvanic isolation (the sensor never touches the high-voltage node) and no ohmic loss in the path, at the cost of more drift and noise and a higher price. It is the natural choice when the bus voltage is dangerous to probe directly or when the phase current is too large to dump into a shunt without cooking it.

Whichever you pick, the sensed voltage is tiny and the measurement window is short, so the front end matters: an amplifier with enough bandwidth to settle inside the sample window, and an ADC (lesson 10) triggered in lockstep with the PWM so you sample the current at the same point in every cycle. A current loop fed by a noisy or mistimed sample will hunt and buzz no matter how elegant the transforms upstream are.

Heat sets the real torque limit

The transforms tell you what current to push. Thermals tell you how much current you are allowed to push, and for how long. Every amp you send into a winding does two jobs: it makes torque, and it makes heat. The heat is unavoidable, and it is what ultimately caps the motor.

The dominant loss is copper loss, the power burned in the winding resistance, which grows as the square of current:

Pcopper=I2RP_{\text{copper}} = I^2 R

That square is the whole story of continuous versus peak torque. Double the current and you double the torque, but you quadruple the heat. On top of copper loss sit iron loss (hysteresis and eddy currents in the core, which grow with speed and flux) and switching loss in the inverter MOSFETs (energy lost every time a switch turns on or off, which grows with PWM frequency). Total loss is roughly

PlossI2R+Piron+PswitchingP_{\text{loss}} \approx I^2 R + P_{\text{iron}} + P_{\text{switching}}

All of that power has nowhere to go but into the motor’s mass, raising its temperature until heat flows out to the surroundings as fast as it is generated. In steady state the rise above ambient is the loss times the thermal resistance from winding to air:

ΔT=PlossRθ\Delta T = P_{\text{loss}} \cdot R_{\theta}

The winding insulation and the magnets have a temperature they must not exceed (too hot and the insulation breaks down or the magnets lose strength permanently). That ceiling, divided back through RθR_\theta, sets the continuous current the motor can sustain forever. Above it, the motor is still happy for a while, because its thermal mass takes time to heat up. That window is the peak torque: a robot finger can slam shut with a current it could never hold, as long as it backs off before the winding cooks. Continuous torque is what you can do all day; peak torque is what you can do for a second. The gap between them is entirely a thermal story, written by the I2RI^2 R term and the clock.

See it / Try it

The widget below runs the Clarke and Park transforms on three balanced phase currents in real time. The left side shows the spinning currents; the right side shows what IdI_d and IqI_q look like once you ride into the rotor frame. The speed slider sets how fast the rotor turns. The theta offset slider deliberately misaligns the Park rotation, the way a miscalibrated encoder or a bad sensorless estimate would, so you can watch the control frame drift away from the rotor.

Aligned (offset 0): id sits near zero and iq rides flat as DC. Add an offset and the rotor estimate is wrong, so torque current bleeds out of iq and into id.

Start with the offset at zero. Notice that IqI_q rides flat as a clean DC line and IdI_d sits near zero: that is FOC working, all the current going into torque and none wasted fighting the magnet. Now drag the theta offset away from zero. Watch torque current bleed out of IqI_q and into IdI_d, and both pick up a wobble. You did not change the motor or the currents at all, only your estimate of where the rotor is. That is why FOC lives or dies on rotor position: the entire benefit of the rotating frame evaporates the moment the frame stops tracking the rotor.

In FOC of a surface-PM motor, which current sets torque, and what is the target for the other axis?

Why does a current-sense amp need strong common-mode rejection for an in-line phase shunt?

Lab: from sensed current to a torque limit

On a bench FOC drive, prove the loop end to end before you trust it. First, with the motor held still and a known DC current forced through one phase, read the current-sense amp’s output on a scope and confirm the volts-per-amp scale matches the datasheet, so your IqI_q in software means real amps. Second, spin the motor open-loop at a slow fixed speed and capture iai_a, ibi_b, ici_c, then compute IdI_d and IqI_q offline: a correctly aligned encoder gives you a flat IqI_q and a near-zero IdI_d, and any wobble points straight at an angle-offset error to trim. Finally, run the motor at a fixed IqI_q and log winding temperature versus time with a thermocouple. The plateau temperature at a given current, read against the insulation’s rated ceiling, is your continuous-torque limit. Everything above that plateau is peak torque you can borrow only for as long as the thermal mass lets you.

The full Clarke and Park matrices, and why the power-invariant scaling carries that √(2/3)

The two-step, three-numbers-to-two reduction has a clean linear-algebra story. The power-invariant Clarke transform, the form Edith Clarke’s later work settled on, is the matrix that projects the three phase currents onto two stationary axes plus a common-mode (zero-sequence) component:

[iαiβiγ]=23[1121203232121212][iaibic]\begin{bmatrix} i_\alpha \\ i_\beta \\ i_\gamma \end{bmatrix} = \sqrt{\frac{2}{3}} \begin{bmatrix} 1 & -\frac{1}{2} & -\frac{1}{2} \\ 0 & \frac{\sqrt{3}}{2} & -\frac{\sqrt{3}}{2} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{bmatrix} \begin{bmatrix} i_a \\ i_b \\ i_c \end{bmatrix}

The leading 2/3\sqrt{2/3} makes the matrix orthonormal, so it rotates the current vector without rescaling it and the power you compute in αβγ\alpha\beta\gamma equals the power in abcabc. The bottom row is the γ\gamma (zero-sequence) component; in a balanced motor with ia+ib+ic=0i_a + i_b + i_c = 0 it is identically zero, which is precisely why FOC throws it away and works in two axes. Drop the γ\gamma row and you get the simplified two-by-two form your firmware actually runs.

The Park transform is then just a planar rotation by the rotor angle θ\theta applied to the αβ\alpha\beta pair:

[idiq]=[cosθsinθsinθcosθ][iαiβ]\begin{bmatrix} i_d \\ i_q \end{bmatrix} = \begin{bmatrix} \phantom{-}\cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} i_\alpha \\ i_\beta \end{bmatrix}

The deep point Park proved in 1929 is what this rotation does to the machine’s equations, not just its currents. A synchronous machine’s inductances, seen from the stator, vary with rotor position, which makes the governing differential equations time-varying and miserable. Park’s rotation transfers them into the rotor frame where those inductances become constant, turning the whole machine into a linear time-invariant system. That is the property that lets a fixed-gain PI controller work at every speed, and it is why the transform, not any particular controller, is the real invention.

A note where the authoritative course statement and the encyclopedia meet: FOC controls IqI_q for torque and holds Id0I_d \approx 0 for a surface-PM motor specifically. Interior-PM and reluctance machines have a position-dependent reluctance torque term, so their optimal strategy commands a deliberately nonzero (usually negative) IdI_d to exploit it and, at high speed, to weaken the field. The Id0I_d \approx 0 rule in this lesson is the correct default for the surface-PM case the course targets; it is a sensible starting point, not a universal law, and the more general machines bend it on purpose.

Grounded in Wikipedia: “Field-oriented control”, “Direct-quadrature-zero transformation”, “Alpha-beta transformation”, “Brushless DC electric motor” (CC BY-SA).

Key takeaways

  • FOC rides the rotor: Clarke flattens three phases to a stationary two-axis frame, Park rotates that frame onto the rotor so AC currents become steady DC.
  • In the rotor frame, Iq sets torque and Id is held near zero on a surface-PM motor, so a simple PI loop can control each.
  • FOC needs rotor position from an encoder, Hall sensors, or a sensorless estimator; a wrong angle bleeds torque current from Iq into Id.
  • Current sensing picks among low-side shunt, in-line shunt + diff amp, or Hall sensor, trading cost, conduction window, and isolation.
  • Heat, dominated by I²R copper loss, sets the continuous-vs-peak torque limit: ΔT = P·Rθ against the insulation's ceiling.
Practice 1 warm-up

A balanced three-phase motor is sensed with two shunts that read ia=3.0i_a = 3.0 A and ib=1.8i_b = -1.8 A at one instant. What is ici_c, and why do you only need two sensors?

Show worked solution

In a balanced (ungrounded, three-wire) motor the phase currents sum to zero at every instant: ia+ib+ic=0i_a + i_b + i_c = 0. So

ic=(ia+ib)=(3.0+(1.8))=1.2 A.i_c = -(i_a + i_b) = -(3.0 + (-1.8)) = -1.2\ \text{A}.

The third current is fully determined by the other two, which is why FOC needs only two current sensors. That same constraint, ia+ib+ic=0i_a + i_b + i_c = 0, is what makes the zero-sequence (γ\gamma) component vanish and lets the Clarke transform reduce three numbers to two with no loss of information.

Practice 2 core

A motor winding has resistance R=0.25 ΩR = 0.25\ \Omega per phase and a winding-to-ambient thermal resistance Rθ=4 °C/WR_\theta = 4\ \text{°C/W}. Ignoring iron and switching loss, and treating the copper loss as I2RI^2 R in one phase, the insulation is rated for a 80 °C rise above ambient. What continuous phase current does that thermal ceiling allow?

Show worked solution

Set the steady-state rise equal to the ceiling and solve back to power, then to current. The rise is ΔT=PlossRθ\Delta T = P_{\text{loss}} \cdot R_\theta, so the allowed loss is

Ploss=ΔTRθ=80 °C4 °C/W=20 W.P_{\text{loss}} = \frac{\Delta T}{R_\theta} = \frac{80\ \text{°C}}{4\ \text{°C/W}} = 20\ \text{W}.

That loss is copper loss Ploss=I2RP_{\text{loss}} = I^2 R, so

I=PlossR=20 W0.25 Ω=808.9 A.I = \sqrt{\frac{P_{\text{loss}}}{R}} = \sqrt{\frac{20\ \text{W}}{0.25\ \Omega}} = \sqrt{80} \approx 8.9\ \text{A}.

About 8.9 A is the continuous limit. Because heat goes as I2RI^2 R, pushing twice this current (17.8 A) would dump four times the loss (80 W) and four times the rise (320 °C), which is why that level of current is only ever a brief peak, never continuous.

Practice 3 stretch

You are designing a 48 V, 30 A continuous robot-joint drive. Phase current is large, the bus voltage is hazardous to probe directly, and the joint must keep running even if one sensor path develops a fault to the high-voltage rail. Which current-sense topology fits best, and what is the main trade-off you accept?

Show worked solution

A Hall-effect current sensor is the best fit here, for three reasons that all point the same way. First, it gives galvanic isolation: the sensing element measures the magnetic field around the conductor and never makes electrical contact with the hazardous 48 V node, which directly answers the safety requirement. Second, it adds no ohmic loss in the phase path, so at 30 A continuous you are not burning watts and heating a shunt that would itself need cooling. Third, it reads the phase current continuously, unlike a low-side shunt whose window shrinks at high duty.

The trade-off you accept is accuracy and cost: Hall sensors drift more with temperature and time, are noisier, and are more expensive than a precise shunt plus a diff amp. For a precision torque loop you would calibrate the offset and gain and may add filtering. (An in-line shunt with a high-CMRR diff amp could also read continuously, but it leaves the measurement node floating on the 48 V rail, which fails the isolation requirement; a low-side shunt is cheapest but loses its conduction window at high duty and offers no isolation at all.)

The egg and the wrench feel like opposite problems, but to a brushless motor they are the same problem solved at two settings of one knob. Climb onto the rotor, where the spinning blur of three phases stands still and resolves into two honest DC numbers, and the whole machine opens up: IqI_q for how hard, IdI_d parked at zero, and heat quietly deciding how long you may hold the squeeze. Ride the rotor, and the AC was never the hard part.

full glossary →