Pick up an unpowered drone outrunner and turn the bell by hand. The three wires stay still. The magnets turn with your fingers. Put a scope across two of the wires and you can see a voltage as you turn. Spin faster and both its amplitude and its frequency increase. That little experiment is where I’d start with a brushless DC motor. The same moving magnets that generate our scope signal also give the electronic speed controller a way to work out when to switch.

We’ll follow one motor at three time scales. First, a mechanical turn shows us where the magnets and copper live. Then one electrical turn shows why an ESC switches six times. Finally, a few microseconds inside a switch pulse explain why the current looks so different from the voltage. You can move the magnets and change the winding in your browser, or run the field and shaft simulation on Linux.

Take the bell off a drone motor

On an outrunner, the shaft and outer bell rotate together. Inside the bell is a ring of permanent magnets. The face of one magnet looking toward the shaft is north, its neighbour’s inward face is south, and so on around the ring. The stator stays attached to the frame. It has a stack of thin steel laminations, teeth pointing outward and insulated copper wound around the teeth. The thin laminations limit circulating currents in the steel as the field changes. The slot is the space between two neighbouring teeth.

A cross-section of twelve wound teeth inside fourteen alternating rotor poles, beside flux contours for an ideal smooth bore.
Left, the grey teeth and copper stay still while the red and blue magnets rotate with the dark bell. Right, a smooth-bore calculation isolates the repeating magnetic field. The contours show its shape. Predicting the flux density in a real tooth requires its geometry and steel properties.

Follow a magnetic loop. Flux leaves an inward-facing north pole, crosses the narrow air gap, travels through stator iron and crosses back to a neighbouring south pole. The steel behind the magnets provides a return path on the rotor. Much of the magnetic reluctance, the opposition to flux, sits in that little air gap. Changing the gap by a fraction of a millimetre can matter. Making it too small leaves little room for bearing play, bell runout or thermal expansion.

Now energize a winding. The ampere-turns of its coils create a stator field. The rotor experiences torque as the two fields interact. Hold the same pair of wires energized and the rotor can settle near one alignment. To keep it turning, the ESC advances the stator field as the bell moves. The winding pattern and the direction each coil is wound determine which teeth cooperate when current enters phase A. Counting red and blue magnets gives the pole count. Counting copper coils alone won’t tell you how to connect their leads. A worked 12-slot, 14-pole geometry appears in the motor chapter of Renaissance Robotics.

Would a motor with just one north and one south pole even turn?

Yes. Picture two arc magnets on opposite sides of the bell. One faces inward with its north pole, the other with its south pole. Energize a fixed coil on the stator and the bell moves toward alignment. Leave the current there and it settles. If the rotor happened to start exactly aligned, that current gives it no starting twist. The missing ingredient for continuous motion is a stator field that keeps moving ahead of the rotor.

Keep those same two magnets. Wind three stator coils with their magnetic axes at 0°, 120° and 240°. Call them A, B and C. Each coil produces a field along its own axis, and reversing its current reverses its field. At the first instant below, A carries +1 A and B and C each carry −0.5 A. Draw the three field arrows and add them. Their sideways parts cancel and the sum points along A. A quarter of an electrical turn later A carries zero, B carries +0.866 A and C carries −0.866 A. The sum now points straight up. The copper hasn’t moved.

At electrical angles zero, ninety and one hundred eighty degrees the summed stator field points right, up and left while the three coil axes remain fixed.
Dark arrow = fundamental stator field. Dotted spokes = fixed coil axes. The numbers underneath are instantaneous phase currents in amperes. With a balanced sinusoidal drive the arrow sweeps continuously. Six-step commutation advances the field in six discrete directions.

The rotor follows when the tangential magnetic force can supply the load torque. For a sinusoidal surface-magnet motor, the dominant torque term at fixed current varies approximately as sin δ, where δ is the electrical angle between rotor flux and the stator field. The little detents you feel turning an unpowered slotted motor come from a different effect. Its magnets favour certain alignments with the iron teeth. That position-dependent torque is called cogging.

Turn each bell at the same 3,000 rpm. Every example still has three phase terminals.
Pole pairsInward faces around the bellShaft travel per electrical cycleElectrical frequency
1N, S360°50 Hz
2N, S repeated twice180°100 Hz
3N, S repeated three times120°150 Hz
7N, S repeated seven times51.4°350 Hz

Place the magnets by mechanical angle. Lay out the coils by electrical angle. With p pole pairs, neighbouring magnet centres are 180°/p apart mechanically. A three-phase winding needs three fundamental magnetic axes displaced by 120° electrically. For two pairs, 60° around the shaft gives that displacement. For three pairs, 40° does it. On a 12-slot, 14-pole stator the slots are fixed at 30° mechanical intervals. Each phase gets several coil contributions in series, with selected coils reversed so their voltages add. Swapping in a bell with twice as many magnets calls for checking that whole winding pattern again.

Put magnets and windings on the same drawing

Interactive motor cross-section and three phase voltages, initially showing one pole pair and three teeth.
Open the outrunner design bench. Read the rotor poles from the outside in. The signed letters mark coil axes and connection polarity. The green dots locate the two active sides of one A coil.
  1. Count cycles. Start at one pair and move the shaft 90°. Then choose two pairs and three pairs at the same shaft position. The scope cursor reaches 90°, 180° and 270° electrical. The waveform spans one electrical period in each case.
  2. Put more copper in a slot. Select the drone winding. Raise 12 turns per coil to 24. The open-circuit voltage doubles. At the same slot dimensions and copper fill, the space available per wire halves. Widen the slot and watch how much tooth iron you give up. The slot readout assumes two coil sides per slot and 40% copper fill. Insulation, end turns and room to actually insert the wire matter in a build.
  3. Listen to what the winding picks up. Hold the speed and turns fixed. Widen the rotor magnets with the arc slider, then change from the three-slot, one-pair winding to the distributed one-pair winding. Compare each trace with its own dashed fundamental, and check the voltage scale. Switch to line-to-line to see what a scope connected to two motor wires would measure.

Here’s what changes the shape of that voltage. A narrow arc puts a short patch of north-facing field past a coil. A wide arc holds the field in one direction for longer. A coil samples the field at two separated active sides. A phase winding adds those contributions from every series coil, with signs set by the winding direction. Moving the sides closer together changes which spatial harmonics add. Distributing coils across neighbouring slots makes some harmonics cancel. A broad, relatively flat field under a magnet can produce flat portions in the phase back-EMF with a suitable winding. If the fundamental dominates, the trace approaches a sine. Balanced third-harmonic phase voltages cancel in the line-to-line trace. Two probes can therefore tell a different story about the same motor. How coil pitch, distribution and skew enter the winding factor.

The live plot computes an open-circuit voltage from the rotating field and both sides of each coil. It represents magnet coverage using odd spatial harmonics through order 21 and approximates how a smooth air gap attenuates the shorter wavelengths. The radius slider changes surface speed at fixed rpm. Choosing a larger radius also gives more torque leverage: at a given tangential shear stress and stack length, active area grows with radius and its moment arm grows too, so torque scales approximately with radius squared. The slider doesn’t predict allowable current or torque. Later we’ll bring back the actual slots and solve the magnetic field numerically.

What makes one outrunner look trapezoidal on a scope and another nearly sinusoidal?

I would first disconnect the ESC and spin the motor at a known speed. That leaves a simple question: what voltage does the rotating magnet pattern induce in this winding? Broad pole faces can keep the radial field nearly level over part of a pole pitch. Coil span determines which parts of that field the two sides of each coil sample. Distributing a phase across several slots can cancel some spatial harmonics when the coil voltages add. Magnet shaping and skew can smooth the trace further. A 12-slot, 14-pole label or the price of the motor tells us too little to predict the waveform.

Try it on the design bench above. Select Phase to neutral, keep one winding fixed and switch Rotor field model from alternating magnet arcs to the ideal sinusoidal field. The dashed fundamental now sits on the coloured trace. Switch back to arcs and vary their width. Watch the higher-harmonic percentage change. Then compare tooth coils with the distributed layout. The sinusoidal field option isolates a mathematical limit; the arc option estimates the shape from geometry. On a three-wire motor the neutral is usually inaccessible. Selecting Line to line shows what the scope can measure, including the cancellation of harmonics shared by both phases.

Now reconnect an ideal drive. Keep the motor unchanged and switch the current command. Six-step drive sends current through two phases at a time. Flat phase-EMF plateaus can pair well with those rectangular currents. For a near-sinusoidal permanent-magnet machine, field-oriented control (FOC) uses rotor angle to regulate current along rotating axes. In the surface-magnet example, the torque-producing current is on the q axis; ideal tracking gives three smooth phase currents. Try a sine field with each drive: the six-step torque rises and falls through a sector, while the matched sinusoidal case gives constant magnet torque in this ideal model. Both trials have the same RMS phase current, so the copper-loss comparison is fair. An RC outrunner can use FOC too; its measured flux waveform, current sensing, angle estimate and controller bandwidth determine how well it works.

Why seven electrical turns fit inside one mechanical turn

Our example has 12 stator teeth and 14 rotor poles, often written 12N14P. Fourteen alternating poles make seven north–south pairs. Watch a single stationary tooth during one revolution of the bell. It sees seven repetitions of the magnetic pattern. That gives us θₑ = 7θₘ, where the subscripts mean electrical and mechanical angle.

At 3,000 rpm the shaft turns 50 times per second. The electrical frequency is 7 × 50 = 350 Hz. A six-step ESC advances every 60 electrical degrees, so it changes pair 2,100 times per second, about once every 476 µs. That is only 8.57 degrees of actual shaft rotation per step. The PWM timer can switch several times during a single step. These are two different clocks you can identify on a scope.

Amber windings source current, teal windings return it and grey windings float. Follow the white dot. The bell moves just 51.4° while the driver uses all six phase pairs. Pause at a change of pair to read the shaft angle and see which terminal becomes available for sensing. Playback is slowed for inspection.

Where the three wires go

Follow the battery into the ESC. A three-phase bridge has three half bridges. Each terminal can connect through a high-side switch to the positive rail or through a low-side switch to the negative rail. In the first sector below, A connects high and B low. Current enters A, passes through its winding to the star point, then returns through B’s winding. Most small motors expose only the three phase wires, so the winding junction is hidden. The example assumes a star winding. A delta-connected motor needs a different winding-current calculation.

Three bridge legs and a star-connected winding show current entering phase A and leaving B, with C open for sensing.
Read matching phase letters across the two panels. The closed switches are green. During the driven part of this PWM cycle the path is battery positive → A → star point → B → battery return.
Electrical anglePhase sourcing currentPhase sinking currentFloating phase to observe
0–60°ABC
60–120°ACB
120–180°BCA
180–240°BAC
240–300°CAB
300–360°CBA

The third phase gives a sensorless controller a timing clue. Once its residual current has decayed, its terminal voltage relative to the motor neutral follows its back-EMF. A comparator or ADC can use a reconstructed neutral. In ideal steady six-step operation a zero crossing occurs midway through a sector. Wait another 30 electrical degrees and the next pair should take over. At our 3,000 rpm example that wait is about 238 µs. Switching spikes and recirculating current can produce false crossings. The choice of sample instant, a short blanking interval and a plausible timing window all matter.

At rest the magnets produce no speed-induced voltage. One startup strategy aligns the rotor, advances through a timed sequence to build speed, then hands timing to the observed crossings. This is where the NXP notes are worth reading. DRM144 walks through sensorless operation on a single motor. AN5169 takes the next step and schedules four motors on one Kinetis MCU. Its 30 kHz PWM and interleaved sampling show why ADC availability becomes a design constraint on a quad. In a real bridge the driver must also insert dead time between complementary switches so the DC rails cannot be shorted through one leg. See NXP’s quad motor reference design.

Follow one commutation from the bridge into the air gap

Pause the film on A+ → B−. The amber and teal teeth are both producing a field. A is where conventional current enters the motor; B is how it gets back to the ESC. All the coils belonging to each of those phases participate, including coils on the far side of the stator. The ring of permanent magnets keeps its north and south poles throughout the sequence.

Step one with the A high-side and B low-side switches conducting beside the solved field in a 12-slot, 14-pole motor.
Step through the switches, coils and magnetic field. Choose a step and switch between the three field sources before advancing. All 18 images use the same colour scale. For voltages and currents on the three motor leads, open the ESC oscilloscope below.

What changes when the ESC advances one step?

Start on step 1. During the driven part of the PWM pulse, follow the path from battery positive through A’s high-side transistor, through the A coils to the internal star point, back through the B coils and B’s low-side transistor. On the field map, select Permanent magnets alone. Even with the windings disconnected, flux already crosses the gap and returns through the teeth and the bell.

Keep the angle fixed. Select Driven coils alone to isolate the field from +2 A in A and −2 A in B. Select Magnets + driven coils to see the operating field. Where the fields point the same way the magnitude grows; where they oppose one another it falls. The white curves trace the direction of flux in the slice. The colours measure its local strength. The solver adds the field vectors before taking their magnitude. Adding the brightness of the two pictures would give a different answer.

Advance to step 2. A stays on the supply side. The return moves from B to C, and B becomes the phase to observe after its current has decayed. The set of excited teeth moves around the stator. Tangential magnetic force at the gap produces torque on the bell. With seven pole pairs, 60° electrical corresponds to just 8.57° on the shaft. The six positions in the bench are samples within the sectors. Each is a fresh field solution at a prescribed angle; the shaft acceleration under load comes later in the Linux lab.

How does the controller know when to advance?

At standstill there is no speed-induced voltage to time. A sensorless ESC can first align the rotor, advance the phase pairs on a timed ramp, then use the floating phase once the signal is large enough. Immediately after switching, the outgoing winding still has current. Its freewheel path can clamp the terminal, so sampling that instant can give a false indication of position. The controller waits for decay and samples at a defined point in the PWM cycle.

With ideal six-step timing at steady speed, the floating phase crosses neutral halfway through a 60° sector. From that crossing, another 30 electrical degrees remain to the next switch. There is also an integration method: accumulate the floating-phase back-EMF after the crossing until the area reaches a target. Because voltage rises with speed while the time available falls, this area can track angular travel. NXP’s DRM144, §2.4, describes that approach. Its quadcopter note AN5169, §3.1, adds zero-cross timing at higher speeds as the number of ADC samples per sector shrinks. NXP quad-motor design · NXP’s illustrated zero-cross timing guide.

How does a field picture give us torque?

The magnetic calculation starts with current density J in the slots and remanent magnetization in the rotor. In this stationary 2D slice, Ampère’s law relates the circulation of H to current; magnetic flux obeys ∇·B = 0. The solver finds one axial vector potential, Az. Its two spatial derivatives give the field in the picture: Bx = ∂Az/∂y and By = −∂Az/∂x. A white contour is a line of constant potential. Follow one across the gap to see which teeth carry the flux.

Now turn the bell a little while keeping the windings open. Each phase links a slightly different amount of magnet flux, λ. The slope per mechanical radian is the useful quantity. Multiply that slope by shaft speed to get back-EMF, or by phase current to get that phase’s magnet torque. At the first coarse-mesh sample, the A and B slopes are about +0.00492 and −0.00427 Wb·turn/rad. With currents +2 and −2 A, both contributions turn the same way: 2 × 0.00492 + (−2) × (−0.00427) ≈ 0.0184 N·m. The six symmetry-related snapshots give nearly identical torque. The finer angle sweep in the Linux lab reveals the ripple between them. These values use linear steel and omit cogging, saturation and end effects.

Generate these field images on your own Linux machine

Download the outrunner lab and extract it. The same Python solver makes the pictures in this bench. Install NumPy, SciPy, Matplotlib and Pillow, then run this from the extracted directory.

Reproduce the six positionsBash
OPENBLAS_NUM_THREADS=1 /usr/bin/python3 field.py --frames --out run
ls run/sectors
gmsh run/outrunner-field.msh

Open rotor-1.webp, winding-1.webp and combined-1.webp beside each other. Repeat for step 2. The accompanying sectors.json records shaft angle, signed phase currents and torque. Try --gap-mm 1.2 --out wider with the same frame option, then compare the same step and field source on both runs.

What switches on each pulse, and what switches every 60 degrees?

Take a finger and follow phase A across Figure 4 in NXP’s DRM144. First find the wide band where A supplies the motor. Now look inside that band at the narrow pulses. My first question was whether each of those edges moves the propeller to its next position. Hold A and B selected in the bench below and flip the gate probe between on and off. The electrical angle stays put. What changes is the path the winding current takes. Then move the angle from 59° to 60° and watch which lead becomes the return. That second change is commutation.

Six MOSFET gate traces, three signed phase-drive waveforms and six torque peaks over one electrical turn. In the selected A+B− step, HA is held on and LB pulses.
Follow the propeller, six switches and two clocks. Start with Align, then advance through the stages. The six columns show the roles of the three leads. The orange cursor follows the shaft in slow motion. The next chart lines up all six gate commands, signed phase drive and torque. The three-pulse zoom underneath uses a single time axis for the timer, gates and winding current.

Follow all six MOSFETs across an electrical turn

Select Low side · pulse return, Body diode · single-gate PWM, then inspect step 1, A+ B−. Read the six traces from the top. HA stays high for the whole sector. LB pulses at the carrier frequency. The other four gates stay low. When LB turns off, winding current can continue through HB’s body diode and the held HA. HB’s gate stays low even while its diode conducts. Move to step 2, A+ C−. HA is still on, but the pulse train has moved from LB to LC. A single MOSFET can stay on across two adjacent sectors.

Now switch to High side · pulse source and go back to step 1. LB holds the return path and HA pulses. Change only the freewheel path to Complementary MOSFET and LA now receives the inverse command between HA pulses. This is the difference between saying “the low side is modulated” and knowing exactly which of the six gate pins will toggle on your ESC.

Read the lower traces on that same angle axis. The three phase rows follow the signed-drive convention illustrated in NXP’s DRM144, Figure 4. Above the baseline a phase supplies the driven pulse, below it a phase returns it. A floating phase has a zero drive command and can still develop a measurable voltage. The terminal probes above give the corresponding voltages relative to battery negative. Zero electrical degrees in this bench is the start of A+ B−.

The last curve explains the six humps in DRM144, Figure 3. Imagine holding the magnitude of the stator current vector fixed in each sector. As the rotor turns, the angle between the two fields sweeps from 120° through 90° to 60°. The torque factor is the sine of that angle: about 0.866 at either edge and 1 at the middle. The next commutation advances the stator field and the pattern repeats. The vertical scale is enlarged so you can see it. Actual shaft torque also depends on the motor’s back-EMF shape, current transfer between windings, PWM ripple and cogging. The magnetic-field bench shows a separate calculation for the example motor. NXP motor-control reference design.

Zoom from one commutation step into three gate pulses

Look directly below the six phase columns. The sawtooth is the timer counting up and resetting. The dashed line is the duty setting. While the count is below that line, the timer requests drive and the selected MOSFET gets a rectangular gate command. With complementary switching selected, the partner gate takes over for recirculation. The green trace underneath is winding current. It rises during each supply pulse and keeps flowing when the pulse ends. The ideal traces omit the brief dead time that a real gate driver inserts between complementary commands.

Try 20 kHz, 240 µH and “First pulses”. Each cycle lasts 50 µs. At 10% duty that gives the winding 5 µs across 12 V. Starting at zero current, the first pulse reaches about 0.25 A. Switch to 50%: the cycle still lasts 50 µs, but the drive lasts 25 µs and the first pulse reaches about 1.22 A. Compare the troughs after each pulse. The winding has stored energy, so the next pulse starts with some current already flowing.

Does 50% duty mean half the current? At standstill, once this ideal 0.50 Ω pair settles, 10% gives 2.4 A mean and 50% gives 12 A mean. Here half duty really does give half the full-duty steady current. Now select Settled · 2 V back-EMF. The same 50% gives (6 − 2)/0.50 = 8 A. With complementary switching at 10%, the imposed opposing voltage exceeds the 1.2 V average drive, and the ideal synchronous model gives −1.6 A. With body-diode recirculation, the model instead lets the current decay to zero, and the diode turns off until the next pulse. A freely spinning prop would change speed. These examples separate pulse width, the rise on the first pulse and the average after many pulses.

What changes if I pulse the low-side switch instead?

Leave the bench on Align, where A feeds the motor and B returns the current. Set the gate probe to Magnify pulse · off interval and change the PWM switching side. Watch the two motor leads relative to battery negative, then look at A minus B. The third trace explains how two quite different oscilloscope pictures can produce the same winding current.

One 12 V sector with complementary switching and positive winding current flowing from A to B. H and L label the upper and lower switches on each motor lead.
Switching choiceDuring the drive pulseDuring recirculationA minus B
High-side PWM on AHA and LB conduct. A = 12 V, B = 0 V.LA and LB conduct. Both leads sit near 0 V.12 V on, 0 V off
Low-side PWM on BHA and LB conduct. A = 12 V, B = 0 V.HA and HB conduct. Both leads sit near 12 V.12 V on, 0 V off

During recirculation the inductance keeps the current flowing through A’s winding, through the star point and back out through B. With high-side PWM it loops back to A through the lower switches and the negative rail above the shunt. With low-side PWM it loops through the upper switches and the positive rail. The common DC return shunt sees approximately zero in either off interval, even while the windings carry several amps. The default setting uses synchronous recirculation, where the driver turns on the complementary MOSFET after a short dead time. A drive that leaves it off sends current through a body diode, introducing a diode drop and extra dissipation.

Why does the firmware care? At a back-EMF zero crossing the floating lead C equals the motor neutral. With symmetric windings, the ideal ground-referenced level at that instant is about 6 V during drive, near 0 V during low-rail recirculation, and near 12 V during high-rail recirculation. The rotor can be at exactly the same angle in all three cases. The ADC needs a suitable divider, threshold and settled sampling window for the interval it observes. ST’s six-step guide to PWM sensing and crossing thresholds.

Which would I choose? I’d check how the board powers the upper gates and where it measures current. With low-side PWM the source-side upper switch can stay on across many PWM periods. A bootstrap-only high-side driver needs periodic time with its switch node low to recharge. A driver with a charge pump can support longer holds. The pulsed leg also takes the repeated switching losses, and the recirculating pair takes conduction losses. Device resistance, transition time, dead time and board cooling determine the temperature on a real ESC. At equal duty the two ideal schemes apply the same line voltage and give the same ripple in this model. The ngspice captures in the next section use high-side PWM. TI’s BLDC driver selection guide, §2.8.

Who decides when the next phase pair takes over?

  1. Align. At rest the rotor produces no speed-induced voltage. Hold one pair briefly with limited current to settle the rotor in a known direction.
  2. Start on a timer. Advance A+B− → A+C− → B+C− → B+A− → C+A− → C+B−, bringing the steps closer as the rotor accelerates. Each step rotates the stator field by 60 electrical degrees. Reversing the entire sequence reverses that field. Skipping a pair, or ramping faster than the loaded rotor can follow, changes the angle between the fields and can stall the motor.
  3. Listen before handing over. During A+B− the C lead floats. In the convention used here C falls through neutral. At the next step B floats and rises through neutral. Ignore the transient just after switching, sample in a settled PWM window and check that successive crossings have the expected polarity and timing. The shunt tells us about current. Subtracting the neutral estimate from the floating terminal voltage gives us a rotor-position clue.
  4. Let the rotor time the next step. In the ideal steady-speed case the crossing occurs halfway through the sector. With seven pole pairs at 10,000 rpm, the sector lasts 143 µs. Detect the crossing and schedule the next pair about 71 µs later. A second method integrates the floating-phase voltage after the crossing. NXP’s quadcopter example changes from integration to zero-cross timing as samples grow scarce. Its suggested thresholds are 10 carrier periods per sector on the way up and 16 on the way down. Those different thresholds keep the choice stable near the boundary. Both methods still need a usable signal. If it disappears, the controller needs a timeout and a defined response.

The prop in the bench illustrates a rotor following the sequence at the selected speed. The blank strip at the start of the sector represents 12 µs of settling. For simulated ADC samples, missed observations and six actual circuit-solver traces, continue to the ESC oscilloscope. The two NXP references behind this walkthrough are DRM144 §§2.2–2.4 and AN5169 §3.1. NXP single-motor reference design · NXP quad-motor reference design.

How slow can the PWM carrier be?

I’d start with two numbers from the motor and one from the application. Measure the inductance and resistance between the two driven leads, then decide how much peak-to-peak current ripple is acceptable. The windings see about 12 V across the pair during the supply pulse and about 0 V across it during synchronous recirculation. At 50% duty the average applied voltage is 6 V. With 2 V of opposing back-EMF and 0.50 Ω resistance, the average steady current is (6 − 2)/0.50 = 8 A. Change only the carrier frequency and that mean stays put. Look at what happens to the peaks.

One ideal synchronous phase pair at 12 V, 50% duty and 240 µH. The sample budget assumes seven pole pairs at 10,000 rpm and one ADC opportunity per PWM cycle.
CarrierOne periodCurrent ripple, peak to peakPeriods in one sector
1 kHz1 ms11.5 A0.14
20 kHz50 µs0.625 A2.86
50 kHz20 µs0.250 A7.14
50 MHz, ideal extrapolation20 ns0.25 mA7,143 nominal; no usable ADC window in this example

For a quick estimate, when the PWM period is short compared with L/R, ΔIpp ≈ Vbus D(1−D)/(L fPWM). A target of 1 A peak-to-peak gives about 12.5 kHz here. Select 60 µH in the bench, keeping everything else fixed, and the estimate rises to 50 kHz. Winding turns, magnetic geometry, saturation and the electrical connection affect the inductance the bridge actually sees. Pole pairs and maximum shaft speed set a different constraint. If the design needs six sampling opportunities per 60° sector at 10,000 rpm, its once-per-cycle sampler needs at least 42 kHz before accounting for blanking. Those are two different reasons a low carrier might fail. Motor diameter alone gives you neither number.

There’s an upper bound too. A 100 MHz timer has 5,000 ticks in a 20 kHz period and just two ticks at 50 MHz. The latter gives only one intermediate duty setting in simple edge-aligned PWM. A 10 ns on pulse also falls far short of the example’s 2 µs settling and acquisition budget. A real bridge needs gate transition time and dead time between complementary switches. Each transition dissipates energy, so at a given operating point switching loss grows roughly as energy per cycle × cycles per second. Raising the carrier shifts the ripple spectrum and may move an audible tone; gate edges, layout and load still matter for interference and heating. I’d check current ripple, valid sampling windows and device temperatures on the intended motor before settling on a carrier.

Where does the speed PI fit?

Imagine the propeller picks up more load while I’m asking for the same rpm. The time between rotor crossings gets longer. A speed controller compares that measured speed with my target. Its P term responds to the present shortfall. Its I term accumulates a persistent shortfall and can supply the extra torque the prop now needs. Some ESCs let that loop request duty directly with a current limit. Others use it to request current, then a faster current controller adjusts duty from measured current. A derivative term responds to the rate of change of the error and can amplify jitter in crossing-based speed estimates. Basic six-step timing works with a PI speed loop; it has no requirement for D.

At 100% duty the pair sees essentially the full bus during its sector. The windings still obey L di/dt = V − Ri − e. At standstill, e is zero and current can climb quickly. At speed the opposing voltage can leave very little headroom. Final rpm depends on where motor torque balances the propeller load and losses. If the command hits its limit, anti-windup keeps the speed integrator from accumulating a request the bridge cannot deliver. The division of jobs is simple: rotor feedback times the phase change, the PWM timer applies voltage, and the speed loop asks for enough torque to carry the load.

Put scope probes on the ESC: from 100 to 10,000 rpm

Keep the three motor leads in view and move the probes. A probe from terminal A to battery negative reads the switch node. A probe across A and B reads the voltage applied between two windings. A probe across the return shunt reads current. These signals can look quite different during the same PWM pulse.

A six-switch inverter wired to a three-phase outrunner, with MCU sensing paths and four synchronized ngspice scope traces.
Run the ESC scope and turn the motor. Try 12 V at 1,000 rpm. Select Two PWM periods and scrub the cursor across a falling edge. Then select 10,000 rpm and watch how much of a sector those same 100 µs occupy. The common 100× slow-motion clock lets you compare shaft speeds on screen.

Follow the current through one switching pulse

In step 1 the driver commands A high and B low during the supply pulse. A draws current from the positive rail; B returns it through its lower switch and the 10 mΩ shunt. During the PWM off-time, the model turns A’s lower switch on after a short dead interval. Current can now circulate through the two windings and the two lower devices. The winding inductance keeps current flowing while the DC shunt can read nearly zero. During switching, body diodes can carry current and briefly put a terminal outside the supply rails. Try the high-side and low-side voltage probes to see which device is blocking the bus.

Where does the MCU get back-EMF? Three matched voltage dividers scale A, B and C for the ADC. A 30 kΩ / 10 kΩ divider produces 3 V for a 12 V terminal. Convert the samples back to terminal volts, reconstruct a virtual neutral with (VA + VB + VC)/3, and subtract it from the floating terminal. The crossing is useful after outgoing current has decayed and the free phase is electrically quiet. The fourth scope trace shows why a switch edge by itself makes a poor crossing detector. The shunt uses its own differential amplifier and ADC channel. For example, 40 mV directly across 10 mΩ means 4 A of DC return current. The scope displays signals before analog gain, filtering and ADC quantization. NXP’s current and phase-voltage sensing example.

What current would I expect on 6 V or 12 V?

These six runs use the same example winding with two supplies. A motor’s voltage rating alone is insufficient to calculate its current. Here each phase has 0.25 Ω and 120 µH, the shunt is 10 mΩ, switch on-resistance is 15 mΩ, and the open-circuit line-to-line plateau is 0.45 V per 1,000 rpm. The model imposes trapezoidal back-EMF, seven pole pairs, roughly 49% driven duty and a 20 kHz PWM carrier. This electrical experiment uses an external drive to hold shaft speed. Its back-EMF constant is independent of the finite-element motor in the field lab.

ngspice results over one captured electrical turn. Positive bus current means the supply delivers power.
Shaft speedTime per sector6 V: mean bus / peak phase12 V: mean bus / peak phase
100 rpm14.29 ms2.52 A / 5.47 A5.09 A / 11.06 A
1,000 rpm1.429 ms1.76 A / 4.62 A3.80 A / 10.10 A
10,000 rpm142.9 µs−0.62 A / 1.50 A0.35 A / 1.41 A

The sign change at 6 V is worth a second look. At 10,000 rpm the model generates 4.5 V line to line, while the driven voltage averaged over PWM is roughly 3 V. With a shaft held at speed and synchronous switching, energy flows back into the ideal supply. A freely spinning motor under propeller load would change speed. For that question the mechanical equation is J dω/dt = Tmotor − Tload − bω. The shaft-dynamics example below integrates that equation with an explicit load. Here the ideal supply can absorb returned power; a physical bus may rise in voltage instead.

How does the timing code change as the bell speeds up?

At 100 rpm the line-to-line plateau is only 45 mV before the divider. That leaves time for many samples, but a real ADC can struggle to distinguish the crossing from offset and switching noise. A sensorless controller starts with alignment and a timed ramp, qualifies the crossing polarity over successive sectors, and hands timing over when the observations are consistent. At 10,000 rpm the signal is larger, yet the controller has only 2.86 PWM periods per sector. A valid crossing leaves about 71.4 µs to the ideal next commutation. Trigger the ADC from the PWM timer, exclude settling intervals, timestamp the crossing and schedule a timer compare using the latest sector duration. Missing crossings need a bounded recovery or shutdown policy; repeating the last timing indefinitely can lose synchronism. Current limiting uses the separate shunt samples. NXP’s PWM-synchronized sampling example.

The downloadable replay takes one sample 18 µs into each PWM period. This is the part of the Python code that turns its probes into the two signals the controller needs. The deck supplies the commanded sector; the replay checks for a crossing in that sector and interpolates its time. It computes the next ideal switch time as crossing + 0.5 * sector_time and reports the time remaining when the sample arrives. On a running controller, recent validated timings supply that sector period.

Read the current and position channelsPython
FLOATING = [2, 1, 0, 2, 1, 0]  # AB, AC, BC, BA, CA, CB
RSHUNT = .010

def sense(sample, sector):
    va, vb, vc, ia, ib, ic, shunt_volts = sample
    terminals = (va, vb, vc)
    neutral = sum(terminals) / 3
    return shunt_volts / RSHUNT, terminals[FLOATING[sector]] - neutral

Try the replay. At 12 V and 1,000 rpm the first sector produced 28 eligible samples and a crossing 714.3 µs into the sector. At 10,000 rpm it had two eligible samples and a crossing at 71.4 µs. The noiseless model makes interpolation look easy. Sampling jitter, diode conduction, propagation delay and amplifier recovery all become significant as that timing budget shrinks.

Reproduce the power-electronics experiment on Linux

Extract the outrunner lab. Install ngspice, Python 3 and NumPy. These commands generate the six-switch netlist, run its transient simulation and replay the ADC timing.

Run a 12 V captureBash
python3 esc_scope.py --bus 12 --rpm 1000 --out esc-run
python3 adc_replay.py esc-run/trace.dat --rpm 1000

Open esc-run/esc.cir to inspect the switches, antiparallel diodes and three star-connected phase branches. trace.dat contains seconds, three terminal voltages, three winding currents and the shunt drop in volts. scope.json contains the captures used by the browser, including the raw 100 µs windows. The electrical-turn overview applies a one-PWM-period moving average so narrow pulses remain readable at low speed. The numerical probes are ideal; the schematic’s sense amplifier and dividers explain the hardware interface. ngspice documentation.

Three waveforms you can actually tell apart

Back-EMF comes from the changing magnet flux linked by the windings. If λ is the permanent-magnet flux linkage of a phase, its induced voltage in the motor voltage convention is e = dλ/dt = ωₘ dλ/dθₘ. Double the speed at the same angle and you double this voltage. Measuring across A and B with the motor disconnected shows eₐ − eᵦ. Each coloured curve below is one phase relative to neutral. A two-wire scope measurement takes the difference of two curves.

Three trapezoidal back-EMF curves, stepped phase currents and their combined electromagnetic power over one electrical revolution.
Read vertically through the first sector. A sits at +3 V with +2 A, B at −3 V with −2 A, and C carries zero current. Both active phases contribute +6 W. The next pair takes over at 60°.

This gives “trapezoidal drive” a physical meaning. In the ideal example each back-EMF has a 120° flat top. The ESC picks two phases on opposite plateaus and gives each current of the matching sign. Converted power is Pₑₘ = eₐiₐ + eᵦiᵦ + ecic. Here that is 12 W across the turn. At 3,000 rpm, ωₘ ≈ 314 rad/s, so electromagnetic torque is about 0.038 N·m. Shaft output also has to cover mechanical losses. At zero speed the division P/ω is undefined. The flux-linkage relation still gives starting torque through the sum of i dλ/dθₘ over the phases.

Real motors have rounded back-EMF, and inductance prevents current from jumping instantly when a new pair takes over. Both effects can give torque ripple. The shape depends on the magnets and winding distribution. Some drone ESCs use field-oriented control, continuously commanding a current vector with rotor angle. A three-wire outrunner can run with either approach if the controller has suitable sensing, timing and motor parameters.

How much of the field actually reaches a tooth?

I like to draw one closed path first. Start in the rotor back iron, go through a north-facing magnet, cross the air gap into a tooth, follow the stator yoke to the next tooth and cross back into a south-facing magnet. Flux that makes that journey can link a winding. Some flux closes directly between neighbouring magnets or around a tooth tip. That leakage helps explain why the remanence on a magnet data sheet and the field at a winding are different numbers.

Two-gap iron circuit with a coil beside calculated gap field versus clearance for two magnet thicknesses.
Left, isolate the winding’s contribution and count both gap crossings. Right, isolate the magnet’s contribution. Both are idealized hand calculations you can use before opening a field solver.

Start with the coil. The drive around a magnetic circuit is its magnetomotive force, NI in ampere-turns. Each part of the loop has reluctance ℛ = ℓ/(μA), where ℓ is path length, μ is permeability and A is cross-sectional area. Flux Φ in webers is approximately NI divided by the sum of the reluctances. B is flux per area, in tesla. H in A/m measures the magnetizing field. In an air gap B = μ₀H. For a simple iron loop with two 0.5 mm gaps, 30 mm² faces and negligible iron reluctance, 50 turns at 2 A give B ≈ μ₀ × 100 / 0.001 = 0.126 T and Φ ≈ 3.77 µWb. Double both gaps and the winding contribution halves in this approximation.

Try the permanent magnet. Use one equal-area magnet and gap per symmetric half-loop. Call the magnet thickness lₘ, its remanence Bᵣ, its relative recoil permeability μᵣ and the clearance g. An ideal linear recoil line and negligible iron drop give Bg ≈ Bᵣ lₘ/(lₘ + μᵣg). With Bᵣ = 1.15 T, μᵣ = 1.05 and g = 0.5 mm, growing the magnet from 1.5 to 3 mm raises the ideal gap field from about 0.85 to 0.98 T. That’s roughly 15% for twice the magnet thickness. In a real motor I’d also check the magnet’s temperature-dependent demagnetization curve under peak opposing winding current.

Now cut slots into the iron. Near the edge of each tooth the field spreads into the surrounding air. A slot opening leaves less iron facing the magnet and increases the effective air gap in a circumferential average. Carter’s coefficient models that effect by using an effective gap kCg with kC greater than one. Deeper in the tooth the flux crowds through a smaller cross-section. If its B–H curve reaches the knee, another ampere-turn buys less extra flux. A real laminated core also loses energy through hysteresis and eddy currents. These are reasons to look closely at tooth-tip fields and obtain the steel data before choosing a continuous rating.

Connect the magnetic circuit back to the wires. If N turns all link flux Φ, their linkage is λ = NΦ. In a linear stationary circuit the self-inductance L = λ/i ≈ N²/ℛ. Some A-phase flux also links B or C, producing mutual inductance. A compact three-phase description is λ = L i + λPM(θ), where L is a 3 × 3 matrix. The winding voltage is v = R i + dλ/dt. Spin the rotor with all wires open and the changing magnet term alone produces voltage. Hold it still and change the current, and you can measure inductance. The finite-element experiment below does both on the same geometry.

For a deeper read, Duane Hanselman’s Brushless Permanent Magnet Motor Design, second edition, builds this progression in chapters 1–4. Chapters 6 and 7 develop winding layout and magnet design. J. R. Hendershot and T. J. E. Miller’s Design of Brushless Permanent-Magnet Motors is a companion for the practical sizing work.

Zoom into a single PWM pulse

Within one conducting pair, use the line-to-line equation v = Ri + L di/dt + e. All four terms refer to that same pair. The bridge applies v, the copper drops Ri, rotation produces e, and the remaining voltage sets the current slope. We can hold the rotor speed nearly constant for a handful of PWM periods and try that equation in ngspice.

The applied voltage switches between 0 and 12 volts while series winding current ramps between 3.69 and 4.31 amperes.
Four PWM periods, each 50 µs long. During the off interval the model provides a zero-voltage recirculation path. Current keeps flowing and ramps down.

I used a 12 V bus, 50% duty, 20 kHz PWM, 0.5 Ω and 240 µH for the pair, with 4 V opposing back-EMF. The simulated final period averaged 4.00 A, from 3.69 to 4.31 A. You can check the mean on paper. The average terminal voltage is 6 V. Subtract 4 V of back-EMF and the 2 V left across 0.5 Ω gives 4 A. Near that current the on and off slopes are about +25,000 and −25,000 A/s. Over half a 50 µs period that predicts 0.625 A of ripple, right where the plot lands.

One experiment to try below is doubling the PWM frequency while keeping 50% duty. The mean stays near 4 A and the ripple roughly halves. Increasing back-EMF instead moves the average current. That distinction helps explain why one throttle setting can draw very different current with two different propellers.

If I were choosing the copper, magnets and motor size

I’d start with one point on the propeller curve. A level 1.2 kg quad needs around 2.94 N per rotor in hover. Suppose a propeller stand shows that our chosen prop produces that thrust at 6,000 rpm using 35 W of shaft power. The required shaft torque is 35/(2π × 6,000/60) ≈ 0.056 N·m. The 35 W here is a design example. To use this calculation for a build I’d want measured thrust, speed and shaft torque for the actual prop, plus current and temperature over its operating range.

DecisionWhat I’d calculate or measure
Speed and batteryUse loaded battery voltage, target speed and room for winding and bridge drops. Kᵥ in rpm/V is a useful no-load starting point. Record whether voltage is line-to-line, phase, RMS or peak before converting a measured back-EMF constant to a torque constant.
Teeth, poles and windingChoose a feasible slot/pole winding and verify phase order, winding factor and electrical frequency. More turns generally give more flux linkage and torque per ampere, while using more slot area or requiring thinner wire. Check resistance and fill with real insulated wire.
Rotor, air gap and steelSet stack length, magnet arc, thickness, gap and back-iron depth. Inspect tooth and yoke flux density with the steel’s B–H curve. Check the bell’s stiffness, magnet retention, bearing loads, balance and overspeed margin separately.
Heat and electronicsEstimate copper loss as Σ Irms²R using hot winding resistance. Add iron, bearing and switching losses. Measure temperature at sustained torque, size the bridge for peak current, and leave voltage margin for bus transients.

I’d check the first prototype in that same order. Start with phase-to-phase resistance, inductance and open-circuit back-EMF versus speed. Then compare a current-limited no-prop run with the predicted electrical frequency and commutation timing. A guarded thrust stand can finally connect electrical measurements to thrust and thermal behaviour. The quadcopter model picks up from there, once we know what thrust and reaction torque we get from each rotor. Follow four rotor speeds into the vehicle dynamics.

Three Linux experiments, each answering a different question

1. Does the geometry fit? The exploded cover comes from the actual tetrahedral mesh of a small teaching model. It has a 30 mm outside diameter, a 6 mm stack, twelve rectangular teeth and fourteen separate magnet arcs. Gmsh exports it to STEP so you can open it in a mechanical CAD tool, hide the bell and inspect the radial clearance. The air-side contours earlier came from a separate ideal field calculation. In the field lab below we add the air gap, signed coil sides and magnet directions to a 2D slice and sweep rotor angle. We can compare two mesh resolutions here, then take the same line-voltage measurement on a prototype. Gmsh and GetDP through ONELAB provide a Linux starting point for that field solve.

2. What happens between switch edges? Copy the short deck below into conducting-pair.cir. Running it writes time, terminal voltage and winding current to ripple.dat. Try halving both the pulse width and period. Keeping Vemf constant deliberately holds us inside one sector. A whole bridge simulation would also need all six devices, their freewheel paths and commutation between sectors. ngspice.

Save as conducting-pair.cirtext
One commutation sector: equivalent of two series windings, ideal slow decay
Vbridge bridge 0 PULSE(0 12 0 10n 10n 24.99u 50u)
Rpair bridge wind 0.5
Lpair wind emf 240u IC=4
Vemf emf 0 4
.tran 0.2u 4m uic
.control
set wr_singlescale
set wr_vecnames
run
wrdata ripple.dat v(bridge) i(Lpair)
.endc
.end
Run the circuitbash
ngspice -b conducting-pair.cir
head ripple.dat

3. How do current, speed and angle evolve together? Our open-source motorDynamics C model advances three phase currents, mechanical speed and shaft angle. Its mechanical equation is J dω/dt = Tₑₘ − Tload − bω. A little excess torque changes speed, speed changes back-EMF, and back-EMF changes the next current. I ran its C reference trace for 0.2 s in 10 µs steps and compared it with SciPy’s independent DOP853 integrator. They agreed to within 1.61 mA on phase currents and 0.00125 rad/s on speed. This particular regression drives the terminals with smooth sinusoidal voltages. It checks the numerical integration of the averaged plant. A thrust stand answers the separate question of how well that plant represents a particular motor. Read the C implementation and the SciPy comparison.

Build the 3D outrunner geometry on Linux

Save the geometry below as outrunner.geo. Dimensions are in millimetres. The red and blue magnet groups in the cover identify opposite magnet orientations.

outrunner.geotext
// Teaching geometry in mm. Stationary steel and rotor components only.
SetFactory("OpenCASCADE");
Rbell = 15;
Rmag = 14;
Rface = 12.5;
Rtip = 12;
stack = 6;
magArc = 2*Pi/14 * 0.85;
Cylinder(1) = {0,0,0,0,0,stack,Rbell};
Cylinder(2) = {0,0,0,0,0,stack,Rmag};
bell[] = BooleanDifference{ Volume{1}; Delete; }{ Volume{2}; Delete; };
Cylinder(3) = {0,0,0,0,0,stack,7.8};
Cylinder(4) = {0,0,0,0,0,stack,5};
core[] = BooleanDifference{ Volume{3}; Delete; }{ Volume{4}; Delete; };
For k In {0:11}
  v = newv; Box(v) = {7.3,-0.8,0,Rtip-7.4,1.6,stack};
  Rotate {{0,0,1},{0,0,0},2*Pi*k/12} { Volume{v}; }
  core[] = BooleanUnion{ Volume{core[]}; Delete; }{ Volume{v}; Delete; };
EndFor
For k In {0:13}
  v = newv; Cylinder(v) = {0,0,0,0,0,stack,Rmag,magArc};
  cut = newv; Cylinder(cut) = {0,0,-1,0,0,stack+2,Rface};
  arc[] = BooleanDifference{ Volume{v}; Delete; }{ Volume{cut}; Delete; };
  Rotate {{0,0,1},{0,0,0},2*Pi*k/14-magArc/2} { Volume{arc[]}; }
  If(k%2 == 0)
    north[] += {arc[]};
  Else
    south[] += {arc[]};
  EndIf
EndFor
Physical Volume("Stator") = {core[]};
Physical Volume("Bell") = {bell[]};
Physical Volume("North inward") = {north[]};
Physical Volume("South inward") = {south[]};
Mesh.MeshSizeMin = 0.8; Mesh.MeshSizeMax = 1.2;
Export STEP and meshbash
gmsh outrunner.geo -0 -format step -o outrunner.step
gmsh outrunner.geo -3 -format msh2 -o motor.msh
Run the C motor and check it against SciPy

From a Linux shell with Git, CMake, a C compiler, Python, NumPy and SciPy installed, run the pinned example.

Build and compare the two integratorsbash
git clone https://github.com/antshiv/motorDynamics.git
cd motorDynamics
git checkout 1bca18cbf752a802a31cb12f50d941b68af62235
cmake -S . -B build
cmake --build build --target bldc_motor_trace
./build/bldc_motor_trace > motor-trace.csv
python3 tests/reference/test_scipy_bldc_motor.py --trace ./build/bldc_motor_trace

Linux field lab: from rotor geometry to a spinning shaft

Let’s take the same 12-slot, 14-pole idea through four tools. We’ll inspect a 3D teaching model in Gmsh, solve a 2D magnetic slice with Python and SciPy, turn field values into scope traces in GNU Octave, then couple those traces to the shaft. Download the runnable motor lab. The archive includes the geometry, field solver, Octave scripts and the earlier ngspice deck.

1. Open the geometry and decide what the solver needs

Extract the archive into an empty directory. On Debian or Ubuntu the commands below install the tools and export the 3D concept to STEP. In Gmsh, rotate the view down the shaft to inspect the twelve teeth and fourteen separate magnet arcs. The field solver uses its own explicitly meshed radial slice with sector-shaped teeth, so the air and slot regions can be resolved. Its 6 mm stack, 11.9 mm tooth-tip radius, 12.5 mm magnet-face radius, 1.5 mm magnets and 15 mm outside radius set the dimensions. Magnet coverage in this slice is five-sixths of a pole pitch. The 3D model has rectangular teeth and slightly different coverage.

Install tools, export and inspect the concept modelbash
sudo apt install gmsh octave gnuplot-nox ngspice python3-numpy python3-scipy python3-matplotlib
gmsh outrunner.geo -0 -format step -o outrunner.step
gmsh outrunner.step

2. Solve the magnetic field and inspect both current conditions

The solver divides iron, air and magnet regions into triangles. Each vertex has one unknown, the axial magnetic vector potential Az. Within each triangle its spatial derivatives give Bx = ∂Az/∂y and By = −∂Az/∂x. We alternate the direction of the magnets’ radial remanence and initially leave the windings open. Az is set to zero on the outer circle of air at 35 mm. The iron uses a constant relative permeability of 500. This makes a fast linear first pass. The colour at a tooth tip is where I’d look first when replacing that assumption with the real steel’s B–H curve.

Solve the coarse mesh and open the two field viewsbash
OPENBLAS_NUM_THREADS=1 PYTHONNOUSERSITE=1 /usr/bin/python3 field.py --out run
gmsh run/outrunner-field.msh
Computed 2D field map with alternating paths through the rotor bell and stator teeth and weaker flux in the surrounding air.
Open-circuit result from the refined mesh. Colour shows field magnitude in tesla and white contours follow flux paths. Follow a bundle as it crosses a gap and turns along the iron. The colour scale clips at 1.6 T.

Open the Post-processing views in Gmsh. The first field is open circuit. The second holds the same rotor position and drives A at +2 A, B at −2 A and C at zero. Toggle the views individually, keep their colour limits equal, and inspect the same tooth. The winding contribution adds to the magnet field in some places and opposes it in others. Each phase has four series coils, twelve turns per coil. The solver spreads each active side over its slot. Three unit-current solutions also give the self and mutual inductances in inductance.csv.

3. Take the scope around one electrical turn

At each rotor angle the solver adds the signed linkage of the coil sides and saves one λ for each phase. Octave differentiates the samples with respect to mechanical radians and multiplies by shaft speed. That produces volts. Subtract B’s trace from A’s for a two-lead measurement. The torque plot assigns +2 A to the phase with the highest EMF and −2 A to the lowest. Dividing converted power by speed gives the magnet–current torque for that ideal commutation. Finite switching time, cogging and losses would add structure to a bench trace.

Compare coarse and refined voltage and torquebash
octave --quiet --no-gui scope.m run
OPENBLAS_NUM_THREADS=1 PYTHONNOUSERSITE=1 /usr/bin/python3 field.py --refine 2 --out fine
octave --quiet --no-gui scope.m fine
Octave plot of three FEM-derived phase voltages and angle-dependent electromagnetic torque under ideal two-phase current.
With this geometry the phase voltages are rounded. Ideal two-phase current gives about 16.1–18.6 mN·m across the refined electrical cycle. The flat-topped example earlier gave constant torque because we deliberately supplied ideal trapezoids there.
Same motor and 3,000 rpm, with spatial and angular resolution refined together
TrianglesRotor positions per electrical turnA–B RMSMean ideal torque
32,760722.0586 V17.71 mN·m
132,0481442.0715 V17.81 mN·m

The RMS voltage moved about 0.62%. That tells us how sensitive this output was to one refinement. For a design decision I’d also vary the far boundary, check peak tooth fields with nonlinear steel, and measure open-circuit line voltage at a known rpm. A 2D slice leaves out end leakage, end-turn inductance and axial skew.

Try two design changes before building a second motor

Move the magnet ring and its steel bell outward together, keeping magnet thickness, stator and turns fixed. Doubling clearance from 0.6 to 1.2 mm cut A–B RMS from 2.059 to 1.438 V on the coarse mesh at 3,000 rpm. Now return to the original gap and double the coil turns from 12 to 24. The model gives 4.117 V RMS. The second change scales the linked turns exactly in this linear open-circuit calculation. Building it would require thinner wire or more slot area. For a loaded spin test I would update the phase resistance to match that wire.

Repeat one change at a timebash
OPENBLAS_NUM_THREADS=1 PYTHONNOUSERSITE=1 /usr/bin/python3 field.py --gap-mm 1.2 --out wide
octave --quiet --no-gui scope.m wide
OPENBLAS_NUM_THREADS=1 PYTHONNOUSERSITE=1 /usr/bin/python3 field.py --turns 24 --out rewound
octave --quiet --no-gui scope.m rewound

4. Apply voltage and let the rotor accelerate

Now let speed be an output. spin.m reads the field-derived linkage slopes and inductance matrix. At each time step it uses rotor angle to choose a balanced sinusoidal phase voltage with 3 V peak, subtracts winding drop and back-EMF, and advances the currents. Those currents produce torque. After subtracting drag and a propeller load proportional to speed squared, the remaining torque accelerates the inertia. The updated shaft angle feeds the next step.

Run the averaged motor with the refined field databash
octave --quiet --no-gui spin.m fine
# Optional time-step check. Writes the new trace into the same output directory.
octave --quiet --no-gui spin.m fine 0.00001
Simulated shaft speed rises from rest while phase current oscillates faster as the rotor accelerates.
The example reached 3,723 rpm at 0.30 s with 11.45 A peak phase current. Halving the integration step from 20 to 10 µs reproduced those values to the displayed precision.

To try a heavier propeller, increase the assumed inertia (1.5 × 10−5 kg·m²) to slow the initial acceleration. Separately increase the quadratic load coefficient (1.8 × 10−7 N·m/(rad/s)²) to load the motor more heavily at speed. We assumed 0.25 Ω per phase, known rotor angle from the first instant, a linear magnetic model and averaged terminal voltages. The current peak comes from this ideal voltage supply with no current limiter. Sensorless startup, individual switch and diode transients, and temperatures need additional models. The earlier ngspice example lets you zoom into one switch period.

Where would openEMS or OpenFOAM fit?

For the rotating magnets, I wanted flux versus rotor position and volts on the wires. The magnetostatic solve answers that on a laptop CPU. openEMS is a full-wave electromagnetic solver. I’d use it for a different question, such as high-frequency radiation or coupling from an ESC and its wiring. OpenFOAM also has a permanent-magnet field solver. Its fluid and heat-transfer tools become especially interesting once we have loss estimates and want to study airflow through the bell. For a coupled motor-design study, measured electrical losses and boundary conditions would be inputs to that cooling model. Gmsh viewer guide · GNU Octave manual.

Part 2 · from the timing diagram to C

In Part 2 I’d like to follow one commutation through the firmware. We’ll start with the six-entry phase table, then follow a PWM timer event into the ADC, check the floating phase for a valid zero crossing, and see how the controller schedules the next switch. That gives us a concrete place to bring in the startup ramp, current limiting and the speed PI loop.