Motor Control 

(Under Construction)

Motor control is a deep and wide area of study.  It requires an understanding of not only electronics and programming but of the underlying physics and mathematics as well.  

It will take a while for me to create useful content in this section.  In the meantime, I highly recommend Jantzen Lee's 14-part YouTube series entitled Understanding Motors.  It starts off with the basics and takes you through space vector PWM (and more).

Below are lectures number two and eight. 

 Torque Mode

Torque mode is the simplest of all motor control strategies.  It maintains the motor's output torque at a constant value for any given throttle position.   Torque mode has no inherent method to prevent excessive speed when the load is reduced.  However, it gives a very direct driving experience, much like a traditional ICE vehicle without cruise control.

This is in contrast to Speed mode which maintains the motor at a constant speed for a given throttle position as long as sufficient torque is available.  Speed mode differs from torque mode in that the torque value applied to the motor is calculated by the controller based on the operator’s requested speed (determined by throttle position) and the vehicle’s actual speed.  This mode is useful where accurate speed control is required irrespective of the motor torque.


Commutation is defined as the periodic reversal of the direction of current flow through the motor winding so that current flow in the circuit external to the motor continues in only one direction.  

The table below shows the relative merits of four commutation methods.  Although brushes are only applicable to a DC (or universal) motor, they are included for comparison with the 3-phase commutation methods.

Different labeling conventions are used to name the three phases.  Commonly A-B-C, U-V-W, or 1-2-3.

Field Oriented Control

Field-oriented control (FOC) of a BLDC motor is a technique based on the concept of vector control used in 3-phase AC motors.

In addition to precise control of the motor's performance, FOC also provides benefits such as improved energy efficiency, better dynamic response, improved stability, and minimal acoustic noise.

FOC is computationally intensive and requires a high-performance processor and precise estimation of rotor position and speed.  The estimate can be obtained by using a rotary sensor or by using a sensorless model-based “observer” algorithm.

FOC utilizes mathematical transformations to independently control the motor's magnetic field (flux) and torque.  The stator currents of the motor are broken down into two components, the d-axis current and the q-axis current.

The d-axis current produces the flux (magnetic field that surrounds the motor).  It is called the d-axis current because it is related to the direct axis of the motor.  The direct axis is a reference axis in the motor's coordinate system that is aligned with the direction of the stator flux.

The q-axis current produces the torque.  It is called the q-axis current because it is related to the motor's quadrature axis (perpendicular to the direct axis).

By separately controlling the d-axis current and the q-axis current, the motor's torque and speed can be precisely controlled.  This is achieved by adjusting the timing and magnitude (via PWM) of the voltage applied to the stator, which in turn controls the stator current.

A feedback control loop is employed.  It starts by measuring the actual stator currents (both d-axis and q-axis) and comparing them to the desired or reference stator currents.  The difference between the actual and reference stator currents is known as the error signal.

The control loop includes a current PI (proportional-integral) controller, which uses the error signal to adjust the voltage applied to the motor thereby causing the stator current to change. 

The new stator current is measured and the process is repeated with the current error signal being used to generate a new control signal.  This process continues in a closed loop, with the controller continuously adjusting the voltage applied to the motor to maintain the desired stator currents and control the motor's performance.

FOC phase voltages, illustrating periods when all are connected to the voltage source. 

Oscilloscope trace of FOC operation illustrating periods when all three phases are connected to the voltage source.  This is in contrast to trapezoidal commutation in which only two phases are driven at a time.  

Field (Flux) Weakening

Field weakening allows a motor to drive a load at speeds (RPM) that would otherwise be limited by battery voltage.

Flux weakening can be implemented as part of the FOC algorithm.  As a motor's speed increases, its back-EMF also increases at a linear rate.  Assuming the load will allow it, a motor reaches its maximum speed when its back-EMF equals its supply voltage.  Flux weakening decreases the motor's back EMF by injecting a negative current in the d-axis (weakening the magnetic field), thereby allowing it to attain a higher speed with the same supply voltage.

The limitation of flux weakening is a speed/torque trade-off.  There is no free lunch, maximum power will be constant and any increase in speed will come at the cost of reduced torque.


Boosting is the opposite of field weakening.  Boosting (intensifying) the flux field will allow the motor to temporarily increase torque production.

Both boosting and field-weakening operations require additional motor current.  The direction of the motor current across the d-axis, provided by the motor controller, determines the desired effect.