Extraction of High Resolution Position Information From Sinusoidal Encoders
Extraction of High Resolution Position Information From Sinusoidal Encoders
Extraction of High Resolution Position Information From Sinusoidal Encoders
ENCODERS
J. Burke, J. F. Moynihan, K. Unterkofler
Fundamental Operation of
Sinusoidal Encoders
EIA
Sinusoidal encoders encode position information by
providing a pair of quadrature sine and cosine signals EIB
as the shaft is rotated. The signals may be generated EIUCNT N N-1 N-2 N-3 N-4 N-5 N-6 N-7
by optical or magnetic means and typically produce
512 or 1024 cycles per mechanical revolution. For
2π
noise immunity the signals are typically transmitted
θelec
differentially from the encoder to the sensor interface
electronics. A typical interface configuration is shown
in Figure 1.
+
EIU The analog SIN and COS signals are also fed to dual
+
- COS
-
EIB
sample and hold amplifiers (SHA) for subsequent
Midpoint
SaH
conversion to digital and post-processing in the
+ Vsin digital signal processor (DSP). The signals EIA and
-
ADC EIB are typically applied to the internal quadrature
+
-
Vcos counter of a dedicated digital Encoder Interface Unit
(EIU) as illustrated in Figure 1. The resultant parallel
word in the quadrature counter provides the crude
Figure 1: Typical Sinusoidal Encoder Interface position estimate from the sinusoidal encoder. There
are four counts per cycle of the sinusoidal waveforms the final position data is illustrated in Figure 3 for a
(SIN and COS) as seen in Figure 2, so that for a 512 512-line encoder.
line encoder the maximum count value is 2047
(4*512-1) which provides 11 bits of crude position N-1 N N+1 N+2
MAC SHIFTER
SERIAL PORTS
SPORT0 SPORT1
Interval
Timer
Auxiliary
PWM
8 Channel
12-bit ADC
Voltage
Reference
PWM
Generation
error [°]
∆E = sin(θ )cos(ϕ ) − cos(θ )sin(ϕ )
Figure 6: A graph of the error over one electrical = sin(θ − ϕ )
revolution. ≈ θ − ϕ , for small θ − ϕ
(3)
E(s)
ϕ(s)
VSin SHA X 2*d
2
ω0
2 1
ω0 S
VCos SHA X 1
S
(4)
Using the Zero Order Hold (ZOH) approximation to 0.9
Position(Radians)
0.6
Step
ω * TS (z + 1) (2 * d* ω 0 * TS )
2 2 DSP Pos.
G(z) ≈ 0 * 2
+
2 (z − 1) (Z− 1) 0.3
(5)
0.0
0.8
0.6
ϕ K +1 = A* E K + B * EK −1 + 2 * ϕ K − ϕ K −1 0.5
Error(Radians)
0.4
(7)
0.3
where
0.2
ω 2 *T2 0.1
A= 0 + 2 * d * ω * TS 0.0
2 0 -0.1
0 10 20 30 40 50 60 70 80 90
ω 2 * TS 2
-0.2
B= 0 − 2 * d * ω * TS Time (µs)
2 0
(8) Figure 10: Plot of the tracking error for a 45° step
change.
To improve the resolution and speed of convergence
Figure 11 illustrates the transient response of the
the algorithm was implemented in 32-bit arithmetic.
position error, E, when the speed of rotation is 1000
These 32 bits of fine position information combined
rpm. In this case the rotor position is ramping linearly
with the 9 bits of cycles information from a 512 line
and Figure 11 shows the initial error in the rotor
encoder results in 41 bits of position information over
position estimate due to the finite tracking
one complete mechanical cycle of which only the 32
performance of the proposed method. It can also be
MSB’s are stored for use by subsequent algorithms.
seen that the tracking loop reduces the steady state Sensitivity to System Offsets and Signal Gains
estimation error to zero in about 70µs.
Test were also carried out in regards to the effects of
Plot of the difference between Real Positon and Estimated Position
system offsets and mismatched gains on the final
0.30
result. Due to the cross multiplication approach the
effect of mismatched gains and offsets is greatly
0.25
reduced. The final algorithm will incorporate
amplitude scaling and offset compensation to fully
0.20 eliminate these effects.
Error(Radians)
0.15
Conclusions
0.10
At a speed of 120rpm, a 512-line encoder will have
0.05
swept out an angle of 1.65888 electrical degrees in
the 4.5µs computation time, making the 32 bits of
0.00 position information relatively useless for position
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0
Time (µs)
estimation for an outside controller. Thus, it makes
sense to say that such high resolution is really only
required at low speeds, and for the most part the
Figure 11: Error in tracking a ramp at 1000 rpm. encoder will be at rest in order to determine exact
position information. Given this, both methods have
The maximum number of DSP cycles executed in their advantages. The tracking loop requires less DSP
implementing this tracking is 111. This is equivalent cycles and results in higher resolution than the
to 4.269µs and so Ts was chosen to be 4.5µs. Using arctangent method. However the arctangent method
the sampling theorem as a starting point, ω0Max is has zero settling time. The greatest considerations in
approximately 700krad/s. For a 512-line encoder, this choosing a method would be the maximum speed the
gives a theoretical limit of the mechanical speed of encoder is allowed to travel at and the required
approximately 12000rpm. For the test showed above, resolution of the position estimation.
the bandwidth ω0 of the filter was set to 100krad/s.
The Damping Ratio (d) was set to 0.9. With these
values, there is no need of scaling of the coefficients
of equation (8).
References:
[1] SRS50, Motor Feedback System for Servomotors
This method can produce very high position SinCos SRS 50 with HIPERFACE by
resolutions once the motor speed is kept inside the STEGMANN.
bandwidth of the filter. As with all such closed-loop
tracking systems, it is possible to trade-off the [2] ADMC401, Single-Chip, DSP-Based, High
mutually exclusive characteristics of resolution and Performance, Motor Controller, Analog Devices
position bandwidth by adjusting the filter coefficients Inc., 1999.
in the feedback loop. Using the above parameters the
motor could be tracked to a speed of 11000rpm, [3] AD2S81A/AD2S82A, Variable Resolution
which is in accordance with the theoretical limit Monolithic Resolver to Digital Converter,
stated above. Analog Devices Inc., 1998.