# Implementing field oriented control of a brushless DC motor

An electric motor is a machine that converts electrical energy into mechanical energy. Electric motors are extremely important to modern-day life and are used in many different applications ranging from vacuum cleaners, dishwashers, computer printers, fax machines, video cassette recorders, machine tools, printing presses, automobiles, subway systems, sewage treatment plants, and water pumping stations.

Electric motors can be widely classified into 3 types: AC, DC, and universal. As the name suggests, an AC motor runs with AC power and a DC motor runs with DC power. Universal motors can run with both AC and DC power. Examples of AC motors are AC induction motors and squirrel cage motors. They are further classified as single-phase and multi-phase motors. Examples of DC motors include Brushed DC motors, Brushless DC motors (BLDC), and stepper motors.

**Existing Motor Control/Driving Techniques:**

DC motor drive is fairly simple to implement when compared to an AC motor drive. DC motors can be driven directly by means of a voltage–frequency (V/F) relation; i.e., the higher the applied voltage, the higher the frequency or speed. This kind of drive is typically implemented in brushed DC motors.

For AC motor drives and some motor drives where the controller converts the applied DC into AC to drive the motor (like BLDC or PMSM), complex driving algorithms are employed to commutate the coils in a sequence to achieve desired directional rotation. The rate at which the windings are commutated is proportional to the speed with which the motor runs. A wide range of control algorithms are available:

__ __

**Trapezoidal control:** Also known as 6-step control, this is the simplest algorithm. For each of the 6 commutation steps, a current path is formed between a pair of windings, leaving the third winding disconnected. This method generates high torque ripple, leading to vibration, noise, and poorer performance compared to other algorithms.

__ __

**Sinusoidal control:** Also known as voltage-over-frequency commutation, sinusoidal control overcomes many of the issues involved with trapezoidal control by supplying smoothly (sinusoidal) varying current to the 3 windings, thus reducing the torque ripple and offering a smooth rotation. However, these time-varying currents are controlled using basic PI regulators, which lead to poor performance at higher speeds.

**Field Oriented Control (FOC):** Also known as vector control, FOC provides better efficiency at higher speeds than sinusoidal control. It also guarantees optimized efficiency even during transient operation by perfectly maintaining the stator and rotor fluxes. FOC also gives better performance on dynamic load changes when compared to all other techniques.

**What is Field Oriented Control?**

Field Oriented Control is one of the methods used in variable frequency drives or variable speed drives to control the torque (and thus the speed) of three-phase AC electric motors by controlling the current. With FOC, the torque and the flux can be controlled independently. FOC provides faster dynamic response than is required for applications like washing machines. There is no torque ripple and smoother, accurate motor control can be achieved at low and high speeds using FOC.

The torque of an induction motor is at a maximum when the stator and the rotor magnetic fields are orthogonal to each other. In FOC, the stator currents are measured and adjusted so that the angle between the rotor and stator flux is 90 degrees to achieve the maximum torque (as shown in the following figures)

FOC operates on the resultant vector of the three phase currents rather than controlling each phase independently. The control variables of an AC induction motor are made stationary (DC) using mathematical transformations. In a way, FOC tries to control an induction motor by imitating DC motor operation as it deals with stationary parameters.

There are two methods used in FOC. Using Direct FOC, the rotor flux angle is directly computed from flux estimations or measurements. With Indirect FOC, the rotor flux angle is indirectly computed from available speed and slip computations.

The steps involved in sensored FOC are as follows:

**Step 1: **

Two of the three stator phase currents are measured and the third current is determined using Kirchoff’’s current relation,

Ia + Ib + Ic = 0

Where Ia, Ib, and Ic are phase currents.

**Step 2: **

The three phase currents are converted into a 2-axis coordinate system from the 3-axis system of the stator, using a Clarke transformation,

Where Ia and ß are the stator currents transformed to the 2-axis coordinate system.

**Step 3: **

The components along the 2-axis of the stator currents are time varying in nature and to track them using traditional PIs is complex. Rather, the stationary reference is rotated based on the rotor position (which is determined with the help of sensors or from back EMF) to a rotary reference where the components along the axis remain constant and traditional PI controllers can be used to counter any error. This rotation is done using a Park transformation,

Where Id and Iq are the in-phase and quadrature phase stator currents from the rotor perspective.

**Step 4: **

Once the vectors have become time invariant, we can compare the corresponding axis vectors with the reference and use a PI controller (see equation below) for each axis to determine the error correction signal. The Id reference controls the rotor magnetizing flux. The Iq reference controls the torque output of the motor.

** **

** **

**Step 5: **

The corresponding outputs of the PI controllers are then passed through an inverse Park and Clarke transformation to convert them back to the 3-phase stator reference.

**Step 6: **

With the 3-phase reference signals generated, the PWM is modulated using Space Vector Modulation (SVM).

** **

**Why FOC?**

The scalar control or the six-step commutation process, which was traditionally used for controlling BLDC motors based on the hall sensor inputs (or also sensorless), has a dynamic response. It energizes a pair of windings only when the motor reaches the next position, and the commutation is moved to the next step. In the case of a sensored implementation, hall sensors are used to determine the rotor position and the motor is commutated accordingly. The advantage of scalar control is that it is very easy to implement. Some advanced scalar control methods use the back EMF generated from the motor to determine the rotor position. However, this kind of dynamic response is not suitable in applications where the load changes dynamically within a cycle. Only advanced algorithms such as FOC can handle these dynamic load changes.

The following example shows how to implement an FOC control algorithm. For this example, the PSoC 3 from Cypress is used. The subsystem is split into several major modules:

The various modules of a Field Oriented Control control algorithm (as implemented using the PSoC 3 from Cypress).

** **

- Current reconstruction module

A two-shunt method is used to reconstruct the currents. With this method, the current from two legs are measured and the third current is reconstructed using Kirchhoff’s current law. The PWMs are designed to be center-aligned, and the two current samples are captured at the center of the PWM period, every FOC cycle. Once the samples are taken, the FOC begins the ADC conversion of these samples, and the currents are reconstructed.

- Clarke and Park transformations

The reconstructed currents are then transformed to 2-phase stator reference and then to 2-phase rotor references using Clarke and Park transforms respectively. Once the transformations are completed, the current in the rotor reference is ready to be regulated for the desired speed and torque.

- PI regulators

Generic PI controllers with adjustable gain and min-max saturation were implemented to regulate the 2-phase rotor reference current and the speed of the motor.

- Inverse Park and Clarke transforms

The regulated output is then converted to the 3-phase reference (PWM duty cycle) again, to adjust the speed of the motor, by passing it through Inverse Park and Clarke transforms.

- SVM (Space Vector Modulation)

The space vector modulation technique is used to generate a sine wave to be fed to the stator coils. Based on the 3-phase reference generated by the inverse Clarke transform, the SVM generates the PWM compare values, which are phase shifted 120 degrees.

**Speed and Position sensing**

First, the speed is measured by measuring the period between two rising or falling edges of one of the Hall sensor inputs. The period measured is nothing but one electrical period, which is the inverse of the electrical frequency or speed.

By accumulating this electrical speed value over every FOC cycle, the position ‘T’ is computed. In this example, the FOC cycle is **200µS. **We use the relationship

The position T can also be calculated using the encoder inputs in place of hall sensor. Instead of accumulating speed, we get the position information directly.

With the kind of efficiency FOC brings enables, significant energy and dollar savings can be made by implementing this control technique to drive the motors which drive the world. And, with the flexibility, resources, and compact architecture provided SoCs such as the PSoC 3, the entire control algorithm inclusive of hardware (other than the driver board) can be implemented in a single chip.

**About the Author**

**Meenakshi Sundaram** is an Applications Engineer at Cypress. He graduated from the College of Engineering Guindy, Chennai, India, with a major in Electronics and Communication engineering. Currently, he works on PSoC and related applications at Cypress.

Author

eeguru85 10/20/2014 5:24:26 PM

Author

FrankV2 6/3/2012 1:13:31 PM

Author

Fred Etch 2/28/2012 6:39:05 PM

Author

CMathas 1/11/2012 8:20:23 PM

Author

perriejb 1/6/2012 12:08:36 PM

Author

Hallo 1/5/2012 3:04:01 PM