Sine/cosine-to-digital conversion

Sine/cosine-to-digital conversion

Technology News |
By eeNews Europe

Optical or magnetic sensors for position and angle sensing in motion control systems generally provide sine and cosine signals for conversion. The 90° phase shift between sine and cosine allows determination of the position or angle within the 360° input cycle, as well as the direction of rotation or movement. For resolutions in the micrometer or sub-arc minute range, precise interpolation of the sine and cosine signals is necessary. This sine/cosine-to-digital conversion (SDC) can be performed in several ways, either in hardware or software. For high-precision results, the quality of the signal conditioning and of the S/D conversion is of major importance. In the following, several SDC (interpolation) methods are analyzed and compared, and accuracy results are discussed.

Sensor Signal Path with S/D Conversion

Sensors in electronic position and angle measurement work on optical, magnetic, inductive, or capacitive principles. Optical sensors with LED light source and code disc are very common, as are magnetic GMR/AMR/Hall sensors using a dipole magnet or multi-pole wheel [1]. As shown in Figure 1, these sensors usually provide a sine and a cosine signal directly. Because they do not always provide perfect sine/cosine signals, the sensor outputs must be conditioned before interpolation to allow high accuracy results. The goal of this conditioning is to provide – as nearly as is possible – sine/cosine waves with equal amplitude, zero offset, and precisely 90° phase shift. Programmable gain amplifiers (PGAs) and/or lookup tables are often used to provide the required amplitude balancing (gain correction), offset compensation, and phase correction.

Typically, a Z sensor defines the zero position for position/angle measurement and its pulse output is sampled using an adjustable comparator. If no Z sensor is available, the interpolator can define the zero position as well [2]. In this case, the zero position can be set anywhere within the 360° input sine/cosine cycle to generate the Z output at a user-defined position or angle.

The interpolator implements the S/D conversion and outputs its result via one of several output interfaces. This digital output can be read directly by a local microcontroller or transmitted via line drivers to a remote control system.

Typical Methods of Sine/Cosine-to-Digital Conversion

The interpolator is responsible for the non-linear A/D conversion that transforms the sine/cosine signals into position or angle steps (see Figure 2). These steps are then output either incrementally as quadrature square-wave signals (which include direction information), or as a data word representing the absolute angle within the 360° input cycle.

The non-linear function usually used for Sine/Cosine-to-Digital conversion is the arc tangent, which calculates the output angle directly from the conditioned sine and cosine signals (see Figure 2). Many different A/D conversion methods can be used to implement the arc tangent function, depending on the application requirements:

  • Flash conversion, which uses many individual comparators to perform the conversion almost instantly. Vector-tracking conversion, which uses a single comparator to increment or decrement a digital counter to track the input angle.
  • SAR conversion, which is similar to vector-tracking conversion, but which samples and holds the input signal until the counter has settled.
  • DSP conversion, which digitizes the sine and cosine signals individually and calculates the arc tangent function in a Digital Signal Processor using a CORDIC or other numerical algorithm.

Modern interpolators typically employ either the vector-tracking or DSP conversion approaches.

Comparison of Converter Features

Needless to say, application requirements determine which type of conversion is best. With the sampling converters (flash and SAR), the required settling time determines the maximum sampling rate (see Table 1), which may be a limit in certain applications. Vector-tracking converters offer fast sampling and low latency by using high counter clock frequencies and fast analog circuitry, but manual calibration of the input signal conditioning is required for maximum performance. Linear A/D converters and DSP conversion provide high resolution and allow sophisticated auto-calibration, digital filtering, and fractional interpolation features not possible with other converters to be implemented in software. As with any DSP, however, lower sampling rates are required to allow time for signal processing.

Besides resolution, accuracy must be considered as well. With vector-tracking converters, accuracy depends not only on the quality of the A/D converters, but also on the resolution of the signal conditioning circuitry. Each D/A converter that provides corrective action in the signal path (offset, gain, or phase correction) require chip space, and consequently impacts cost—and optimization task for the circuit designer. Thus, vector-tracking converters can be found which provide lower resolution but higher accuracy due to higher resolution signal conditioning. DSP interpolators, on the other hand, provide high resolution for all calculations, limited only by the digital word size of the processor and the available calculation time. Accuracy in DSP solutions is determined exclusively by the quality of the A/D converters. In practice, however, the achievable accuracy in most application is typically limited by the quality of the sensor signals.

Safety-oriented encoder systems demand additional functions, such as special diagnostics for signal and temperature monitoring, memory checks, and error simulation. For controller communication, a single parallel interface as well as various serial interfaces is available. The configurable position data output available with BiSS-Interface can be augmented with life cycle counting and an extended 16-bit CRC [3].

Vector-Tracking Conversion in Detail

Vector-tracking converters have one primary comparator that controls the incrementing and decrementing of a counter (see Figure 3). The digital counter value (angle phi) feeds a D/A converter that produces an analog signal proportional to the tangent of the digital angle. This tangent signal is multiplied by the cosine input signal to produce a synthesized sine signal. The synthesized sine is compared to the sine input signal to drive the counter.

When the synthesized sine is equal to the sine input signal, the system is settled and the counter value equals the angle (phi) indicated by the sine/Cosine inputs from the sensor. The counter tracks every input change step by step – or rather bit by bit – and thus position or angle jumps are not possible. This type of converter is activated only by an input change and thus functions virtually clock-free, so the input-to-output latency time is relatively short.

Since only one comparator is required, it can be designed for precision. An additional characteristic of vector-tracking converters is that any circuit offset affects all switching points the same way – comparable to a hysteresis. Thus, the jitter in the tracking converter’s incremental output signals is determined almost exclusively by the quality of the input signals until the maximum tracking rate is reached.

Due to its low latency, this type of converter is often preferred for linear position measuring systems where high dynamic response, fast moves, and extremely short settling times are desired. High input frequencies can also be tracked, such as with iC-NQC (up to 250 kHz), allowing high-speed operation.

DSP Conversion in Detail

DSP Sine/Cosine-to-Digital converters use two high-accuracy, high-resolution linear A/D converters to directly digitize the sine and cosine signals from the position or angle sensor. The digitized sensor signals are then conditioned and the output angle calculated in the DSP (see Figure 4). The advantage of this approach lies in the digital signal processing: signal errors can be measured and corrected automatically for initial calibration (using a push button input, for example) and during operation to compensate for sensor drift and aging. These features make DSP converters easy to use, while still providing high resolution and excellent accuracy.

Sophisticated digital filtering makes it possible to achieve position/angle resolution that exceeds the A/D converter resolution. The synthesized incremental output signals show perfect 50% duty cycle and are nearly jitter-free with low-distortion sensor inputs. However, since a DSP is a sampled data system, there is a fixed time delay (latency) between input and output of a few microseconds, which may need to be considered in high-gain control systems. In most industrial control systems, this latency is of little consequence because of the load inertia involved. However, the position/angle lag caused by the latency when running at constant speed can be an issue. In this case, sophisticated signal processing algorithms in the DSP can be used reduce the lag by a factor of 6.

The DSP interpolator is preferred for modular industrial encoders and high-resolution linear length gauges, and extreme environment applications where the automatic error correction and filtering features are especially useful.
Digital Signal Conditioning

In the DSP interpolator’s analog signal path, the Programmable Gain Amplifiers (PGAs) provide only coarse adjustments for gain (typically 3 dB/step) and offset (typically 100 mV/step) to get the input signals into a favorable range for A/D conversion (see Figure 5).

Fine adjustments for offset, gain match, and phase corrections are applied digitally using the full 16-bit resolution of the DSP. This provides an extremely small step size (e.g. 0.056°/step for phase correction with iC-TW8) for signal conditioning. A sophisticated drift monitoring algorithm detects deviations from the factory calibration settings and can be configured to activate an alarm for early warning of impending failures.


As shown in the examples above, the choice of sine/cosine-to-digital conversion method can have a large effect on the application performance. Speed of conversion, resolution, accuracy, and latency all must be considered in determining the performance of the control loop. However, the accuracy of the interpolated position/angle output is typically not dependent on the SDC converter’s resolution, but rather on the resolution of the signal conditioning circuitry or algorithms, the stability of the analog signal path, and the quality of the sensor signals.


[1] Absolute Encoder Design: Magnetic or Optical? White Paper (iC-Haus)

[2] Dr. David Lin, Speed acquisition made simple, EDN, September 2008

[3] Open Source BiSS: Bidirectional Synchronous Serial Interface

[4] Dipl.-Ing. Bernd Schrörs and Dipl.-Ing. Marko Hepp, Fast optical distance sensing through System-on-Chip integration, EDN, September 29, 2012

If you enjoyed this article, you will like the following ones: don't miss them by subscribing to :    eeNews on Google News


Linked Articles