*By Jia Li, Engineer, Monolithic Power Systems*

Permanent Magnet Synchronous Motors (PMSMs) are widely used in electric vehicles, robots, home appliances and other products. For good dynamic response and motor performance, engineers normally use a form of vector control method to drive a PMSM.

Vector control requires a means to measure the speed and position of the rotor. Optical quadratic sensors or Hall effect magnetic position sensors are the most common types of sensor used for this function, but they are expensive components.

A promising alternative technique for driving a PMSM is to use a combination of a low-cost magnetic angular sensor and a dynamic observer to estimate the rotor speed. The motor control module from Monolithic Power Systems (MPS) implements this technique. It includes a motor-control ASIC, a magnetic angular sensor, and a three-phase MOSFET power stage and pre-drivers, all mounted on a single PCB to fit NEMA 23- and NEMA 17-format motors.

The motor-control ASIC provides excellent computation ability for applications such as electric motor drives. It works with the MA702, a 12-bit magnetic angular sensor which detects the absolute position of the rotor. The MA702 is cheaper than an optical quadratic or Hall effect sensor.

The motor’s speed can be calculated from continual rotor position measurements by a dynamic state observer. The ASIC uses the dynamic observer to filter out position measurement noise and to estimate the rotor speed, enabling the system to implement vector-based Field- Oriented Control (FOC) effectively.

##### The operation of FOC

Three-phase PMSM machine operation is expressed here as:

Where: *v*,*i*,and *λ* are the voltage, current, and flux respectively.

The subscripts * a*,

*, and*

**b***represent the variables in phases*

**c***,*

**a***, and*

**b***. Subscript*

**c***is the stator variable,*

**s***represents the derivative of the certain value, and*

**ρ***is the number of poles in the motor.*

**P**The electromagnetic torque, * T_{e}*, is produced by the three-phase current and the rotor flux.

*is the rotor flux sensed on the stator side of the motor. The angle*

**λ´**_{m}*is the electrical angle between the rotor flux and the stator’s a phase.*

**θ**_{e}To perform FOC, a dynamic model under q-d is required to decouple the air gap-flux and electromagnetic torque. Following the Clarke-Park transformation, the PMSM model in equation set 1 under the synchronous rotating q-d frame is calculated with the equation:

Where: the subscripts * q-d* are the q-d axis variables.

*is the self-inductance and*

**L**_{s}*is the mutual inductance of the machine.*

**L**_{m}

To further simplify control, the rotor flux should be aligned on the d-axis while there is zero rotor flux on the q-axis. The flux is calculated with the equation:

The electromagnetic torque is estimated with the equation:

Following the transformation steps performed in the four equation sets, the magnetic flux can be directly controlled by the d-axis current. With a constant * i_{ds}*, the torque,

*, can be controlled directly by manipulating the q-axis current. If*

**T**_{e}*=*

**i**_{ds}*, then the electromagnetic torque is directly proportional to*

**0***. Figure 1 shows the PMSM FOC technique in schematic form.*

**i**_{gs}*Fig. 1: PMSM FOC schematic*

The outer loop reference makes a comparison with the measured variables, and feeds the error to a controller, a PI controller is the most common type, to generate the command torque current, * IQ_{ref}*. The d-axis current reference,

*, is set according to the magnetic flux requirement. The output of the current regulators/controllers,*

**ID**_{ref}*,*

**VD**_{ref}*,*

**VQ**_{ref}*and*

**VD**_{ref}*, are the input for the space vector PWM. The PWM block generates the gate signals for the inverter to drive the motor.*

**VQ**_{ref}##### Driving the motor with no speed sensor

The MA702 detects the position of a permanent magnet, * θ_{e}*. The speed of the rotor can be calculated as

*=*

**ω**_{e}*. A digital sensor, the MA702 inevitably introduces noise into the position measurement: this calls for the addition of a digital filter/estimator.*

**ρθ**_{e}The system estimator can be based on the mechanical PMSM model using the equation:

Where: * T_{e}* is the electromagnetic torque and

*is the load torque. ωm and θm are the mechanical rotor speed and position, compared to the electrical rotor speed and position*

**T**_{l}*and*

**ω**_{e}*.*

**θ**_{e}*is the pole number of the PMSM. The parameters*

**ρ***and*

**J***represent the PMSM inertia and the combined viscous friction of rotor and load respectively.*

**B**The MA702 feeds the absolute rotor position to the motor-control ASIC, making the mechanical model system matrix A a simple 3x3 matrix with only two non-zero elements. A simpler system matrix helps to decrease the computation burden on the microcontroller, making the algorithm easier to implement and faster to execute.

The state variables * x*,

*, and*

**Є***, are the states of a system process that can be expressed in discrete time with the equation:*

**R**^{n}

Where: * u* is the input variable and y is the output measurement. w and v are the process and measurement noise with noise co-variance of

*and*

**Q***respectively.*

**R**

Following classic control theory, a state estimator with estimator gain k can be calculated with the equation:

The notation * a_{n|m}* represents the estimation of a at step

*up to the observation of step*

**n***and*

**m***. The carat^ denotes that the variable is estimated.*

**m ≤ n**Unlike the classic state observer using a constant gain * k*, a dynamic observer recursively updates its estimator gain

*with each iteration.*

**k**Compared to the FOC schematic shown in Figure 1, the dynamic speed observer schematic uses machine measurements as the system input, as shown in Figure 2. The dynamic observer outputs the filtered/estimated rotor speed.

*Fig. 2: Dynamic observer-based FOC*

##### Measured performance on reference motor design

To validate its algorithm, MPS measured its performance on an example motor system. The MPS Motor Control Module, designed for 57mm NEMA 23 motors, can be directly mounted on the motor, as shown below in Figure 3.

*Fig. 3: The MPS Motor Control Module (left) and MPS Smart Motor (right)*

Because the MA702 angular sensor feeds absolute rotor position measurements to the motor-control ASIC, the implementation of the dynamic observer’s recursive iteration is easier, and places a low computation burden on it. Since the measurement is only of one variable, the observer’s gain calculation is a simple division. The entire dynamic observer calculation takes less than 20μs for each iteration.

Figure 4 shows a wide range of reference speeds, from 1,000rpm to -500rpm, fed to the motor-control system’s simulator in step changes. The dynamic observer estimated speed can still track the motor speed accurately in real time at each different speed step. The algorithm can also give a stand-still reference.

*Fig. 4: Step-speed response in real time*

##### Conclusion

This article presents a promising solution for PMSM FOC based on a combination of a low-cost magnetic angular sensor and a dynamic observer to estimate the rotor speed accurately. The algorithm is implemented in a motor-control ASIC from MPS.

The MA702 angle sensor provides a high-resolution, on-board angle measurement, so the algorithm avoids the need to perform a complex inverse calculation. This eases code development and reduces the time that the ASIC spends on calculations.

Real-time validation test results show the proposed solution has good dynamic performance and is able to control the PMSM at different reference speeds.