This technical note deals with the sensorless speed and position estimation of a Permanent Magnet Synchronous Motor (PMSM) with surface-mounted magnets.

First, the note introduces the different categories of sensorless methods. Then, the general principles of a Sliding-Mode Observer (SMO) are introduced.

A possible implementation of an SMO is presented and validated in simulation. It is intended to be re-usable with the ACG SDK on Simulink.

Finally some experimental results are presented to asses the practical performance of a complete sensorless Field-Oriented Control.

Software ressources

  File Modified
ZIP Archive Requires Matlab Simulink ≥2016a and imperix ACG SDK ≥ Feb 23, 2021 by Julien Orsinger


Sensorless control of a PMSM

Common control techniques for a Permanent Magnets Synchronous Machine (PMSM) such as Direct Torque Control (DTC) or Field-Oriented Control (FOC) require the knowledge of the rotor position and/or speed.

By definition, the position and the speed of the rotor are linked by the relation:

\begin{array}{l}\displaystyle (1) \qquad \omega = \frac{d \theta}{dt}\end{array}

At least one of these two quantities must be known. The speed and/or position of a rotational machine can be measured with an encoder, a resolver or a tacho-generator. However, these devices increase the cost, the risk of failure and the mechanical complexity of the drive system.

In order to avoid the drawbacks of the aforementioned measurement devices, the position and speed of the rotor can be estimated from electrical measurements only. In this case, the machine is said to be sensorless. To be clear, sensorless only implies that there is no speed/position sensor: there is still a need for electrical measurements on the stator to deduce the speed/position of the rotor.

There are two families of sensorless methods: high-frequency component injection and SMO-based techniques. Thus, the two following sections briefly present these families and justify why this technical note focuses on a Sliding-Mode Observer (SMO).

High-frequency component injection

A first way to estimate the speed and position is to use a high-frequency component injection method, as described in [1]. Essentially, the drive injects a high-frequency voltage component into the stator of the machine. If the frequency is high enough (several hundreds of Hz), the associated torque is null on average because the inertia of the machine prevents it from moving. As the maxima of the associated current vector are related to the alignment of the voltage vector with respect to the axes, the position of the rotor can be inferred from the high-frequency current amplitude. An example of implementation is presented in [1]. This kind of sensorless techniques are mainly aimed at PMSMs with interior magnets (IPMSM) because their anisotropy simplify the detection of the current maxima.

Let us consider the case of a PMSM with surface mounted magnets (SPMSM). In theory, the machine is isotropic and it is impossible to differentiate the d and q axes by looking at the current maxima. However, in reality, a PMSM is never truly isotropic. At the junction between two magnets, the magnetic flux tends to pass directly from one magnet to the other, rather than passing through the stator windings [2]. Therefore, the flux near the junction does not contribute to the torque generation. As a result, the rotor is always anisotropic, even if the magnets are surface mounted.

Theoretically, this would allow to use the high-frequency component injection method with an SPMSM. However, it is not trivial in practice to exploit this small anisotropy. Since this technical note focuses on SPMSM, high-frequency component injection methods are not well-suited.

SMO-based sensorless techniques

The second family of methods relies on a Sliding-Mode Observer (SMO). SMO-based techniques start from the following observation: in a synchronous machine, the frequency of the counter electromotive force (back EMF) is directly linked to the rotor mechanical speed. Therefore, if one can determine the frequency of the back EMF - say with a PLL - the angular speed of the rotor is then:

\begin{array}{l}\displaystyle (2) \qquad \omega _m = \frac{\omega _s}{p} = \frac{ 2 \pi f_s}{p}\end{array}

where \begin{array}{l}p\end{array} is the number of pole pairs, and where \begin{array}{l}\omega _m\end{array} and \begin{array}{l}\omega _s\end{array} are, respectively, the mechanical and electrical angular speed. However, there is a catch: the back EMF is not observable. Therefore, it must be estimated. A common way to achieve this is to use a Sliding-Mode Observer (SMO) due to its simplicity of implementation and its robustness to parameter variations. Some applications of the sliding mode control for electric drives are presented in [3].

Unlike the high-frequency injection methods, sliding-mode observers exist in several variants that are suitable for both SPMSMs [4] and IPMSMs [5]. Therefore, it makes sense to consider an SMO in this technical note rather than high-frequency injection methods.

Block diagram of an SMO-based sensorless control for a PMSM

Block diagram of an SMO-based sensorless control for a PMSM

The aforementioned SMO-based techniques suffer from a major flaw: the amplitude of the back EMF is proportional to speed of the rotor which means that at low speed, it is difficult to estimate the back EMF accurately. In particular, at standstill there is no back EMF at all, which makes it challenging to start the PMSM in the first place.

Since SMO-based sensorless techniques are not suitable for low speed control, there is a need to accelerate the PMSM until it reaches a rotational speed "high enough" to get an accurate speed estimation. What is deemed "accurate enough" depends on the application, therefore there is no strict criterion for the minimal operating speed.

The current technical note focuses only on the speed and position estimation with a Sliding-Mode Observer. The technical note TN137, however, presents a complete sensorless Field-Oriented Control implementation with a sliding-mode observer.

General principles

Sliding Mode Observer

The purpose of the sliding mode observer is to estimate the back EMF. At this end, the first step is to identify the back EMF in the model of a PMSM. Let us consider the voltage balance equations at the stator and the expressions of the stator flux in the synchronous reference frame (SRF) [4]:

\begin{array}{l}(3) \qquad \begin{cases}{} \begin{align*} \displaystyle U_{\alpha s} &= R_s I_{\alpha s} + \frac{d \Psi _{\alpha s}}{dt} \\ \displaystyle U_{\beta s} &= R_s I_{\beta s} + \frac{d \Psi _{\beta s}}{dt} \\ \displaystyle \Psi _{\alpha s} &= L_s I_{\alpha s} + \Psi _{PM} \cos \theta _e \\ \displaystyle \Psi _{\beta s} &= L_s I_{\beta s} + \Psi _{PM} \sin \theta _e \end{align*} \end{cases}\end{array}

\begin{array}{l}U_{\alpha \beta s}\end{array}, \begin{array}{l}I_{\alpha \beta s}\end{array} and \begin{array}{l}\Psi _{\alpha \beta s}\end{array} are the stator phase voltages, phase currents and flux. \begin{array}{l}R_s\end{array} and \begin{array}{l}L_s\end{array} are the stator phase resistance and inductance. The rotor flux \begin{array}{l}\Psi _{PM}\end{array} is constant and set by the permanent magnets. The equations are expressed in the stationary reference frame and \begin{array}{l}\theta _e\end{array} is the position of the rotor in electrical radians.

After a few manipulations, (3) can be re-written as:

\begin{array}{l}(4) \qquad \begin{cases}{} \begin{align*} \displaystyle \frac{d I_{\alpha s}}{dt} &= -\frac{R_s}{L_s } I_{\alpha s} + \frac{1}{L_s } U_{\alpha s} - \frac{1}{L_s } e_{\alpha} \\ \displaystyle \frac{d I_{\beta s}}{dt} &= -\frac{R_s}{L_s } I_{\beta s} + \frac{1}{L_s } U_{\beta s} - \frac{1}{L_s } \displaystyle e_{\beta} \\ \displaystyle e_{\alpha} &= - \Psi _{PM} \,\omega _e \sin \theta _e \\ \displaystyle e_{\beta} &= \Psi _{PM} \,\omega _e \cos \theta _e \end{align*} \end{cases}\end{array}

where \begin{array}{l}e _{\alpha\beta}\end{array} is the back EMF. The rotor angle can be directly derived:

\begin{array}{l}\displaystyle (5)\qquad \theta _e = - \arctan\left(\cfrac{e_{\alpha}}{e_{\beta}}\right)\end{array}

In (4), the unknown is \begin{array}{l}\theta _e\end{array} and \begin{array}{l}\omega _e\end{array} is its derivative, according to (1). \begin{array}{l}U_{\alpha \beta s}\end{array} and \begin{array}{l}I_{\alpha \beta s}\end{array} are measurable but the back EMF must be estimated in order to solve (4).

Here is common way to estimate the back EMF with a sliding mode observer [4]:

  1. Compute an estimation of the current \begin{array}{l}\hat I_{\alpha \beta s} = f(U_{\alpha \beta s}, \hat e_{\alpha \beta})\end{array} from (4)

  2. Compute the estimation error \begin{array}{l}error = \hat I_{\alpha \beta s} - I_{\alpha \beta s}\end{array}

  3. Use the error as the input of a switching function [3] and multiply it by a finite gain in order to ensure the stability of the observer. The system is stable if the gain of the switching function meets the condition \begin{array}{l}K_s > \max(|e_{\alpha}|, |e_{\beta}|)\end{array} [4].

Sliding-mode observer

Thanks to the feedback of the estimation error, the output of the switching function is a PWM-like signal \begin{array}{l}\hat e _{\alpha\beta}\end{array} that approximates the value of the back EMF. The SMO is robust against parameter mismatch since the feedback will automatically adjust the output of the switching function in order to obtain the value of \begin{array}{l}\hat e _{\alpha\beta}\end{array} that corresponds to the actual measured current.

The state variable \begin{array}{l}\hat I_{\alpha \beta s}\end{array} is forced to “slide” towards the desired value \begin{array}{l}I_{\alpha \beta s}\end{array} by the control action of the switching function, thus the “sliding mode control”.

Switching function and chattering effect

A basic switching function for the SMO is \begin{array}{l}f(x) = \mathop{\mathrm{sgn}}(x)\end{array} [4]. The output signal \begin{array}{l}\hat e _{\alpha\beta}\end{array} obtained with the sign function is highly discontinuous. Common control techniques such as DTC and FOC are based on continuous functions, which means that they cannot handle effectively the high frequency components of a discontinuous signal. Their control bandwidth is too narrow for that [3]. The excitation by the high frequency components leads to oscillations in the control: this phenomenon is called the chattering effect [3].

A first way to mitigate the chattering phenomenon is to use a low-pass filter (LPF) [4]. A first order LPF introduces a delay (i.e. an error on the estimated angle) that must be compensated [6]. If \begin{array}{l}\omega _c\end{array} is the cut-off frequency of the filter, the compensation term is:

\begin{array}{l}(6) \qquad \begin{cases}{} \begin{align*} \displaystyle \Delta \hat \theta _e &= \arctan\left(\frac{\hat \omega _e}{\omega _c}\right) \\ \displaystyle \hat \theta &= \hat \theta _e + \Delta \hat \theta _e \end{align*} \end{cases}\end{array}

A second way to mitigate the chattering effect is to use a continuous switching function. The so-called sigmoid function is a continuous approximation of the sign function and can be used in SMO algorithms [4].

\begin{array}{l}\displaystyle (7) \qquad f(x) = \frac{2}{1 + e^{-a x}} - 1\end{array}

The parameter \begin{array}{l}a > 0\end{array} defines the smoothness of the transition between \begin{array}{l}\pm 1\end{array}. Since the gain of the sigmoid function is smaller than 1 in the transition region, the stability condition of the SMO becomes \begin{array}{l}K_s \gg \max(|e_{\alpha}|, |e_{\beta}|)\end{array}. The parameters \begin{array}{l}a\end{array} and \begin{array}{l}K_s\end{array} can be adjusted manually by comparing the real and estimated back EMF in simulation, for instance.

Comparison betweem the sign and sigmoid functions

Comparison betweem the sign and sigmoid functions

Speed and position estimation

The position of the rotor can be computed directly from the back EMF, according to equation (5). From (1), the speed is then obtained by taking the derivative of the rotor angle. Since the output of the \begin{array}{l}\arctan\end{array} function is a sawtooth signal, the estimation of its derivative around the discontinuities needs special care, as explained in PN104.

The \begin{array}{l}\arctan\end{array} method is sensitive to noise because it computes the position directly from the estimated back EMF. A better alternative is to use a PLL since it has a low-pass characteristic by construction. Since the estimated back EMF from the SMO has αβ components in quadrature, a Q-PLL is particularly suitable.

In a PLL, the position of the rotor is obtained by integration of the speed, according to (1). However, the integrator introduces a constant phase error of \begin{array}{l}\pi/2\end{array} that must be compensated.

\begin{array}{l}(8) \qquad \begin{cases}{} \begin{align*} \displaystyle \Delta \hat \theta _e &= - \frac{\pi}{2} \\ \displaystyle \hat \theta &= \hat \theta _e + \Delta \hat \theta _e \end{align*} \end{cases}\end{array}

Effects of the position estimation error

The electrical angle is used by vector control methods to determine the position of space vectors in the synchronous reference frame (SRF), or to align the rotating reference frame (RRF) with the rotor flux. Therefore, an estimation error on the position will have an effect on the performance of the vector control.

In the case of a Field-oriented control (FOC), the stator current space vector is usually kept aligned on the q-axis to maximize torque production. However, if the estimated position of the RRF is wrong, the current will have a non-zero d-axis component and a smaller q-axis component. The q-axis error will be compensated by the speed controller, while the d-axis error will decrease the torque production per ampere and have an effect on the drive efficiency.

In the case of a Direct Torque Control (DTC), the rotor position is only used to determine in which sector the stator flux is located. The DTC selects the switching vector to apply from a lookup table, depending on the sector. If the rotor position is affected by an estimation error, the DTC may detect the wrong sector and thus, apply a sub-optimal switching vector.

In the case of a sensorless control, the error on the position estimation may come from the SMO, the optional LPF or the PLL. The delay due to the LPF or the integrator can be computed and compensated as in equations (6) and (8).

B-Box Implementation

A speed and position estimation based on a sliding-mode observer alone is not sufficient to control a PMSM because it cannot handle startup and low-speed operations. Therefore the Simulink model provided in this technical note is intended to be used in simulation only: a PMSM is driven by an ideal speed source and the estimated and measured speed/position are compared.

The technical note TN137: I-f startup for sensorless PMSM control presents a complete sensorless Field-Oriented Control implementation with a sliding-mode observer. More experimental results are available in this note.

Plant model

In the Simulink implementation, the PMSM was modeled using the PLECS Blockset. The PMSM is driven by an ideal speed source in order to avoid the problematic of startup and low-speed operations. The machine is connected to a balanced resistive load and operates in generator mode.

Motor plant PLECS model


The figure below shows an overview of the sensorless speed/position estimation. The estimated back EMF is filtered with a 2nd order low-pass filter. The cut-off frequency was chosen empirically to 60 Hz. The speed and position are estimated with both the \begin{array}{l}\arctan\end{array} method and a Q-PLL for comparison purpose.

The gains of the PI controller inside the Q-PLL were determined empirically. Since the PI is of the first order, it has a permanent tracking error when the speed of the machine is not constant. The tracking error can be reduced by using the speed reference as the centering frequency of the PLL.

Sensorless drive Simulink model

Sliding mode observer

The back EMF is estimated with a sliding mode observer. The switching function is a sigmoid in order to reduce the chattering effect.

Sliding-mode observer Simulink model

In a practical application, the machine would most likely be driven by an inverter. In this case, the stator voltage is not measurable because it is a switched signal. Instead, the SMO would use the voltage reference of the inverter.

Arctan method

With this first method, the rotor angle is directly computed from the estimated back EMF with the \begin{array}{l}\arctan\end{array} function. Then, the speed is obtained by taking the derivative of the position, according to (1). With this approach, however, the accuracy of the discrete derivative depends strongly on the discretization period: the longer the period, the more inaccurate it becomes. This undesired effect can be mitigated by filtering the result of the derivative. For the proposed implementation, a low-pass filter with a 1kHz cut-off frequency was added.

Arctangent method


With this second method, the rotor angle is computed with a Q-PLL. Notice that the PLL uses floating point variables with double precision, whereas the rest of the control is in single precision. The goal is to avoid truncated results due to the limited precision of single precision variables.

Q-PLL method

Simulation results

Machine parameters

The sensorless estimation was validated in simulation using the following PMSM parameters.

Model: Control techniques 095U2B300BACAA100190




Rated power



Pole pairs



Rated phase voltage



Rated phase current



Rated mechanical speed



Rated torque



Stator resistance



Stator inductance (d and q axis)



Flux from permanent magnets



Moment of inertia (PMSM only)


kg cm2

Test conditions

  • Load torque: PMSM with 200 Ω resistive load on each phase

  • Interrupt and sampling frequency: 20 kHz (unless otherwise specified)

  • Speed reference: 3000 rpm


During the simulation, the speed of the PMSM is set to 3000 rpm by an ideal speed source. In addition, the resistive load is perfectly balanced. As a result, the stator current and voltage measurements required by the SMO are perfect sine waves. Under these ideal circumstances, the estimated back EMF practically fits the true back EMF, as shown below. The estimated back EMF is inevitably lagging behind the true value by design: the sliding-mode observer must first observe an error on the current estimation and then adjust the output of its switching function. In the experimental validation presented in TN137, the feedback is delayed by one control period.

In reality, the back EMF estimation by the SMO is also affected by the noise on the current measurements. As a result, it still necessary to filter the back EMF estimation, even if the chattering effect is already attenuated by the sigmoid function. The 2nd order LPF used by the control attenuates the amplitude of the estimated back EMF. However, it does not affect the speed estimation by the Q-PLL since only the frequency of the signal is relevant.Back EMF estimation results

The difference between the measured and estimated speed/position is negligible, as shown below. This is true for both the \begin{array}{l}\arctan\end{array} and Q-PLL methods.

Speed and position sensorless estimation

Experimental results

The simulation is not very realistic because in practice the speed control is not perfect and the measurements are affected by noise. The following figure shows the speed estimations obtained experimentally with the complete sensorless field-oriented control implementation from TN137. The peak estimation error at nominal speed is in the order of 6% with the Q-PLL and 8% with the \begin{array}{l}\arctan\end{array} method. Qualitatively speaking, the PLL estimation is also "smoother" than with the \begin{array}{l}\arctan\end{array} method. The difference can be explained by the measurement noise on the current measurements: the PLL has a low-pass filter characteristics that partially attenuates this noise, whereas the \begin{array}{l}\arctan\end{array} method has no filtering at all. Therefore, even if the \begin{array}{l}\arctan\end{array} method seems to offer similar performance to the Q-PLL, the Q-PLL is more appropriate in practice due to it better immunity to measurement noise.

Speed sensorless estimation results

Academic references

[1] A. Consoli, G. Scarcella and A. Testa, "Industry application of zero-speed sensorless control techniques for PM synchronous motors," in IEEE Transactions on Industry Applications, vol. 37, no. 2, pp. 513-521, March-April 2001, doi: 10.1109/28.913716.

[2] D. Hanselman, "Brushless Permanent Magnet Motor Design", 2nd edition, Magna Physics Publishing, USA, 2006, ISBN: 1-881855-15-5

[3] V. I. Utkin, "Sliding mode control design principles and applications to electric drives," in IEEE Transactions on Industrial Electronics, vol. 40, no. 1, pp. 23-36, Feb. 1993, doi: 10.1109/41.184818.

[4] Yongchang Zhang and Jiali Liu, "An improved Q-PLL to overcome the speed reversal problems in sensorless PMSM drive," 2016 IEEE 8th International Power Electronics and Motion Control Conference (IPEMC-ECCE Asia), Hefei, 2016, pp. 1884-1888, doi: 10.1109/IPEMC.2016.7512582.

[5] Wang Gaolin, Zhang Guoqiang and Xu Dianguo, "Rotor position estimation with full-order sliding- mode observer for sensorless IPMSM," Proceedings of The 7th International Power Electronics and Motion Control Conference, Harbin, 2012, pp. 2577-2581, doi: 10.1109/IPEMC.2012.6259265.

[6] Z. Ma and X. Zhang, "FPGA Implementation of Sensorless Sliding Mode Observer With a Novel Rotation Direction Detection for PMSM Drives," in IEEE Access, vol. 6, pp. 55528-55536, 2018, doi: 10.1109/ACCESS.2018.2871730.