Learn · Interactive series

Field-Oriented Control, from scratch

An interactive, build-in-public series that takes you from spinning magnets to a self-tuning motor drive — the ideas behind the open Modular Motor Controller.

6interactive parts live
0→∞no motor-control background assumed
100%runs in your browser, nothing to install
Why this series

Motor control feels like a wall of Greek letters. It isn't.

Field-oriented control is how nearly every drone, robot arm, EV, and CNC axis makes a motor produce smooth, precise torque. The math looks intimidating — Clarke, Park, space vectors, observers — but every piece maps onto something you can see spinning.

So instead of derivations, each part gives you something interactive to work with. Drag a slider, watch the field turn, break the controller and fix it. The same ideas — the same code, even — run on Rhobic's open Modular Motor Controller, a simulation-first FOC drive that goes from a virtual motor in CI to a real STM32. You're working with the actual thing, not a simplified stand-in.

The path

Six parts, from spinning magnets to a self-tuning drive.

Read them in order or jump to what you need. New parts land as the controller itself hits each milestone.

Documentation index

Every part maps to real code.

The series doubles as working documentation for the Modular Motor Controller. Each part points back at the milestone it explains, the modules that implement it, and a command to run it. MS1–MS6 have shipped. Position control on hall sensors (MS7), six-step (MS8) and the FOC operating envelope (MS9) are in progress. The whole controller is open source atgithub.com/rhobic/mmc; for the real traces behind these claims — sim and hardware alike — see Results.

PartMilestoneIn the codeStatus
1What field-oriented control actually doesMS2
mmc-core::svpwm::svpwmmmc-core::transformsmmc-sim::motor
Live
2Clarke & Park: turning AC into DCMS2
mmc-core::transforms::clarkemmc-core::transforms::parkmmc-core::transforms::inverse_park
Live
3The loop that runs the motorMS2
mmc-core::tuning::current_pi_gainsmmc-core::pi::Pi::updatemmc-core::current_loop::CurrentLoop::update
Live
4Finding the rotor without a sensorMS4MS5MS9
mmc-core::observermmc-core::sensorlessmmc-core::angle::AngleEstimator
Live
5From simulation to siliconMS3MS5
mmc-core::foc::Foc::stepmmc-drive::Engine::tickmmc-protommc-fw-g474 / mmc-fw-f302
Live
6Position control on hall sensorsMS7
mmc-core::position::TrapRefmmc-core::hall::HallTrackermmc-core::hall::HallAngle
Live