Motor Control

Winding sequence, rotation direction and rotor angle: getting the three to agree

A PMSM under field-oriented control only produces smooth torque when three things agree: the physical order of the phase windings, the time order of the phase currents, and the direction in which the measured rotor angle counts. Get one of them backwards and the motor locks, growls or runs away. This article explains the rule that links them and how to recover the right mapping from an unlabelled motor on the bench.

Quick reference
  • The field moves from the axis of the phase whose current peaks first to the axis of the phase that peaks next.
  • Seen from the shaft end, a stator wound A-B-C clockwise and fed A-B-C currents gives a clockwise field and a clockwise rotor.
  • The electrical angle must increase in the direction the field turns for A-B-C currents, advance p electrical turns per mechanical turn, and read zero with the rotor d-axis on the phase A axis.
  • Motor jerks and locks under FOC: sequence and angle direction disagree. Swap two leads or flip the angle direction, never both.
  • Motor runs but is weak, hot or runs away: the angle offset is wrong. Recalibrate it.

The article assumes a three-phase PMSM under field-oriented control with an absolute position encoder on the shaft.

Fix the convention first

Direction words mean nothing until the viewpoint is fixed. Throughout this article the motor is viewed from the shaft (drive) end, and counter-clockwise (CCW) is the positive direction for angle, speed and torque. This is the mathematical convention used by most FOC derivations. Viewed from the opposite end, every "CCW" below becomes "CW", so always write the viewing end next to any direction you record.

Two angles are used. The mechanical angle θm is what the shaft does. The electrical angle is what the controller needs:

θe = p · θm + θoffset p = number of pole pairs  •  θe = 0 when the rotor d-axis (magnet north) lies on the phase A axis

What "winding sequence" means

Each phase winding has a magnetic axis: the direction of the field it produces when it carries positive current. In a balanced three-phase winding the three axes sit 120° electrical apart. The winding sequence is the order in which you meet those axes as you walk around the air gap. If you meet A, then B, then C while walking CCW, the winding sequence is CCW. If you meet them in that order walking CW, it is CW.

The current sequence is the same idea in time. Currents are in A-B-C (positive) sequence when A peaks first, B peaks a third of a period later, and C a third of a period after that:

ia = I sin(ωt)    ib = I sin(ωt − 120°)    ic = I sin(ωt − 240°)

The rule: the field travels from the leading phase to the lagging phase

Put those currents into a winding whose axes are at 0°, +120° and +240° electrical and add the three pulsating fields. The backward-travelling parts cancel and what is left is a single wave of constant amplitude:

F(θ, t) = (3/2) F1 sin(ωt − θ) The peak sits at θ = ωt − 90°, so it moves in the direction of increasing θ

The peak of the field is on the A axis when ia peaks, on the B axis when ib peaks, and on the C axis when ic peaks. So the field always moves from the axis of the phase that peaks first towards the axis of the phase that peaks next. That one sentence answers the direction question for every case:

Winding sequence (shaft end view)Current sequenceRotating field and rotor
A-B-C counter-clockwiseA-B-CCCW (positive)
A-B-C counter-clockwiseA-C-BCW
A-B-C clockwiseA-B-CCW
A-B-C clockwiseA-C-BCCW (positive)

So a stator wound A-B-C clockwise and fed A-B-C currents produces a clockwise rotating field. A synchronous rotor locks to that field, so it also turns clockwise, at a mechanical speed of ω/p. In the CCW-positive convention that is negative speed.

θe d A B C field A-B-C placed CCW: field and rotor turn CCW A B C field A-B-C placed CW: field and rotor turn CW Viewed from the shaft end, currents in A-B-C time sequence
Phase magnetic axes in electrical degrees. The field moves from the A axis to the B axis to the C axis. The dashed arrow on the left is the rotor d-axis, and θe is measured from the A axis in the direction of A to B.
Animation: each coloured arrow is the field of one phase, pulsating along its own axis as its current rises and falls. The white arrow is their sum. It keeps a constant length and points at the A axis when the A current peaks, then B, then C. Both stators receive the same currents, shown below. Only the placement of the windings differs.

Which way must the rotor angle count?

FOC does not generate a rotating field on its own schedule. It reads the rotor angle and places the current vector 90° electrical ahead of the rotor d-axis (for pure q-axis current). The Park transform that does this assumes the same geometry as the figure above: θe is measured from the A axis, positive towards the B axis.

That gives the requirement directly. The measured electrical angle must increase when the rotor turns in the direction in which A-B-C currents rotate the field. Three conditions have to hold together:

With an absolute encoder these three conditions reduce to three stored numbers: the pole-pair count p, a direction sign s (+1 or −1) and the zero reading N0.

θe = p · s · (N − N0) · 360° / CPR   (mod 360°) N = encoder reading  •  N0 = reading with the d-axis on the A axis  •  CPR = counts per mechanical revolution

Because the encoder is absolute, s and N0 are found once and remain valid at every power-up. No alignment move is needed at start-up, but the values are only valid for that lead order and that encoder mounting. Change either and they must be found again.

An equivalent test that needs no knowledge of the winding: spin the motor by hand in the direction that makes the angle increase. The back-EMFs must then appear in A-B-C order. Back-EMF sequence and angle direction are two views of the same fact.

When all three hold, positive iq gives positive torque, the rotor accelerates in the direction of increasing angle, and the back-EMF appears on the positive q-axis.

What happens when something is swapped

The controller sends three sinusoidal currents with a common phase angle γ:

ia = I sin(γ)    ib = I sin(γ − 120°)    ic = I sin(γ − 240°) Together they form one current vector of magnitude I at angle φ = γ − 90° from the A axis

Suppose leads B and C are swapped. The winding on the B axis now carries ic and the winding on the C axis carries ib. Add the three contributions along their real axes and the result is a vector of the same magnitude at angle −φ: the mirror image of the intended vector about the A axis. Swapping a different pair mirrors about the axis of whichever phase was left alone.

Under FOC with pure q-axis current the controller sets γ = θe + 180°, which makes ia = −I sin(θe), in phase with the phase A back-EMF. The current vector is then at φ = θe + 90°, always a quarter turn ahead of the rotor. After the mirror the stator vector sits at −θe − 90°, so its angle measured from the rotor d-axis is no longer a constant 90°:

δ = −2θe − 90°   →   T ∝ I sin(δ) = −I cos(2θe) Torque changes sign four times per electrical revolution. For positive I the stable rest points are θe = −45° and 135°

The rotor is pulled to the nearest stable point and held there. Reversing the encoder direction has the same effect, because it replaces θe by −θe in the command and again leaves a −2θe term. Doing both restores a constant δ, which is why two errors cancel.

Animation: the rotor is turned slowly through one electrical revolution to show the torque at each position. Left, the stator field stays a quarter turn ahead and the torque is constant. Right, with B and C swapped, the stator field turns the opposite way to the rotor, so the torque alternates. Released, the rotor falls into one of the two circled rest positions and stays there.

This is the classic symptom: the motor jerks a few degrees, locks, and sits there drawing whatever current the loop commands. A speed loop makes it worse because its integrator winds up to the current limit.

FaultWhat you seeFix
Two motor leads swappedOpen-loop (V/f) drive: runs smoothly, wrong direction. FOC: jerks, locks at a position, high current, no rotation.Swap any two leads back, or reverse the angle direction.
Angle counts backwardsIdentical to swapped leads under FOC.Flip the direction sign s in the drive, or the direction setting of the encoder.
Both of the aboveRuns correctly after the offset is recalibrated, but the shaft turns the opposite physical way for a positive command.Nothing, if that direction is acceptable. Otherwise undo both.
Leads rotated (A-B-C connected as B-C-A)Sequence is still positive, but the angle is off by 120°. With the old offset, positive iq gives −50% torque and a large d-axis current. A speed loop runs away.Recalibrate the offset. No rewiring needed.
Offset error εTorque falls as cos(ε). Unintended field weakening or strengthening. Different no-load speed in each direction.Recalibrate the offset.
Two current sensors assigned to the wrong phasesMotor wiring is fine but the controller sees a mirrored current vector. Measured id, iq oscillate at twice the electrical frequency. Noise, overcurrent trips as speed rises.Correct the sensor-to-phase mapping in software.
One phase connected with reversed polarityNot a sequence fault. Back-EMFs are 60° apart instead of 120°. Strong vibration and low torque with any lead order.Swap start and finish of that phase.

Of the six ways to connect three leads to three terminals, three keep the positive sequence (A-B-C, B-C-A, C-A-B) and differ only by a 120° angle shift. The other three (A-C-B, C-B-A, B-A-C) reverse it. A fresh offset calibration absorbs the first kind. Only a swap or a sign change fixes the second.

Why looking at the stator is not enough

On a distributed winding you can often read the sequence off the sample. Walking around the bore, the phase belts appear in the order A+, C−, B+, A−, C+, B−. The direction in which you read that order is the direction of the A-B-C sequence.

On a fractional-slot concentrated winding the same reasoning can give the wrong answer. What matters is the electrical position of each tooth, which is p times its mechanical position. Take three teeth A, B, C placed CCW at 0°, 120° and 240° mechanical:

Same three teeth, two different rotors

2-pole rotor (p = 1): electrical positions 0°, 120°, 240°. B is 120° ahead of A. A-B-C currents turn the rotor CCW, the way the teeth are laid out.

4-pole rotor (p = 2): electrical positions 0°, 240°, 480° = 120°. Now C is 120° ahead of A. The same currents turn the rotor CW, against the tooth order.

Animation: the same three teeth carry the same A-B-C currents on both sides. Each tooth lights up when its current is at its positive peak. A north pole follows the lit tooth in both cases, but the 2-pole rotor has to turn CCW to do it and the 4-pole rotor has to turn CW, at half the speed.

The same thing happens between 12-slot/10-pole and 12-slot/14-pole machines. They can share an identical stator, but the 10-pole rotor rides the 5th MMF harmonic and the 14-pole rotor rides the 7th, and those two harmonics travel in opposite directions. Same winding, same currents, opposite rotation. This is why a measurement is more trustworthy than an inspection.

Finding the right mapping on an unlabelled motor

Either method below gives the terminal labels, the angle direction and the angle offset together. Mark the shaft so its direction is easy to see, and note the viewing end.

Method 1: back-EMF, no drive needed

  1. Disconnect the motor from the drive. Connect three equal resistors (a few kΩ) from the terminals to a common point to create an artificial neutral, and put a scope channel on each terminal with respect to that point.
  2. Spin the shaft steadily in the direction you want to call positive (CCW from the shaft end here). A hand drill works well.
  3. Pick any terminal and call it A. The terminal whose voltage peaks 120° later is B. The one that peaks 240° later is C. These labels are now correct for that direction by construction.
  4. Watch the position sensor during the same spin. The count must increase. If it decreases, set the direction sign s to −1.
  5. Check the scale: the number of electrical cycles per mechanical turn is the pole-pair count p.
  6. Find the zero. With the rotor turning in the positive direction, the phase A back-EMF is ea = −ωψ sin(θe). So θe = 0 at the falling zero crossing of ea, and ea peaks at θe = −90°. Capture the encoder reading at that crossing: it is N0.
A B C θe = 0 180° 360° electrical angle, rotor turning in the positive direction
Phase-to-neutral back-EMF for positive rotation. The peaks arrive in the order A, B, C, 120° apart. The dashed line marks θe = 0, the falling zero crossing of phase A, where the rotor d-axis is on the A axis.

If you can only measure line-to-line, the sequence test is unchanged (vab, then vbc, then vca), and vab leads ea by 30°.

Method 2: DC alignment steps

A DC current vector pulls the rotor d-axis onto itself. Stepping the vector in a known electrical direction and watching the shaft reveals everything. Use a current-limited supply or the drive itself at roughly 10 to 30% of rated current, with the shaft unloaded.

StepCurrent inCurrent outVector angle (electrical)
1AB and C0°
2A and BC60°
3BA and C120°
4B and CA180°
5CA and B240°
6A and CB300°
  1. Label the terminals A, B, C arbitrarily and apply step 1. The rotor snaps to the A axis. Record the encoder reading: this is N0.
  2. Apply steps 2 to 6 in order. Each one should move the shaft by 60°/p mechanical in the same direction.
  3. If the shaft steps CCW, your labels are a CCW-positive A-B-C. If it steps CW, swap the labels on any two terminals and repeat from step 1.
  4. The encoder reading must increase at every step. If it decreases, set the direction sign s to −1.
  5. Count the steps in one full mechanical turn. The count equals 6p, which confirms the pole-pair number.
Animation: the alignment sequence on the example motor from the next section, after the labels have been corrected. Each step moves the current vector 60° electrical. The rotor d-axis snaps onto it, the shaft advances 12°, and the encoder reading rises by about 136.5 counts, wrapping past 4095 once per turn.

Friction and cogging torque stop the rotor slightly short of the true axis. For a better offset, approach the zero position once from each side and average, and repeat over several pole pairs. The automatic commissioning routine in most FOC drives is this same procedure with a slowly rotating vector: it compares the commanded electrical angle with p times the encoder angle, and a slope of +1 means sequence and direction agree while −1 means one of them is reversed.

Worked example: 12-slot/10-pole motor, 12-bit absolute encoder

The numbers below are illustrative. The motor has p = 5 and the encoder gives 4096 counts per revolution, so one electrical revolution is 4096 / 5 = 819.2 counts and one 60° step is 136.5 counts, or 12° of shaft rotation.

First pass. The three leads are unmarked. Call them X, Y, Z and try A = X, B = Y, C = Z. Run the six alignment steps of Method 2:

Vector angle0°60°120°180°240°300°
Encoder reading331031733037290027642627

The shaft moves 12° per step, but clockwise from the shaft end, and the count falls. So this labelling is a CW-positive A-B-C, which is not the convention we chose. Note that count and shaft agree with each other: the count falls when the shaft turns CW, so it will rise when the shaft turns CCW. The encoder direction is already right.

Second pass. Swap two labels: A = X, B = Z, C = Y. Repeat:

Vector angle0°60°120°180°240°300°360°
Encoder reading33103447358337203856399333

Now the shaft steps CCW and the count rises by about 136.5 per step. The last reading wraps past 4095: 3310 + 819.2 = 4129.2, which the encoder reports as 33. That is the A axis of the next pole pair. Continuing all the way round takes 30 steps, confirming 6p = 30 and p = 5.

Result

Terminals: A = X, B = Z, C = Y  •  p = 5  •  s = +1  •  N0 = 3310

θe = 5 × (N − 3310) × 360° / 4096  (mod 360°)

Check at N = 3447: 5 × 137 × 0.0879° = 60.2°, matching the 60° step.

Check at N = 500: 5 × (−2810) × 0.0879° = −1234.9°, which is 205.1° after adding four full turns.

One count is 0.44° electrical on this motor, so the encoder resolution is not the limit. Cogging is: repeat the 0° step on a few pole pairs, approaching from both sides, and average the implied N0. Finish with a small positive iq command and confirm that the shaft turns CCW with the count rising.

Commissioning checklist

See the phase layout of any slot/pole combination

Generate the winding layout and star of slots, and check which MMF harmonic your rotor follows.
Open Winding Tool →
← Back to all articles