Mechatronics

The Open-Source Motor Design Stack: From FEMM to FOC Firmware

A working engineer's tour of the free tools, reference designs, and community projects you can actually use to design, simulate, build, and control electric motors for robots and EVs — without a single proprietary license.

#13 · Dev14 minFor: Motor designers, robotics hardware engineers, EV hobbyists
01Why It Matters

Open-Source Motor Design Is Now a Credible Path, Not a Hobby Detour

For most of the last two decades, designing a custom electric motor meant buying a seat of JMAG, Motor-CAD, Ansys Maxwell, or Altair Flux — five-figure-per-year licenses that effectively locked motor design inside large OEMs and a handful of well-funded startups. That has changed. A complete open-source stack now exists that covers electromagnetic simulation, mechanical CAD, controller hardware, and field-oriented control firmware. It is not as polished as the commercial tools, but for robotics-class motors (sub-10 kW BLDCs, actuators, light EV traction) it is genuinely good enough to ship.

The reason this matters for robotics teams is leverage. A small group can now iterate a custom torque-dense actuator in weeks instead of quarters, without committing to a vendor's catalog or waiting on an external design house. The trade-off is that the stack is fragmented — no single tool does everything — so the engineering skill is knowing which open-source tool owns which layer, and how to move data between them.

Magnetics sim
FEMM (free)
Mechanical CAD
FreeCAD
Controller HW
ODrive / VESC
FOC firmware
SimpleFOC
02Magnetics

FEMM, MotorAnalysis, and JMAG-Express: Solving the Field Before You Cut Steel

FEMM 2D magnetostatic simulation of a brushless motor cross-section showing flux density and field lines
FEMM-style 2D flux density plot of a radial-flux BLDC cross-section. The colored field shows local saturation in the stator teeth; flux lines bridge the air gap between rotor magnets and stator iron.

The first tool in the stack is FEMM (Finite Element Method Magnetics), David Meeker's free 2D solver for low-frequency magnetostatic and time-harmonic problems. It is limited to 2D planar and axisymmetric geometries, but that covers the cross-section of almost every radial-flux BLDC and PMSM you'd want to build. FEMM has a Lua scripting interface and a Python wrapper (pyFEMM), which means you can automate parameter sweeps over slot count, magnet thickness, air-gap, and tooth geometry without clicking through a GUI for each variant.

MotorAnalysis layers a motor-specific workflow on top — it runs in MATLAB or Octave and handles induction, PM synchronous, and switched-reluctance topologies with built-in dq-axis analysis and efficiency maps. For a quick sanity check before committing to FEMM modeling, JMAG-Express Online is a free web tool from JSOL that returns torque, efficiency, and inductance estimates for standard topologies in seconds. It's a good first filter — if JMAG-Express says your sizing is off by 3×, FEMM will agree.

The honest limitation: none of these handle 3D effects well. Axial-flux machines, skewed rotors, and end-winding losses need either commercial 3D solvers or careful 2D approximations with hand-calculated correction factors. For most radial-flux robotics actuators, that's not a blocker.

03Mechanical & PCB

FreeCAD, KiCad, and the Rise of PCB Stators

Macro photograph of a multi-layer PCB stator showing spiral copper coil traces around a central hub
A PCB stator: copper traces etched into a multi-layer board replace hand-wound coils. Manufacturable, repeatable, and ideal for small ironless or axial-flux motors — but limited in copper fill compared to traditional windings.

Once the magnetics are settled, mechanical design moves to FreeCAD or OpenSCAD for parametric rotors, stator laminations, housings, and bearing carriers. Both export STEP and STL cleanly. For prototyping, 3D-printed rotor carriers with bonded magnets and water-jet or laser-cut electrical steel laminations get you a working machine for low cost — adequate for actuator-class testing, with the understanding that printed plastic carriers limit sustained operating temperature.

PCB stators are the more interesting recent development. Instead of winding copper around steel teeth, the stator windings are etched directly into a multi-layer PCB. Projects like MotorCell (a 6-layer PCB stator microbot motor) and Carl Bugeja's open PCB motor experiments demonstrate the pattern. The advantages are obvious — manufacturability, repeatability, no winding labor — but the trade-off is power density: PCB copper fill is far below what a wound stator achieves, so PCB motors dominate at small sizes and ironless / axial-flux topologies, not at traction scale.

KiCad is the obvious open-source tool for designing PCB stators, with scripting (via its Python API) for generating spiral coil geometries that would be impractical to draw by hand.

04Reference Designs

ODRI, Open Source BLDC, and the MIT Motor Lab

Exploded isometric CAD render of a brushless DC motor showing rotor, wound stator, bearings, and housing along the shaft axis
Exploded CAD view of a typical inrunner BLDC actuator: shaft and rotor magnets, laminated wound stator, two preloaded ball bearings, and an aluminum housing. This is the assembly an open-source pipeline (FEMM → FreeCAD → ODrive) is targeting.

You rarely want to start from a blank page. The Open Dynamic Robot Initiative (ODRI), led by MPI-IS and NYU, publishes a complete open-source actuator stack — motor, gearbox, driver board, and firmware — used in quadrupeds and bipeds across multiple research labs. Their MJBots / moteus ecosystem and the related MIT Mini-Cheetah actuator (Ben Katz's design, widely cloned) are the reference points for high-torque-density robotics actuators. Both publish full mechanical, electrical, and firmware sources.

The Open Source BLDC Motor project on GitHub covers 3D-printed casings and open winding patterns scaling from ~100 W desktop motors up to claimed 45 kW EV traction units — useful as a learning corpus, with the usual caveat that scaling motor designs is non-trivial. MIT Motor Lab (motors.mit.edu, an outgrowth of the MIT Electric Vehicle Team) hosts design notes, control code, and reference machines aimed at EVs and small mobility.

Open Source Ecology publishes motor analyses oriented around appropriate-technology and rural manufacturing — interesting for the design philosophy and the documentation discipline, less so as drop-in IP.

ODRI actuator
9 N·m, ~100 g
Mini-Cheetah
17 N·m peak
moteus r4
Open FOC driver
License
Mostly CERN-OHL / MIT
05Controllers & Firmware

ODrive, SimpleFOC, VESC, and OpenESC: Picking the Right Driver Stack

Open-source motor controllers have matured faster than the motors themselves. ODrive (open hardware + firmware) targets high-performance dual-axis BLDC control with encoder feedback and is the pragmatic default for robotics actuators in the 50–500 W range. VESC (Benjamin Vedder's project) dominates the e-mobility space — e-skateboards, e-bikes, light EVs — and runs on STM32F4/F7 with a mature FOC implementation, regenerative braking, and CAN networking.

SimpleFOC is the right starting point if you want to understand field-oriented control rather than just use it. It runs on Arduino-class hardware, has a clean Arduino/PlatformIO library, and exposes every step of the FOC pipeline (Clarke/Park transforms, current loop, velocity loop, position loop) in readable C++. It's slower than ODrive or VESC but ideal for teaching, low-power actuators, and quick bring-up of a new motor.

OpenESC and similar open ESC firmware stacks (BLHeli_32 was open before going closed; AM32 is the active fork) cover sensorless back-EMF control for drones, fans, and small propulsion. These are different beasts from FOC controllers — optimized for low-cost trapezoidal commutation at high speed without an encoder — but worth knowing about when the application doesn't need precise torque control.

Underneath all of these, LTspice remains the standard free SPICE simulator for verifying the analog front-end (current sensing, gate drive, snubbers) before committing a board layout.

06Pipeline

A Practical Open-Source Motor Pipeline

Putting it together, a realistic workflow for a custom robotics actuator looks like this. Step 1: define the operating point — peak torque, continuous torque, base speed, bus voltage, thermal envelope. Run JMAG-Express Online to confirm a target topology (slot/pole count, OD, stack length) is in the ballpark. Step 2: model the cross-section in FEMM, sweep magnet thickness, tooth width, and air-gap with pyFEMM. Extract torque ripple, cogging, back-EMF constant, and inductance.

Step 3: hand the geometry to FreeCAD, design the rotor carrier, stator clamp, housing, and bearing supports. Order laminations from a laser/water-jet shop or stack 3D-printed soft-magnetic-composite parts for early prototypes. Step 4: pick a controller — ODrive or moteus for plug-and-play actuator work, SimpleFOC if you want to write your own loops. Step 5: bring up the motor on a dyno, fit the back-EMF and torque constants, tune the current and velocity loops, and verify thermal behavior under your duty cycle.

The whole pipeline costs roughly $0 in software and a few hundred dollars in materials for a desktop-scale prototype. The skill that distinguishes a working motor from a paperweight is not the tooling — it's knowing which physical effects (saturation, end-winding leakage, eddy-current losses in magnets, thermal limits at the slot insulation) the 2D open-source tools won't catch, and budgeting for them up front.

References
  1. [01]
  2. [02]
  3. [03]
  4. [04]
    MIT Electric Vehicle Team — Software and motor design resources
    Massachusetts Institute of Technology · MIT EVT
  5. [05]
  6. [06]
  7. [07]
  8. [08]
  9. [09]
  10. [10]
  11. [11]
  12. [12]
  13. [13]
  14. [14]
Topics
open sourceBLDCFOCFEMMmotor designODriveSimpleFOCPCB stator
Continue

Pick one tool from each layer — magnetics, mechanical, controller, firmware — and build a motor end-to-end.

Visit handybot.ai →
Related from the other side
The Driverless Cleaning Problem: Keeping Robotaxis Spotless Without a Human in the Loop

Why scaled robotaxi services can't fully realize their economics until interior maintenance becomes autonomous too.

More Dev posts