# PMSM Rotor Position Detection Based on Hybrid Optical Encoder and R-Signal Zero-Setting Scheme

Authors: Yaoqiang Wang; Xiaoyong Ma; Mingdong Wang; Chong Cao
Journal: Journal of Control Science and Engineering
 (2016)

---

## Abstract

Rotor position detection is a prerequisite for achieving good control performance of PMSM. For a PMSM control system based on an optical encoder, it is a difficulty to detect rotor position and achieve R-Signal zero-setting. To solve the problem, a hybrid optical encoder is used in the paper by which a scheme for rotor position detection and R-Signal zero-setting is proposed. This encoder can do absolute and incremental rotor position detection simultaneously; here, the former is used for acquiring imprecise rotor position and the latter is for precise rotor position. Firstly, two detection methods of the encoder are analyzed, and a scheme for rotor position detection is proposed: absolute rotor position is used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection that has high precision is adopted. Then a novel scheme for R-Signal zero-setting is emphatically proposed. Finally, the simulation is conducted. Results show that rotor position detection and R-Signal zero-setting can be achieved by the proposed scheme.


---

## Body

## 1. Introduction

With the development of permanent magnetic materials and microelectronic technology, PMSMs have been widely used in servo systems due to their superior performance [1–3] in recent years. It is a must to acquire accurate rotor position of PMSM in order to achieve great control performance of servo systems [4].Methods used in detecting rotor position of PMSM are divided into two types: detection with or without position sensor [5]. Detection without position sensor, whose algorithm is complex, relies on motor parameters strongly and is not reliable to get rotor position [6–9] when a motor is in low-speed operation. As for detection with position sensor, rotary transformer, incremental and absolute optical encoder are commonly used. Rotary transformer has advantages of antipollution, antielectromagnetic interference, and antivibration, which are reliable to work in harsh environment. However, the output of rotary transformer is analog signals which are hard to be detected precisely [10]. Rotor position can be directly detected via absolute optical encoder, but the price of absolute optical encoder is more expensive; incremental optical encoder holds a leading position due to its high performance-cost ratio and high control flexibility.The difficulty of using incremental optical encoder is reference signal (named R-Signal) zero-setting and how to detect rotor position, before a control system is powered on and rotor position is unknown. Reference [11–13] proposed a scheme based on stator current vector that can detect rotor position accurately before a control system is powered on. However, the rotor will turn during the process and the motor must not be loaded. Reference [14] used high frequency impulses to avoid the rotor turning, but the motor must not be loaded either. Reference [15] proposed a method of R-Signal zero-setting but the process is complex.In this paper, a hybrid optical encoder [16, 17] is used and detection methods of PMSM rotor position based on the encoder are analyzed; then a scheme is proposed for rotor position detection and R-Signal zero-setting based on the encoder. The scheme for rotor position detection is that absolute rotor position detection is done to acquire an imprecise rotor position used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection is adopted which has high precision and is used for motor normal operation. Based on the characteristics of hybrid optical encoder, a novel scheme for R-Signal zero-setting is emphatically proposed. Finally, the simulation is conducted. Results show that the rotor position detection and R-Signal zero-setting can be achieved by the proposed scheme.


## 2. Rotor Position Detection Based on Hybrid Optical Encoder

Hybrid optical encoder has dual advantages of absolute and incremental encoder and can do absolute and incremental rotor position detection simultaneously. The hybrid optical encoder used in the paper is HEIDENHAIN ERN1387 which is cited as an example to analyze absolute and incremental rotor position detection.


### 2.1. Absolute Rotor Position Detection

As the rotor of PMSM rotates once, the encoder can produce absolute position detection signals: C-Signal and D-Signal that are both analog voltage signals. The characteristics of C-Signal and D-Signal are as follows: the amplitude of each one is 1 V and the phase angle of C-Signal is leading 90 degrees compared with that of D-Signal. The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor is shown in Figure1.Figure 1
The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor.In Figure1, V
C and V
D, respectively, represent the voltage of C-Signal and D-Signal. The relationship between V
C and V
D and mechanical angle of rotor represented by θ is(1)
V
C
=
sin
⁡
θ
,
θ
∈
0,2
π
,
V
D
=
-
cos
⁡
θ
,
θ
∈
0,2
π
.Accordingly, based on the absolute rotor position detection, the calculating formula for θ is(2)
θ
=
arctan
⁡
V
C
-
V
D
.


### 2.2. Incremental Rotor Position Detection

The encoder can produce incremental position detection signals: A-Signal, B-Signal, and R-Signal as PMSM rotor rotates. The characteristics of these signals are as follows: A-Signal and B-Signal are quadrature encoder pulse (QEP) signals that are used for pulse counting; R-Signal is a single pulse signal that is used for clearing pulse counter. Assume that the number of QEP signals isN when PMSM rotor rotates once. When the value of pulse counter is C
0, the calculating formula of mechanical angle is(3)
θ
=
2
π
C
0
N
.The electrical angle is the product of the mechanical angle and number of pole pairs of rotor. The relationship is shown in(4)
θ
e
=
2
π
C
0
N
·
p
,where θ
e denotes the electrical angle and p denotes the number of pole pairs.Equation (4) is based on the situation where electrical angle of the rotor is 0 when R-Signal is detected, which indicates that R-Signal zero-setting is accomplished. In systems having R-Signal zero-setting done, (4) can be used for the calculation of θ
e; but for systems not accomplishing R-Signal zero-setting, it is wrong to calculate θ
e via (4). If (4) were still used to calculate θ
e, it would cause serious problems such as overcurrent and overheat. Therefore R-Signal zero-setting is the premise of incremental rotor position detection.θ
R represents the mechanical angle between the position where the electrical angle is 0 and the position where R-Signal is detected. Assume that the number of pulses corresponding to θ
R is C
R and the relationship between θ
R and C
R is(5)
θ
R
=
2
π
·
C
R
N
.Assume that the value of pulse counter isC
1 when R-Signal is detected; then the calculating formula for the electrical angle θ
e is(6)
θ
e
=
2
π
C
R
+
C
1
N
·
p
.


### 2.3. Combination Scheme

According to absolute rotor position detection, rotor position can be calculated via (2). However, C-Signal and D-Signal are analog voltage signals with small amplitude that are susceptible to interference and hard to be detected precisely. Therefore, the result of absolute rotor position detection has some errors, which do not affect motor starting but are not conducive to motors’ running for a long time.Compared with absolute rotor position detection, incremental rotor position detection generally has high accuracy and the signals used for incremental rotor position detection are all digital signals that are not susceptible to interference, which contributes to achieving good control performance of PMSM. However, incremental rotor position detection cannot work without accomplishing R-Signal zero-setting.Based on the above analysis, the combination scheme of rotor position detection is as follows: absolute rotor position detection is in use before accomplishing R-Signal zero-setting; once accomplished, incremental rotor position detection is applied immediately.Accurate rotor position can be got via incremental rotor position detection contributing to the high performance of servo systems. However R-Signal zero-setting is the premise of the detection method. The accuracy of R-Signal zero-setting affects the control performance directly. Nowadays schemes for R-Signal zero-setting are complex and inefficient, so it is an urgent need to accomplish R-Signal zero-setting quickly and easily.


## 2.1. Absolute Rotor Position Detection

As the rotor of PMSM rotates once, the encoder can produce absolute position detection signals: C-Signal and D-Signal that are both analog voltage signals. The characteristics of C-Signal and D-Signal are as follows: the amplitude of each one is 1 V and the phase angle of C-Signal is leading 90 degrees compared with that of D-Signal. The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor is shown in Figure1.Figure 1
The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor.In Figure1, V
C and V
D, respectively, represent the voltage of C-Signal and D-Signal. The relationship between V
C and V
D and mechanical angle of rotor represented by θ is(1)
V
C
=
sin
⁡
θ
,
θ
∈
0,2
π
,
V
D
=
-
cos
⁡
θ
,
θ
∈
0,2
π
.Accordingly, based on the absolute rotor position detection, the calculating formula for θ is(2)
θ
=
arctan
⁡
V
C
-
V
D
.


## 2.2. Incremental Rotor Position Detection

The encoder can produce incremental position detection signals: A-Signal, B-Signal, and R-Signal as PMSM rotor rotates. The characteristics of these signals are as follows: A-Signal and B-Signal are quadrature encoder pulse (QEP) signals that are used for pulse counting; R-Signal is a single pulse signal that is used for clearing pulse counter. Assume that the number of QEP signals isN when PMSM rotor rotates once. When the value of pulse counter is C
0, the calculating formula of mechanical angle is(3)
θ
=
2
π
C
0
N
.The electrical angle is the product of the mechanical angle and number of pole pairs of rotor. The relationship is shown in(4)
θ
e
=
2
π
C
0
N
·
p
,where θ
e denotes the electrical angle and p denotes the number of pole pairs.Equation (4) is based on the situation where electrical angle of the rotor is 0 when R-Signal is detected, which indicates that R-Signal zero-setting is accomplished. In systems having R-Signal zero-setting done, (4) can be used for the calculation of θ
e; but for systems not accomplishing R-Signal zero-setting, it is wrong to calculate θ
e via (4). If (4) were still used to calculate θ
e, it would cause serious problems such as overcurrent and overheat. Therefore R-Signal zero-setting is the premise of incremental rotor position detection.θ
R represents the mechanical angle between the position where the electrical angle is 0 and the position where R-Signal is detected. Assume that the number of pulses corresponding to θ
R is C
R and the relationship between θ
R and C
R is(5)
θ
R
=
2
π
·
C
R
N
.Assume that the value of pulse counter isC
1 when R-Signal is detected; then the calculating formula for the electrical angle θ
e is(6)
θ
e
=
2
π
C
R
+
C
1
N
·
p
.


## 2.3. Combination Scheme

According to absolute rotor position detection, rotor position can be calculated via (2). However, C-Signal and D-Signal are analog voltage signals with small amplitude that are susceptible to interference and hard to be detected precisely. Therefore, the result of absolute rotor position detection has some errors, which do not affect motor starting but are not conducive to motors’ running for a long time.Compared with absolute rotor position detection, incremental rotor position detection generally has high accuracy and the signals used for incremental rotor position detection are all digital signals that are not susceptible to interference, which contributes to achieving good control performance of PMSM. However, incremental rotor position detection cannot work without accomplishing R-Signal zero-setting.Based on the above analysis, the combination scheme of rotor position detection is as follows: absolute rotor position detection is in use before accomplishing R-Signal zero-setting; once accomplished, incremental rotor position detection is applied immediately.Accurate rotor position can be got via incremental rotor position detection contributing to the high performance of servo systems. However R-Signal zero-setting is the premise of the detection method. The accuracy of R-Signal zero-setting affects the control performance directly. Nowadays schemes for R-Signal zero-setting are complex and inefficient, so it is an urgent need to accomplish R-Signal zero-setting quickly and easily.


## 3. R-Signal Zero-Setting Scheme

According to (5) and (6), it can be got that the essence of R-signal zero-setting is to find C
R corresponding to θ
R. If pulse counter is cleared when electrical angle reaches 0, the value of pulse counter will be C
R when R-Signal is detected. However electrical angle cannot be detected directly. To solve this, an R-Signal zero-setting scheme is proposed.As is known, electrical angle is the product of mechanical angle and the number of pole pairs. Therefore when mechanical angle is 0, electrical angle is 0 accordingly. So if pulse counter is cleared at the position where mechanical angle is 0, the value of pulse counter isC
R when R-Signal is detected, thus accomplishing R-Signal zero-setting.As is shown in Figure1, when mechanical angle is 0, the voltage of C-Signal and D-Signal is shown in (7). Therefore it is reasonable to do R-Signal zero-setting when V
C and V
D meet(7)
V
C
=
0
,
V
D
=
-
1
V
.In practical, C-Signal and D-Signal are analog voltage signals with small amplitude that are susceptible to interference and hard to be detected precisely, which brings some errors between the measured value and actual value. Therefore, the situation does not exist where voltages of C-Signal and D-Signal meet (7); that is to say, the position cannot be got where the mechanical angle is 0 through the absolute rotor position detection.Consider that, as mechanical angle approaches 0, the voltage of C-Signal is close to 0 and the voltage of D-Signal is negative. Therefore, an interval can be specified that is close to the position where mechanical angle is 0 based on the characteristics of the voltage of C-Signal and D-Signal. Define the position where mechanical angle is 0 as “Absolute Zero Point” and the interval close to “Absolute Zero Point” as “Crude Zero Point.” Equation (8) represents an interval that is close to “Absolute Zero Point,” so this interval is a “Crude Zero Point”:(8)
0
<
V
C
<
0.05
V
,
V
D
<
0
.Figure2 denotes the relationship between “Absolute Zero Point” and the “Crude Zero Point” specified by (8).Figure 2
The relationship between “Absolute Zero Point” and “Crude Zero Point.”In Figure2, the arc represents motion orbit of rotor; the brown arc represents the part of motion orbit corresponding to the “Crude Zero Point” specified by (8) and point C is the right edge of the interval.Based on the above analysis, R-Signal zero-setting scheme is as follows: firstly, set a “Crude Zero Point” like (8) before PMSM is powered on; secondly, start the motor based on the mechanical angle calculated by the absolute rotor position detection; thirdly, clear pulse counter when the voltage of C-Signal and D-Signal meets the relationship shown by the “Crude Zero Point” set before; finally, once detecting R-Signal, record the value of pulse counter which is C
R and calculate θ
R via (5) thus accomplishing R-Signal zero-setting. The flow chart of R-Signal zero-setting scheme is shown in Figure 3.Figure 3
The flow chart of R-Signal zero-setting scheme.


## 4. Discussion

The rotor position calculated by the absolute rotor position detection is imprecise which can be used for motor starting but not suitable for motor operation. Incremental rotor position detection has high accuracy, which is conducive to the operation of motor, but R-Signal zero-setting must be accomplished.According to R-Signal zero-setting scheme, the position where pulse counter is cleared is at “Crude Zero Point” instead of “Absolute Zero Point” during the process of R-Signal zero-setting. A “Crude Zero Point” specifies an interval that is close to “Absolute Zero Point.” When rotor position approaches “Absolute Zero Point,” mechanical angle of rotor will enter the interval specified by a “Crude Zero Point” more than one time. Therefore pulse counter starts counting since it is cleared last time, which results in losses of pulse counting.Citing the “Crude Zero Point” shown in (8) as an example, the influence of the error between the “Crude Zero Point” and “Absolute Zero Point” on R-Signal zero-setting is analyzed. Error analysis is shown in Figure 4.Figure 4
Error analysis for R-Signal zero-setting.In Figure4, the circle represents motion orbit of rotor; the brown arc represents the part of motion orbit of rotor corresponding to a “Crude Zero Point”; point C is the right edge of the interval specified by a “Crude Zero Point”; and mechanical angle of rotor is increased in a clockwise direction.As is shown in Figure1, the voltage of C-Signal changes as sine wave with mechanical angle of rotor increasing. Therefore when motor turns in a clockwise direction, the voltage of C-Signal increases monotonically in the interval specified by a “Crude Zero Point.” Then, mechanical angle of rotor will be close to the right edge of the interval specified by the “Crude Zero Point,” when V
C and V
D meet (8) for the last time. Similarly, if motor is turning in an anticlockwise direction, mechanical angle of rotor will be close to the left edge of the interval when V
C and V
D meet (8) for the last time.Set the two positions whereV
C and V
D meet (8) for the last time as point D (in a clockwise direction) and point E (in an anticlockwise direction) shown in Figure 4.According to Figure4, pulse counter is cleared at point D when rotor turns in a clockwise direction. When rotor reaches point R, record the value of pulse counter and calculate θ
R via (5). The result corresponds to the arc D
R
⌢, while the actual value corresponds to O
R
⌢. Obviously, O
R
⌢
>
D
R
⌢, so the calculated result of θ
R is smaller than the actual one.Similarly, motor turning in an anticlockwise direction, the calculated result corresponds to the arcE
R
⌢ that is also smaller than O
R
⌢, so the calculated result of θ
R is also smaller than the actual one.To summarize, the error between the “Crude Zero Point” and “Absolute Zero Point” leads to a smallerθ
R.


## 5. Simulation and Analysis

According to the rotor position detection scheme, PMSM drive and control system is constructed. Figure5 shows the diagram of the system. As is shown in Figure 5, vector control strategy is adopted in the PMSM drive and control system. The encoder used in the simulation diagram is ERN1387, which is a hybrid optical encoder. Based on the hybrid optical encoder, the speed and electrical angle of PMSM rotor can be acquired by decoding output signals of ERN1387.Figure 5
The diagram of PMSM drive and control system.Parameters of the motor in the simulation model are as follows: the stator resistance is 2 Ω; the stator inductance is 8.35 × 10−4 H; the rotor inertia is 1 × 10−3 kg·m2; the number of pole pairs is 4; the rated speed is 1000 r/min; the load torque is 5 N·m; the initial position of rotor is π/6 (this value can be any one within 0~2π). Parameters of the hybrid optical encoder are as follows: the number of lines of the grating is 2048; frequency quadruple, θ
R, is π/3 (this value can be any one within 0~2π), and the actual value of C
R is 1365.Figure6 is the simulation waveform of mechanical angle of PMSM rotor. In Figure 6, dotted frame ① is the waveform of mechanical angle under the absolute rotor position detection; and dotted frame ② corresponds to the incremental rotor position detection. To reflect differences between the two rotor position detection methods, waveforms in dotted frame ① and ② are both amplified. As shown in dotted frame ①, mechanical angle changes from π/6, and the waveform is not smooth. In dotted frame ②, mechanical angle varies smoothly. It can be got from Figure 6 that PMSM rotor initial position can be acquired by the absolute rotor position detection. Besides, compared with the incremental rotor position detection, the absolute rotor position detection does not affect PMSM starting but is not conducive to PMSM normal operation. What is more, the continuous variation of mechanical angle in Figure 6 denotes that the combination scheme of the absolute and incremental rotor position detection is feasible.Figure 6
Waveform of mechanical angle of PMSM rotor.Figure7 is the simulation waveform of C
R. In Figure 7, the value is 1359 when R-Signal is detected and is close to the value (1365) set before, which shows that R-Signal zero-setting can be accomplished via the proposed scheme.Figure 7
The simulation waveform ofC
R.Figure8 is simulation waveforms of three-phase stator currents based on the absolute and incremental rotor position detection. Similar to Figure 6, dotted frames ① and ②, which are both amplified, correspond, respectively, to waveforms of three-phase stator currents under conditions of the absolute and incremental rotor position detection. In dotted frame ①, there are many glitches in waveforms of currents. However, in dotted frame ②, three-phase stator currents vary smoothly. It can be drawn from Figure 8 that, compared with the absolute rotor position detection, the incremental rotor position detection is suitable for PMSM normal operation. Besides, the stable variation of stator currents shows that the result of R-Signal zero-setting is correct.Figure 8
Simulation waveforms of three-phase stator current.Figure9 is the simulation waveform of torque. In Figure 9, the torque changes from a large number to a stable state where the value changes around the load torque. Figure 10 is the simulation waveform of speed. In Figure 10, motor runs at the rated speed. Figures 9 and 10 show that when the proposed scheme is going on, the motor is in a normal operation.Figure 9
The simulation waveform of torque.Figure 10
The simulation waveform of speed.


## 6. Conclusion

In this paper, a scheme for rotor position detection and R-Signal zero-setting is proposed, based on a hybrid optical encoder. The scheme combines the absolute rotor position detection with incremental rotor position detection: the absolute rotor position is used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection is adopted and used for motor normal operation. To accomplish R-Signal zero-setting quickly and easily, a novel scheme for R-Signal zero-setting is emphatically proposed. Simulation results show that the proposed scheme is feasible and that rotor position detection and R-Signal zero-setting can be achieved.



---

*Source: 2712643-2016-07-25.xml*