Hardware & electrical · topic E3 · 50 hours
Motors & FOC drives
Every newton of robot force comes from here. Few people understand FOC, which makes it valuable — and it is the core of the electronics-control role.
What to learn
- Brushless motor principles, back-EMF, pole pairs and the mechanical-angle/electrical-angle relationship
- Clarke/Park transforms, current loop, SVPWM: one complete control chain
- The difference between encoder commutation and sensorless startup
- Torque constant, peak/continuous torque, thermal limits and I²t checking
The lesson · plain words
FOC (field-oriented control) is the lingua franca of modern motor drive: brushless motors, servos, gimbals, balance scooters — all FOC underneath. The core idea in one sentence: move the three-phase AC problem into a rotating frame, where it becomes two DC problems.
FOC is hard not in the formulas but in the «why». This page nails that why.
The why: the AC-to-DC magic trick
Three-phase currents are 120° apart; looked at directly they are three squabbling sinusoids. But their combined magnetic field is one rotating vector — FOC uses coordinate transforms (Clarke+Park) to ride along with that rotation, translating «three-phase AC» into two DC quantities: the d-axis (rotor flux) and the q-axis (perpendicular to it).
Watch the animation: the big green arrow (the current vector) always rotates with the rotor's d-axis and stays perpendicular to it — maximum torque, minimum heating. Iq handles torque, Id handles heat, each with its own PI. That is the whole division of labor.
Interactive figure · drag it and see
Three stages: sample, compute, output
Current sampling: low-side shunt resistors or phase-current sensors; the ADC must sample synchronously at the PWM center point (to dodge switching noise). Compute: Clarke/Park transforms + two PIs + inverse transform, one loop at 1kHz–20kHz. Output: SVPWM modulating the three-phase bridge.
The whole chain must complete within one PWM period — that is why FOC demands such tight timer/ADC/DMA coordination from the MCU (all three of E2's weapons deployed at once).
Sensorless FOC and position sensing
Sensored (encoder/magnetic encoder): angle measured directly, the most stable control, the servo standard. Sensorless: rotor position inferred from currents and voltages (sliding-mode observer / high-frequency injection) — saves the sensor but performs poorly at low speed; common in fans and pumps, rare in robot joints.
Gimbal motors are a special case: high pole count, high torque density, paired with a magnetic encoder that outputs absolute angle directly. When picking a motor, check pole pairs and the back-EMF constant first — those two numbers set your voltage budget.
The field order for tuning FOC
Current loop first (the fastest, bandwidth of hundreds of Hz to a few kHz), then the velocity loop, then the position loop — the same tuning discipline as B5. If the current loop is wrong, everything after it is a castle in the air.
Safety red lines: first power-up must have current and voltage limits, stall protection enabled, and an e-stop at hand. Bad FOC parameters do not throw errors — they make the motor convulse and hurt people. Your bench needs a one-button disable.
Three questions — do you really get it?
1. In FOC, what is the division of labor between Iq and Id?
- ABoth produce torque
- BIq produces torque, Id manages flux/heat (usually driven to 0)
- CId produces torque, Iq manages heat
Show answer
B. The q-axis is perpendicular to the rotor flux direction, so all its current goes to torque; d-axis current only heats.
2. Why must FOC current sampling be synchronized to the PWM center point?
- ATo save power
- BTo improve resolution
- CTo avoid switching-instant noise and capture the true phase current
Show answer
C. Current noise at switching edges is huge. The center point is exactly where the average current's true value sits.
3. What is the correct order for tuning FOC parameters?
- APosition loop first
- BCurrent loop → velocity loop → position loop, from the inside out
- CAll three at once
Show answer
B. The inner loop is the plant of the outer loop. Without current-loop bandwidth, tuning the outside is all theater.
Keep going deeper
Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.
How it fails in the field
- Current-loop bandwidth too low while chasing high control bandwidth: force control feels mushy and everyone blames the mechanics
- Sizing motors by peak torque only: a few minutes of continuous work triggers derating and motions turn «sluggish»
You have learned enough when
The Chinese edition carries the full topic page for Motors & FOC drives, including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/E3/.