Skip to Content
Applied SciencesApplied Sciences
  • Article
  • Open Access

24 March 2026

16 Pages

Research on a Space–Time Modulation-Based Angle Demodulation Method for Magnetic Encoders

and
1
Department of Electronic and Communication Engineering, North China Electric Power University, Baoding 071003, China
2
Hebei Key Laboratory of Power Internet of Things Technology, North China Electric Power University, Baoding 071003, China
3
Hebei Engineering Research Center of Intelligent Technology for Power Internet of Things, North China Electric Power University, Baoding 071003, China
*
Author to whom correspondence should be addressed.

Abstract

This paper presents a high-precision angle demodulation method for magnetic encoders by integrating orthogonal-signal correction with space–time modulation (STM). The proposed approach specifically addresses a critical vulnerability of STM-based high-frequency pulse interpolation: its interpolation accuracy is highly sensitive to zero-crossing timing jitter of the quadrature signals. In practical magnetic encoders, non-idealities such as DC offsets, amplitude mismatch, and phase non-orthogonality in the sine/cosine outputs induce jitter and shift in the zero-crossing points. This directly leads to fluctuations in high-frequency counts and amplifies the final angle error. To mitigate this issue, an online orthogonal-signal correction module is first developed. This module sequentially performs offset estimation, amplitude normalization, and real-time phase orthogonalization, thereby enhancing the orthogonality and zero-crossing stability of the quadrature signals at the source. This preprocessing significantly reduces the sensitivity of the subsequent interpolation counting to noise and signal imperfections. Based on the corrected signals, an STM pulse-counting interpolator is adopted to convert angle information into a time-domain phase (time) difference, and high-frequency counting is used for fine subdivision. A Kalman-filter-based predictor is employed to estimate angular velocity and compensate the intrinsic latency of counting-based demodulation in dynamic conditions. Experimental results demonstrate that the proposed phase orthogonalization correction markedly suppresses zero-crossing timing jitter and enhances the stability of high-frequency pulse interpolation. Consequently, the overall demodulation error is reduced by more than 30 percent compared with existing methods, and the final angle error is maintained within 0.033°.

1. Introduction

With the rapid development of high-end equipment and precision manufacturing, high-accuracy displacement/angle measurement has become a fundamental enabler for high-performance closed-loop motion control. Representative time-domain mapping paradigms (e.g., time-grating-inspired sensing) transform spatial displacement/angle information into time-domain observables (such as pulse timing or phase), thereby enabling high-resolution measurement [1,2]. In servo and precision-control scenarios, the encoder serves as the key feedback element, whose accuracy and stability directly affect the dynamic performance and control precision of the system [3]. Compared with optical encoders, magnetic encoders are attractive in terms of compactness, robustness against contamination/vibration, and ease of integration; cross-orthogonal Hall-array-based angle sensing further provides a practical implementation route for magnetic angle measurement [4].
Accuracy improvement for angle demodulation is commonly advanced along two routes. One route is to establish structured error models and perform linearization/constraint-based solving to suppress systematic errors [5,6]. The other route focuses on interpolation-interface design to improve resolution consistency and error tolerance, where electronic interpolators are typical examples [7]. Importantly, front-end non-idealities (e.g., quadrature error, amplitude mismatch, and DC offsets) do not merely cause static errors; they can reshape the downstream demodulation/interpolation error pattern and may be further amplified in high-resolution processing chains [8,9]. Therefore, relying on a single-stage remedy (e.g., table lookup or purely back-end compensation) is often insufficient to balance accuracy and robustness under practical operating conditions.
At the system-integration level, magnetic encoders demonstrate the feasibility of co-designing sensing and demodulation algorithms [10]. For Hall-based sensing under weaker geometric constraints, improved rotor-position estimation and correction strategies have also been investigated to ensure usability in low/zero-speed regions [11,12]. Meanwhile, error fitting, data-driven compensation, and multiobjective optimization have been actively studied to improve performance under complex trade-offs [13,14,15], and can be combined with implementation frameworks such as phase-locked loops for enhanced dynamic stability [16].
For comparative evaluation, two representative magnetic-encoder demodulation pipelines are adopted as baselines in this paper: a real-time compensation oriented solution [17] and a conventional correction + arctan solution [18].
Motivated by the above, this paper studies a complete demodulation chain for high-resolution magnetic encoders, following a “front-end correction–high-factor interpolation–dynamic compensation” philosophy. Front-end vector phase correction is employed to suppress non-ideal coupling, STM and Kalman filtering are then used for high-factor interpolation and dynamic error mitigation, and a KF-based latency-compensation module is further incorporated to compensate for the intrinsic delay introduced by high-factor pulse counting/demodulation. Experimental results demonstrate that the proposed scheme yields a tighter full-range error bound and more stable demodulation under dynamic conditions, reducing the overall demodulation error by more than 30% compared with the baseline methods.

2. Limitations of Conventional Signal Correction for Magnetic Encoders

From the angle-domain perspective, nonlinear error modeling/correction for magnetic encoders can effectively reduce static errors; however, under high-speed dynamics, the achievable performance can still be constrained by event-level time-localization instability that is not captured by purely angle-domain metrics [19].
Conventional look-up-table (LUT) or table-driven calibration methods face an inherent trade-off between memory usage and correction accuracy, and often require repeated recalibration under temperature drift, aging, and installation-state changes, leading to non-negligible engineering overhead [20]. When quadrature sine/cosine signals suffer from non-orthogonal phase error and waveform distortion, subsequent subdivision/interpolation becomes highly sensitive to geometric distortion and phase mismatch, resulting in angle-dependent residual structures. Similar sensitivity to geometric distortion and phase mismatch has also been reported for non-orthogonal Moiré signals [21].
Accordingly, filtering/estimation is frequently introduced into the demodulation chain to enhance robustness under time-varying conditions. Kalman-filter-based phase demodulation strategies have been investigated to mitigate time-varying disturbances and improve demodulation stability [22]. Relatedly, time-domain processing paradigms with remodulation also demonstrate that representing the target information in the time domain (e.g., pulse timing/phase), which is more suitable for estimation, can alleviate the influence of noise and non-idealities on the final output [23].
A key issue closely related to this work is that, once the demodulation chain adopts counting-based high-frequency pulse interpolation, the upper bound of dynamic error is often determined by the time-localization stability of zero-crossing events, rather than by static angle-domain residuals. In high-factor interpolation contexts, combining space–time modulation with state estimation (e.g., Kalman filtering) has also been explored to improve dynamic real-time performance [24]. However, in practical magnetic encoder front-ends, phase non-orthogonality deforms the ideal circular Lissajous trajectory into a tilted ellipse, making the effective phase and the local slope around zero crossings vary periodically with mechanical angle. With finite threshold resolution and measurement noise, such variation directly manifests as advance/lag and jitter of the zero-crossing instant. Since high-frequency pulse counting maps timing jitter into count jitter with an amplification proportional to the interpolation ratio, this effect finally becomes observable angle fluctuations.
Accordingly, the contributions of this work are threefold. First, an online vector-projection-based orthogonalization method is developed to suppress phase non-orthogonality and improve zero-crossing stability before STM interpolation. Second, an STM-based pulse-counting scheme is employed to map spatial angle information into a time-domain phase delay, thereby overcoming the resolution limitation of direct ADC-based demodulation. Third, a Kalman-filter-based predictive compensation method is introduced to reduce the intrinsic latency of counting-based demodulation under dynamic rotation. With this correction–interpolation–compensation chain, the full-range angle error is maintained within 0.033 ° under dynamic conditions.

3. Theory and Methodology

3.1. Operating Principle and Signal Characteristics of Magnetic Encoders

Magnetic encoders detect position by sensing variations in a magnetic field. Typically, a permanent magnet is mounted coaxially with the rotating target. As the target rotates, the magnetic field generated by the magnet varies periodically. Magnetic sensors inside the encoder capture these variations and output sine and cosine signals carrying position information. In this work, an anisotropic magnetoresistive (TMR) sensor is employed due to its high sensitivity, good temperature stability, and reliable performance in industrial environments.
To clarify how the rotating magnetic field is converted into quadrature sinusoidal outputs, a schematic illustration of the sensing principle is shown in Figure 1.
Figure 1. Schematic illustration of a magnetic encoder. The rotating magnet produces a periodic magnetic field, which is sensed by the sensor to generate quadrature sinusoidal signals ( V cos and V sin ) carrying the angular position information.
The ideal orthogonal voltage outputs of the magnetic sensor can be expressed as
V c = A cos ( θ ) , V s = A sin ( θ ) ,
where A denotes the signal amplitude and θ represents the angle to be measured.
Based on the above quadrature signals, the angular position can be obtained by an inverse tangent operation as
θ = arctan V s V c .
However, in practical applications, due to manufacturing tolerances, temperature variations, mechanical vibration, and material aging, the output signals of magnetic sensors often exhibit non-ideal characteristics. These non-idealities are typically reflected in distorted Lissajous figures, which deviate from the ideal circular trajectory.
Figure 2 shows typical Lissajous distortions caused by non-ideal quadrature outputs: amplitude mismatch leads to an elliptical trajectory, phase non-orthogonality tilts the ellipse, and DC offset shifts the center away from the origin. These non-ideal characteristics introduce errors in the angle reconstruction results and severely degrade the measurement accuracy of magnetic encoders. Therefore, appropriate preprocessing of non-ideal signals is a key step in reducing angle estimation errors.
Figure 2. Typical Lissajous figure distortions of magnetic encoder quadrature signals under non-ideal conditions, including amplitude mismatch, non-orthogonal phase error, and DC offset. The dashed curves represent the ideal reference circle, while the solid curves correspond to the actual measured signals.

3.2. Design of the Real-Time Signal Correction Algorithm

To address this issue, a real-time signal correction algorithm suitable for FPGA implementation is adopted in this work. The proposed method dynamically estimates and compensates DC offsets, amplitude mismatch, and phase errors in quadrature signals, thereby significantly improving signal quality and subsequent angle demodulation accuracy. In practical applications, magnetic encoder output signals exhibit various non-ideal characteristics, which severely affect angle reconstruction accuracy. The raw sensor output signals can be modeled as
V c = A c cos ( θ ) + O c , V s = A s sin ( θ + ϕ ) + O s ,
where A c and A s denote the amplitudes of the cosine and sine channels, respectively, O c and O s represent the DC offsets, and ϕ is the phase deviation between the two channels. To eliminate the DC offset components, the offset value is estimated in real time by calculating the mean of the sampled signal over one period:
O ^ = 1 N ∑ n = 0 N − 1 V [ n ] ,
where V [ n ] denotes the sampled signal value at the n-th sampling instant and N is the number of samples within one complete period. After DC offset removal, the signal amplitude is estimated using the peak-to-peak value within one period as
A ^ = max V [ n ] − min V [ n ] 2 ,
where A ^ denotes the estimated signal amplitude, and max ( · ) and min ( · ) represent the maximum and minimum values within a window of N samples, respectively. Based on the estimated DC offsets and amplitudes, amplitude normalization is performed to compensate for the amplitude mismatch between the two channels:
V c norm = V c − O ^ c A ^ c , V s norm = V s − O ^ s A ^ s ,
where A ref is the reference amplitude, typically chosen as the expected nominal amplitude or one of the estimated channel amplitudes. After normalization, both channels are scaled to approximately unit amplitude, which helps reduce the influence of gain mismatch on subsequent angle demodulation. The estimators in Equations (4)–(6) can be implemented on FPGA using accumulator-based statistics and peak-parameter (max/min) updates, consistent with a real-time signal-correction data path. The corrected samples are then provided to downstream modules for online demodulation.

3.3. Phase Non-Orthogonality and Projection-Based Correction

In practical magnetic encoder applications, phase non-orthogonality is one of the key factors affecting angle reconstruction accuracy. Conventional phase correction methods are mostly based on offline calibration or computationally intensive iterative algorithms, with which it is difficult to meet the real-time requirements under highly dynamic operating conditions. To overcome the limitations of conventional phase-correction methods, this work proposes a real-time vector-projection-based orthogonalization correction method, which removes the correlated component between the quadrature channels and enforces strict orthogonality in an online manner.
Considering the presence of a phase deviation ϕ , the practical quadrature signals can be expressed as
V c = A c cos ( θ ) , V s = A s sin ( θ + ϕ ) ,
However, in the presence of a phase error, the measured angle becomes
θ m = arctan sin ( θ + ϕ ) cos θ = θ + ε ( θ ) ,
where ε ( θ ) denotes the angle-dependent error introduced by the phase deviation.
Based on a signal-space representation, one-period samples are treated as discrete vectors. By removing the correlated component between the two channels, strict orthogonalization is enforced, thereby achieving an intrinsic correction of the phase error.
In a two-dimensional space, the projection vector of y onto the direction of x is defined as
y ‖ = ⟨ y , x ⟩ ⟨ x , x ⟩ x .
Accordingly, any vector y can be decomposed into the sum of a parallel component and an orthogonal component as
y = y ‖ + y ⊥ .
The corresponding scalar projection coefficient, denoted by k, is given by
k = ⟨ y , x ⟩ ⟨ x , x ⟩ = ∑ n = 0 N − 1 y [ n ] x [ n ] ∑ n = 0 N − 1 ( x [ n ] ) 2 .

3.3.1. Phase Correction Procedure

Based on the vector-projection orthogonalization principle, the phase correction process can be implemented in a deterministic and real-time manner. In implementation, the correction is carried out online in a lightweight streaming fashion. The core idea is to eliminate the non-orthogonal phase error by projecting one signal onto a reference axis and subtracting the corresponding projection component.
First, the projection component of vector y onto the reference vector x is computed as
y para = k · x ,
where k denotes the projection scalar coefficient defined in (11).
Figure 3 provides a geometric interpretation of the proposed phase correction process, in which the non-orthogonal component is explicitly identified and removed from the original signal.
Figure 3. Illustration of the projection-based phase correction method. The distorted signal y raw contains a non-orthogonal component along the reference axis x . By projecting y raw onto x and subtracting the projection component, a strictly orthogonal signal is obtained.
After removing the projection component, the corrected orthogonal signal can be expressed as
y corrected = y − y para = y − k · x .
For discrete sampled signals over one signal period, the correction is applied point by point as
y corrected [ n ] = y [ n ] − k · x [ n ] , n = 0 , 1 , … , N − 1 .

3.3.2. Amplitude Normalization and Final Angle Computation

After orthogonalization, the corrected signal y corrected [ n ] is strictly perpendicular to x [ n ] , but its amplitude is not necessarily unity. To ensure a consistent signal scale, y corrected [ n ] is further normalized in amplitude.
First, the signal amplitude over one period is estimated using a peak-to-peak formulation as
A corr = max y corrected [ n ] − min y corrected [ n ] 2 .
Then the normalized orthogonal signal is obtained by
y final [ n ] = y corrected [ n ] A corr .
Finally, the angle is computed as
θ = arctan y final x .
These operations can be efficiently implemented on the FPGA fabric with low computational overhead using accumulators, comparators, and scaling units.
Summary of Method
The proposed correction algorithm enables synchronous and adaptive compensation of the three dominant error sources in practical magnetic encoders: DC offsets, amplitude mismatch, and phase non-orthogonality. After online correction, the encoder outputs approach ideal sinusoidal quadrature waveforms, and the corresponding Lissajous trajectory becomes close to a standard circle. This provides a high-quality signal foundation for subsequent high-precision interpolation and demodulation.
However, using conventional inverse-tangent-based demodulation alone, the achievable resolution is fundamentally limited by the ADC bit depth, and the intrinsic time-delay issue under high-speed dynamics cannot be resolved. To address this, this work adopts and integrates an STM-based pulse-counting interpolation framework and Kalman-filter-based delay compensation reported in related studies [22,24].
In the STM framework, spatial angle information is mapped into the time domain. Residual phase non-orthogonality leads to periodic variations in the waveform slope around the zero-crossing, which translates into zero-crossing timing jitter. By applying the proposed vector-projection orthogonalization, the modulated signal maintains a more consistent and steep transition at the zero-crossing. This stabilizes the time localization of the crossing event and reduces the pulse-count fluctuation caused by threshold uncertainty. With improved signal conditioning, STM-based pulse counting is then used to overcome the resolution limit imposed by ADC quantization, and a Kalman-filter-based predictor is employed to compensate for the inherent time delay that interpolation alone cannot remove.

3.4. Principle of High-Factor Angle Interpolation Based on Space–Time Modulation

Space–time modulation (STM) is a technique that maps spatial angle information into a time-domain signal phase such that a high-frequency clock can be exploited to perform fine time subdivision and hence high-factor interpolation. In this work, STM is applied to the angle demodulation of magnetic encoders.

3.4.1. Time-Domain Modulation of Angle Information

First, a pair of sinusoidal time-carrier signals is synthesized in the FPGA with a modulation frequency of f 0 = 8 kHz , which yields an integer interpolation factor of f clk / f 0 = 10,000 under the 80 MHz counting clock while maintaining a sufficiently high update rate for dynamic rotation:
V t c ( t ) = cos 2 π f 0 t ,
V t s ( t ) = sin 2 π f 0 t .
A high-frequency counter driven by an 80 MHz system clock measures the rising-edge zero-crossing time offset between V t s ( t ) and V stm ( t , θ ) , providing an interpolation factor of f clk / f 0 = 10,000 .
Then, the corrected encoder quadrature signals V s ′ ( θ ) = sin ( θ ) and V c ′ ( θ ) = cos ( θ ) are modulated with the above time-carrier pair. Using the angle-sum identity, the STM output can be written as
V stm ( t ) = V c ′ ( θ ) V t s ( t ) + V s ′ ( θ ) V t c ( t ) .
Substituting (18) and (19) into (20) yields
V stm ( t , θ ) = sin 2 π f 0 t + θ .
Note that θ in (21) is expressed in radians. If the measured angle is given in degrees as θ deg , it should be converted by θ = θ deg × π / 180 . Equation (21) indicates that V stm ( t , θ ) is a sinusoid whose phase contains the target angle θ , i.e., it leads the original time-carrier V t s ( t ) by a phase offset of θ .

3.4.2. Time-Difference Decomposition Based on High-Frequency Pulse Counting

In the STM demodulation chain, the angle information θ is encoded as a phase difference between the reference time-carrier V t s ( t ) and the space–time modulated signal V stm ( t , θ ) . In practice, the phase difference can be represented by the time offset Δ t between identical zero-crossing events (e.g., rising-edge zero crossings) of the two signals. A high-frequency clock f clk is used to count this time interval, yielding a pulse count N. The relationship is
θ = 2 π f 0 Δ t ,
Δ t = N f clk ,
and thus
θ = 2 π f 0 N f clk .
Note that counting-based demodulation introduces an intrinsic latency since the output is available only after the reference event arrives and the counting interval is completed. This time-domain pulse-counting mechanism is consistent with the period-measurement strategies reported for incremental encoders, in which the interval between adjacent encoder pulses is resolved by a high-frequency counter to improve estimation precision [25].

3.4.3. Phase-Difference Accumulation and Lag-Induced Error Mechanism

In this study, space–time modulation (STM) is employed to map spatial angular information into the phase delay of a time-domain carrier. The raw decoded angle is obtained by measuring the zero-crossing time difference Δ t via high-frequency pulse counting. A key property of STM is its high interpolation factor; however, this also means that tiny perturbations in zero-crossing timing may be amplified into observable count fluctuations. Therefore, it is necessary to explain the phase-difference accumulation and the lag-induced error mechanism, and to justify dynamic delay compensation under rotation.
The ablation result in Figure 4 shows that enabling online correction before STM reduces both the angle-dependent mean fluctuation and the jitter band of the zero-crossing events, which is beneficial for high-factor pulse counting.
Figure 4. Ablation study of zero-crossing timing stability before STM (steady state). The horizontal axis is the mechanical angle within one revolution (0– 360 ° ). The vertical axis is the zero-crossing timing error e t (ns), i.e., the time deviation between the measured and reference zero-crossing instants at the same angle. Solid curves: mean. Shaded bands: ±3σ across revolutions. Baseline: raw quadrature signals directly fed into STM. Proposed: online correction applied before STM.
In addition to zero-crossing jitter, STM demodulation inevitably introduces a latency because the zero-crossing interval must be observed and counted before the phase (and thus angle) can be updated. Under constant speed, such latency mainly results in a nearly constant phase shift; however, under dynamic rotation it becomes a speed-dependent lag. Therefore, dynamic delay compensation is required to suppress the lag-induced error as qualitatively illustrated in Figure 5.
Figure 5. Mechanism of phase-difference accumulation and lag-induced error in STM-based pulse interpolation. (Left) The phase difference between the space–time signal and the time carrier accumulates with mechanical angle, indicating that angular information is mapped into the carrier phase. (Right) Due to intrinsic latency in pulse-counting demodulation, the uncompensated angular error increases with rotational speed, showing that delay compensation is necessary under dynamic rotation.

3.5. Kalman-Filter-Based Time-Latency Compensation

To mitigate the time-latency introduced by the STM counting process and to further suppress measurement noise, a Kalman filter (KF) is employed to estimate the angular velocity in real time and to perform predictive compensation for the angle output [22,24]. Related studies have also shown that FPGA-based Kalman-type estimators can improve encoder measurement quality, enhance real-time angle estimation, and reduce effective latency, which further supports the use of model-based prediction in the present work [26]. This treatment is also supported by prior encoder-based servo studies, in which reduced-order EKF estimation was introduced to reduce the effective delay of counting-based speed feedback and improve dynamic response. This provides further motivation for employing Kalman-type prediction to compensate for the intrinsic latency of STM pulse-counting demodulation in the present work [27].

3.5.1. State-Space Model Formulation

The rotational motion of the magnetic encoder is modeled as a discrete-time dynamic system. Since the angular velocity varies smoothly over a short sampling interval, its variation can be regarded as a random fluctuation. Therefore, a simplified state-space model is adopted. The system state vector is defined as
x k = ω k ε k ,
where ω k denotes the angular velocity at time step k, and ε k denotes a slowly varying acceleration term that captures short-term variations of the angular velocity.
The state transition equation is given by
x ( k ) = A x ( k − 1 ) + q ( k − 1 ) ,
where A is the state transition matrix and q denotes the process noise. Assuming that the angular velocity approximately follows a constant-velocity model over a short interval but is perturbed by random fluctuations, A is defined as
A = 1 T 0 1 ,
where T is the update interval of the STM angle output.
The observation equation relates the system state to the measurement. The measurement y k is defined as the increment of the STM-demodulated angle between two consecutive updates, i.e.,
y k = θ raw ( k ) − θ raw ( k − 1 ) .
This increment is approximately equal to the average angular velocity multiplied by the sampling period T. Thus, the observation model can be written as
y k = H x k + r k ,
where H is the observation matrix and r k is the measurement noise. Accordingly,
H = T 0 .
The process-noise covariance Q and measurement-noise covariance R are key parameters of the filter, and their values determine the weighting between model prediction and measurement information.

3.5.2. Filtering and Compensation Procedure

The Kalman filter consists of two major steps: prediction and update.
Prediction Step
Based on the state estimate at the previous time step, the predicted state and its error covariance are
x ^ k | k − 1 = A x ^ k − 1 | k − 1 ,
P k | k − 1 = A P k − 1 | k − 1 A T + Q .
Update Step
The current measurement is used to correct the predicted state, yielding an improved estimate and an updated error covariance. The Kalman gain is computed as
K k = P k | k − 1 H T H P k | k − 1 H T + R − 1 .
Then, the state estimate is updated by
x ^ k | k = x ^ k | k − 1 + K k y k − H x ^ k | k − 1 ,
and the error covariance is updated as
P k | k = I − K k H P k | k − 1 .
Through the above recursion, a smooth and real-time estimate of the angular velocity ω ^ k can be obtained.

3.5.3. Time-Latency Compensation

Since the high-frequency pulse interpolation requires waiting for the characteristic point and completing the counting process, the decoded angle θ raw exhibits an effective time latency Δ T lag with respect to the true angle. This latency is typically on the order of the carrier period, and its exact value depends on the implementation details; it can be determined from the system parameters or calibrated experimentally.
Using the real-time angular velocity estimate ω ^ k provided by the Kalman filter, a predictive feed-forward compensation of the angle change during the latency interval can be performed. The “missed” angle during Δ T lag is computed as
Δ θ comp = ω ^ k · Δ T lag ,
and the compensated real-time angle output is obtained by
θ final = θ raw + Δ θ comp .
In this way, high-factor interpolation is realized by high-frequency pulse interpolation, while the intrinsic time latency is effectively compensated for by the KF algorithm, thereby enabling highly real-time angle demodulation.

4. Experimental Platform and Hardware Implementation

To validate the proposed demodulation chain under realistic rotation conditions, an experimental platform was built on a Xilinx Zynq-7020 SoC. The setup integrates signal acquisition, FPGA-based real-time processing, reference measurement, and host-side logging for quantitative evaluation.

Hardware Architecture of the Experimental Platform

Figure 6 shows the experimental setup, which includes:
Figure 6. Photograph of the experimental platform, including the magnetic sensor, DC motor, optical encoder, FPGA board, and host-side monitoring/logging links.
  • Device under test: a DC motor driving a single-pole diametrically magnetized permanent magnet.
  • Acquisition and processing: a magnetic sensor providing sine/cosine outputs, processed by the FPGA in real time.
  • Reference benchmark: a 5000 P/R incremental optical encoder mounted on the rear shaft and used as the reference channel. Under quadrature × 4 counting, the corresponding comparison resolution is 0.018 ° .
  • Monitoring and logging: RS-485 serial transmission to a PC for real-time display and data recording.
The optical encoder mounted on the rear shaft was used as the reference channel for performance evaluation. A 5000 P/R incremental optical encoder was adopted, and the comparison resolution was determined by the selected counting mode. It should be noted that this value represents the resolution of the reference channel rather than its absolute accuracy. The uncertainty of the reference measurement chain may also arise from quantization, shaft misalignment, coupling eccentricity, and timing skew between the optical-encoder channel and the FPGA demodulation output.
The comparison tests were carried out at representative operating speeds of 1000 rpm and 3000 rpm. For each operating condition, repeated measurements were performed, and 100 samples were recorded for averaging. Before each comparison, the motor was first kept at standstill, and the optical-encoder pulse count was reset to zero. To reduce installation-related errors, the rotating magnet, motor shaft, and sensor were arranged as coaxially as possible, and the air gap between the magnet and the sensor was maintained at approximately 2 mm. In addition, synchronous acquisition was performed between the optical-encoder pulse count and the FPGA angle output during evaluation. Therefore, the reported error reflects the deviation between the proposed demodulation result and the reference channel under the above installation and synchronization conditions.

5. Experiment

5.1. Comparative Analysis

To demonstrate the effectiveness of the proposed demodulation chain, comparative experiments were conducted against three representative solutions: (i) an online compensation-oriented magnetic-encoder demodulation pipeline following the real-time compensation philosophy in [17], (ii) a conventional “correction + arctan” solution consistent with the high-precision magnetic-encoder demodulation route in [18], and (iii) a Kalman-filter-based phase demodulation strategy for sinusoidal encoders reported in [22].
As shown in Figure 7, the proposed method achieves a noticeably narrower error band over the full rotation range. This improvement is mainly attributed to two factors: (1) the front-end phase correction improves the consistency of the zero-crossing locations of the modulated waveform, reducing the counting jitter amplification in STM; (2) KF-based compensation together with dynamic delay correction suppresses the velocity-dependent error introduced by the intrinsic latency of pulse counting and demodulation.
Figure 7. Full-range angular error comparison among different demodulation pipelines. The compared methods include: phase orthogonalization + dynamic delay compensation, vector-synthesis phase correction + arctan demodulation, and vector phase correction + STM + KF.
To further visualize the front-end quadrature quality under different demodulation chains, Figure 8 compares the corresponding Lissajous portraits.
Figure 8. Lissajous portraits under different demodulation chains (from left to right): (a) phase orthogonalization + dynamic delay compensation [17]; (b) Kalman-filter-based phase demodulation [22]; (c) vector-synthesis phase correction + arctan demodulation [18]; and (d) vector phase correction + STM + KF.
Figure 8 shows that the proposed method yields the closest-to-ideal circular trajectory, indicating that phase inconsistency and amplitude/offset coupling are more effectively suppressed. This directly explains the reduced periodic error components observed in Figure 7.
Table 1 summarizes the full-range angle error statistics of the four demodulation pipelines and quantitatively compares their overall performance.
Table 1. Angle error statistics of four demodulation pipelines over the full 0–360° range.
Table 2 summarizes the logic resource consumption of the proposed method on the FPGA. It can be observed that the utilization of LUTs, FFs, DSP48s, and BRAMs remains at a low level. This indicates that the implementation efficiently meets the real-time processing requirements while leaving sufficient margin for future functional expansion.
Table 2. Logic resource utilization on the FPGA.

5.2. Experimental Results

To provide an overall assessment of the proposed demodulation chain, Figure 9 summarizes the full-range angular error of the proposed method.
Figure 9. Final full-range angular error and signal trajectory analysis of the proposed method. The blue square marks the local region highlighted for enlarged visual inspection in the figure.
As shown in Figure 9a, the angular tracking error remains tightly bounded within ±0.033° over the full 0–360° range. Meanwhile, the Lissajous trajectory in Figure 9b exhibits high orthogonality and strictly adheres to the ideal unit circle. These results collectively demonstrate the effectiveness of the proposed correction–interpolation–compensation chain.

6. Conclusions and Outlook

6.1. Conclusions

In this work, the intrinsic nonlinear errors of magnetic-encoder signals and the limitations of conventional digital demodulation methods were investigated for high-precision and high-dynamic position sensing. A cascaded FPGA-based “correction–interpolation–compensation” architecture was developed and experimentally validated. Through vector-based phase orthogonalization, STM-based high-frequency pulse interpolation, and Kalman-filter-based dynamic compensation, the zero-crossing instability and intrinsic latency of counting-based demodulation were effectively reduced. Over the full 360 ° range, an MAE of 0.009 ° , an RMSE of 0.012 ° , and a maximum absolute error of 0.033 ° were achieved. Compared with the other three demodulation pipelines, whose maximum absolute errors were 0.200 ° , 0.125 ° , and 0.047 ° , respectively, the proposed method provided the best overall accuracy. Therefore, an effective and feasible solution for FPGA-oriented real-time magnetic-encoder angle demodulation was demonstrated.

6.2. Outlook

Although the proposed system achieves promising performance, further improvements can be explored. In practical industrial scenarios, operating conditions (e.g., acceleration/deceleration) and electromagnetic interference are time-varying. Future work will investigate adaptive Kalman filtering strategies based on innovation/residual sequences to adjust the filter parameters in real time so as to better balance steady-state accuracy and dynamic response speed.

Author Contributions

Conceptualization, S.J. and S.L.; methodology, S.L.; software, S.L.; validation, S.J. and S.L.; formal analysis, S.L.; investigation, S.L.; resources, S.J. and S.L.; data curation, S.L.; writing—original draft preparation, S.L.; writing—review and editing, S.J. and S.L.; visualization, S.L.; supervision, S.J. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available from the corresponding author upon reasonable request.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Chen, Z.; Pu, H.; Liu, X.; Peng, D.; Yu, Z. A time-grating sensor for displacement measurement with long range and nanometer accuracy. IEEE Trans. Instrum. Meas. 2015, 64, 3105–3115. [Google Scholar] [CrossRef] [Scilit]
  2. Wang, S.; Wu, Z.; Peng, D.; Chen, S.; Zhang, Z.; Liu, S. Sensing mechanism of a rotary magnetic encoder based on time grating. IEEE Sens. J. 2018, 18, 3677–3683. [Google Scholar] [CrossRef]
  3. Guo, Y.; Liu, D.; Wu, N.; Chen, S. Research on the accuracy improvement method of angle encoder based on Kalman filter. J. Phys. Conf. Ser. 2022, 2290, 012079. [Google Scholar] [CrossRef] [Scilit]
  4. Chen, X.; He, X.; Zhang, Y.; Gao, B. Angle Measurement Method Based on Cross-Orthogonal Hall Sensor. In Proceedings of the 2023 IEEE 16th International Conference on Electronic Measurement & Instruments (ICEMI), Harbin, China, 9–11 August 2023; pp. 153–158. [Google Scholar] [CrossRef] [Scilit]
  5. Benammar, M.; Ben-Brahim, L.; Alhamadi, M.A. A novel resolver-to-360° linearized converter. IEEE Sens. J. 2004, 4, 96–101. [Google Scholar] [CrossRef]
  6. Jia, H.K.; Yu, L.D.; Zhao, H.N.; Jiang, Y.Z. A New Method of Angle Measurement Error Analysis of Rotary Encoders. Appl. Sci. 2019, 9, 3415. [Google Scholar] [CrossRef] [Scilit]
  7. Ye, G.; Liu, H.; Wang, Y.; Lei, B.; Shi, Y.; Yin, L.; Lu, B. Ratiometric-linearization-based high-precision electronic interpolator for sinusoidal optical encoders. IEEE Trans. Ind. Electron. 2018, 65, 8224–8231. [Google Scholar] [CrossRef]
  8. Bhaskarrao, N.K.; Sreekantan, A.C.; Dutta, P.K. Analysis of a linearizing direct digitizer with phase-error compensation for TMR angular position sensor. IEEE Trans. Instrum. Meas. 2018, 67, 1795–1803. [Google Scholar] [CrossRef] [Scilit]
  9. Gao, Z.; Zhou, B.; Li, C.; Hou, B.; Sun, H.; Wei, Q.; Zhang, R. Design and Implementation of a System-on-Chip for Self-Calibration of an Angular Position Sensor. Appl. Sci. 2019, 9, 4772. [Google Scholar] [CrossRef] [Scilit]
  10. Wang, Y.; Hua, W.; Zhang, C.; Wu, Z.; Zhang, H. Concept and Implementation of Embedded Magnetic Encoder in Flux-Switching Permanent-Magnet Machines. IEEE Trans. Ind. Electron. 2021, 69, 11796–11806. [Google Scholar] [CrossRef] [Scilit]
  11. Zhang, X.; Zhang, W. An improved rotor position estimation in PMSM with low-resolution hall-effect sensors. In Proceedings of the 2014 International Conference on Electrical Machines and Systems (ICEMS), Hangzhou, China, 22–25 October 2014. [Google Scholar] [CrossRef] [Scilit]
  12. Xu, X.; Huang, X.; Li, Z. An Improved Rotor Position Estimation Method for PMSM Using Low-Resolution Hall-Effect Sensors. In Proceedings of the 2022 International Technical Conference on Electrical and Computer Engineering Asia-Pacific (ITEC ASIA-Pacific), Haining, China, 28–31 October 2022. [Google Scholar] [CrossRef] [Scilit]
  13. Qu, K.; Pang, P.; Hua, W. High-Precision Rotor Position Fitting Method of Permanent Magnet Synchronous Machine Based on Hall-Effect Sensors. Energies 2024, 17, 5625. [Google Scholar] [CrossRef] [Scilit]
  14. Jiang, Y.; Zheng, B.; Sheng, D.; Li, X. A data-driven error compensation method for a magnetic encoder based on variational mode decomposition and particle swarm optimization optimized deep belief network. Sens. Actuators A Phys. 2024, 366, 115003. [Google Scholar] [CrossRef] [Scilit]
  15. Zhang, H.; Wang, Y.; Zhang, J.; Yin, H.; Wang, P.; Zhang, C.; Hua, W. Multiobjective optimization of an embedded magnetic encoder using Kriging-assisted method. IEEE Trans. Instrum. Meas. 2023, 72, 2509512. [Google Scholar] [CrossRef] [Scilit]
  16. Wang, Y.; Bao, X.; Hua, W.; Liu, K.; Wang, P.; Hu, M.; Zhang, H. Implementation of Embedded Magnetic Encoder for Rotor Position Detection Based on Arbitrary Phase-Shift Phase-Lock Loop. IEEE Trans. Ind. Electron. 2022, 69, 2033–2043. [Google Scholar] [CrossRef] [Scilit]
  17. Shen, H.; Wang, M. High-precision magnetic encoder module design based on real-time error compensation algorithm. J. Phys. Conf. Ser. 2019, 1345, 042082. [Google Scholar] [CrossRef] [Scilit]
  18. Zhang, B.; Jiang, Y.; Li, Y.; Chen, X.; Wen, X. Design and development of high precision magnetic encoder based on TMR MEMS device. In Proceedings of the 2021 IEEE 16th International Conference on Nano/Micro Engineered and Molecular Systems (NEMS), Xiamen, China, 25–29 April 2021; pp. 474–479. [Google Scholar] [CrossRef] [Scilit]
  19. Chuang, H.C.; Kung, C.W.; Chen, L.W.; Jiang, S.B. Nonlinear error correction for magnetic encoders. IEEE Sens. J. 2023, 23, 9129–9135. [Google Scholar] [CrossRef] [Scilit]
  20. Zhao, G.; Ye, G.; Liu, H.; Lei, B.; Li, X.; Han, W.; Liu, H. Electronic interpolation interface based on linear subdivision method for sinusoidal optical encoders. IEEE Sens. J. 2019, 20, 3646–3654. [Google Scholar] [CrossRef] [Scilit]
  21. Zhu, W.; Xu, Y.; Huang, Y.; Xue, Z.; Ye, S. Subdivision method for nonorthogonal Moiré signals. IEEE Trans. Instrum. Meas. 2020, 70, 9503110. [Google Scholar] [CrossRef] [Scilit]
  22. Zhao, G.; Ban, Y.; Zhang, Z.; Shi, Y.; Liu, H. Phase demodulation strategy based on Kalman filter for sinusoidal encoders. IEEE Sens. J. 2023, 23, 10625–10632. [Google Scholar] [CrossRef] [Scilit]
  23. Yu, Z.; Peng, K.; Liu, X.; Chen, Z.; Huang, Y. A high-precision absolute angular-displacement capacitive sensor using three-stage time-grating in conjunction with a remodulation scheme. IEEE Trans. Ind. Electron. 2018, 66, 7376–7385. [Google Scholar] [CrossRef] [Scilit]
  24. Ban, Y.; Zhao, G.; Zhang, Z.; Chen, B.; Lu, B.; Liu, H. High-factor interpolation method based on space-time modulation and a Kalman filter for optical encoders. Opt. Express 2024, 32, 1914–1925. [Google Scholar] [CrossRef] [Scilit]
  25. Pop, A.A. Incremental Encoder Speed Acquisition Using an STM32 Microcontroller and NI ELVIS. Sensors 2022, 22, 5127. [Google Scholar] [CrossRef] [Scilit]
  26. Janiszewski, D. An FPGA-Based Trigonometric Kalman Filter Approach for Improving the Measurement Quality of a Multi-Head Rotational Encoder. Energies 2024, 17, 6122. [Google Scholar] [CrossRef] [Scilit]
  27. Liu, T.; Tong, Q.; Zhang, Q.; Li, Q.; Li, L.; Wu, Z. A Method to Improve the Response of a Speed Loop by Using a Reduced-Order Extended Kalman Filter. Energies 2018, 11, 2886. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.