Neural-network motor control: PMSM and EESM
I built a pipeline that learns motor flux maps from finite-element solves and uses them to generate current references for field-oriented control. A random forest performed best on independent off-grid points for the small IPM motor. For the electrically excited motor, the selected model depends on the sampling and tuning study; the comparisons are below.
An IPM neural-network implementation also placed and routed on a Lattice ECP5 at 29 MHz. All control results are from FEM, fixed-point comparisons or Simulink. The controller has not run on a motor.
Flux-map modelling and validation
For a small IPM (permanent-magnet) motor, I scripted Ansys Maxwell 2D Student through Python to solve a 40 × 40 grid of 1,600 operating points. First I had to find why every non-zero-current solve was failing: inherited mesh operations pushed the mesh past the Student element limit. I then compared twelve surrogate models, from polynomials and a Gaussian process to four MLPs. The Gaussian process won on held-out grid points (0.000255 Wb RMSE) but fell to fourth on 20 independent off-grid FEM solves, where a random forest did best (0.0122 Wb). The off-grid winner feeds the MTPA and field-weakening search that builds the (speed, torque) → (i_d, i_q) reference table.
The electrically excited synchronous machine (EESM) adds the rotor field current as a third input. For a four-pole, 10 kW academic design I ran a 1,759-point FEMM campaign and compared four model families across three sampling strategies and three training budgets, 36 combinations in all, each scored against a sealed set of 256 solves. The frozen ranking picked a Gaussian process trained on 256 Latin-hypercube points, at 0.37 N·m torque RMSE. In a later study with equal tuning for every family, the compact MLP had the lowest median error, 0.079 N·m, and 0.096 N·m on a separate 48-point boundary holdout. That study measured spread across training draws, so it didn't replace the frozen pick.
FPGA implementation
I also ported the small IPM MLP to fixed-point Verilog. Across a 61 × 61 current grid its output stays within 0.29 mWb of the floating-point model, and it places and routes on a Lattice ECP5 at 29 MHz.
Extension: inter-turn fault detection
The same drive signals can show when a motor is failing. This extension, which I started in September 2026, aims for an InstaSPIN-style detector: commission a motor it has never seen, learn that motor's healthy baseline, then flag faults from the drive's own currents and voltage commands, on a microcontroller's NPU, with no extra sensors.
I built a fast fault simulator for PMSM, BLDC, SynRM and PM-assisted SynRM drives, with switched PWM, dead time, BLDC six-step and FEMM flux maps of faulted machines. Every dataset is split by motor, so the test motors are never seen in training. Stage 1 compares angle-synchronous harmonics of each window against the motor's own commissioning statistics. Stage 2 is an 8,024-parameter int8 CNN that names the fault type; it reaches 79% balanced accuracy across eight classes, and I compiled it for the TI F28P55x NPU with TI's toolchain and linked it into C2000 firmware.
Inter-turn shorts are the current focus. With switched-inverter data and the threshold set for 1% false alarms, the detector catches 91% of shorts covering 10–21% of a phase and 71% at 5–10%, but few below 2%, where the fault looks like a healthy motor's own asymmetry. On held-out motors false alarms run 3–5%, above the 1% target, and six-step BLDC drives are the weak case. These are simulated motors: the firmware hasn't run on the LaunchPad and the detector hasn't seen a real fault yet.