# Achieve High Resolution with Robust Magnetic Motion Sensors

A growing number of applications require linear motion sensing, including X-Y tooling tables, pneumatic pistons, automatic sliding doors and zoom lenses. One commonly used technique involves resistive strips (potentiometers). While this approach is simple and inexpensive, it depends on mechanical contacts so it is prone to wearing out. Optical techniques overcome this limitation but optical paths can be affected by dirt, moisture and other contaminants compromising accuracy and reliability.

Basic magnetic sensors overcome the effects of contaminants and physical wear and tear, but precision is limited by the resolution of the magnetic pole strips they sense, typically 0.5 mm. However, by using an interpolation technique this robust technology can deliver high-resolution measurements, to as small as 15 µm. This article explains how high-resolution motion sensing can be achieved, simply and effectively, using an interpolated magnetic-sensor system. This technology is suitable for applications that require motion measurement in tiny increments and where high reliability is mandated.

It is relatively simple to build a contactless linear motion sensor using Hall-effect switches aligned with a multi-pole magnetic strip (see Figure 1). Each Hall-effect switch turns on and off in response to changes in a magnetic field. As the magnetic strip passes a Hall-effect switch, it switches in response to the changing magnetic field, producing a square-wave output that indicates the number of magnetic poles that have passed. If the width of the magnetic poles is known, this square wave indicates the distance the magnetic strip has been displaced.

To determine the direction of motion, a second Hall-effect switch can be placed half a pole length from the first so that it produces the same output signal but phase shifted by 90°. This phase shift can be used to determine the direction of movement by evaluating which signal has a rising edge while the other signal is low. These phase-shifted signals are commonly known as quadrature signals.

As illustrated in Figure 1, a movement of the magnetic strip from left to right would generate a rising edge on signal A while signal B is low. Moving the strip from right to left would generate a rising edge on signal B while signal A is low. Looking at each quadrature signal (A and B) separately, the achievable resolution is one pulse per cycle, or one pulse per pole pair on the magnetic strip. This is referred to as a 1x quadrature signal. By applying an XOR function (A=B=0, A<>B = 1) to the combination of signals A and B, the number of pulses per cycle can be doubled, which is known as 2x decoding. A further increase in resolution is achieved by generating a pulse from both rising and falling edges of each signal, which produces 4 pulses per cycle and is known as 4x decoding.

Although 2x and 4x decoding can be used to produce more pulses per pole pair, system resolution is still limited by the length of these pole pairs, which in practice is limited to approximately 0.5 mm.

An interpolation technique can be used to overcome the limited resolution of magnetic pole strips. This approach benefits from the application of advanced analog engineering techniques, whereas the basic magnetic sensor described above is limited by the digital nature of its output.

An interpolated magnetic sensor uses linear Hall-effect sensors instead of Hall-effect switches. Linear-effect Hall sensors provide an analog output that is proportional to the strength of the magnetic field perpendicular to the Hall sensor. Sliding a multi-pole magnetic strip over a linear Hall sensor generates a sinusoidal signal at the output of the sensor, as opposed to the square wave generated by a Hall switch.

By placing four linear Hall-effect sensors exactly half a pole length apart, four sinusoidal signals are generated as the magnetic strip slides over the sensors. Each signal is phase shifted by 90° from its neighboring sensor, as shown in Figure 2. In mathematical terms, the four signals generated (H1, H2, H3 and H4) represent sine, cosine, inverted sine and inverted cosine.

By combining sine with inverted sine, and cosine with inverted cosine, sine and cosine signals of double amplitude are provided. This combination requires one of the input signals to be inverted, which therefore inverts interference from external magnetic fields. Any common-mode interference is therefore cancelled out when sine and inverted sine are combined, and when cosine and inverted cosine are combined. This prevents extraneous magnetic fields in the vicinity of the sensor from degrading its output.

The two resulting analog signals can then be converted into digital format by an Analog-to-Digital Converter (ADC) for further processing by a Digital Signal Processor (DSP). Thus, high-resolution digital angle and magnitude information is produced from the sine and cosine signals.

A major advantage of using linear Hall-effect sensors with interpolators is that they can be integrated on a single silicon chip using standard CMOS processing methods. The key benefit is that the precise Hall sensor outputs allow interpolation to yield high-resolution position sensing.

Devices in austriamicrosystems’ family of linear and rotary magnetic encoders use a CORDIC (COordinate to Rotation DIgital Computer) to achieve high-performance processing of the position signal. First, the differential sine and cosine signals are digitized by a high-resolution ADC. The CORDIC converts two-dimensional coordinates from one format to another, as shown in Figure 3. The input format is a rectangular coordinate system in which sine and cosine represent the X and Y axis, respectively. The output format is a polar coordinate system with phase and magnitude outputs.

By using the sine and cosine signals from the Hall sensors as shown in Figure 2, the output phase information produced by the CORDIC represents a proportion of one pole-pair length, with a value of between 0° and 360°. Depending on the resolution of the CORDIC, one 360° phase can be broken into multiple steps. The number of steps the CORDIC can resolve is called the interpolation factor. Since one phase corresponds to one pole-pair length, breaking the phase into multiple steps generates high-resolution motion detection.

To illustrate, the interpolation factor shown in the example of Figure 2 is 48 steps within one pole pair. In actual practice, much higher interpolation factors can be achieved. For instance, the AS5306 from austriamicrosystems (see Figure 5) achieves an interpolation factor of 160 steps per pole pair (see Figure 4). Based on 40 pulses per pole pair, with a pole length of 1.2 mm, this device achieves a resolution of 15 µm:

Resolution = pole length / interpolation factor

15 µm = 2.4 mm / 160

The interpolation technique described above is complex in theory. However, its implementation in a range of single-chip devices can integrate all required analog electronics and signal processing, and provide simple digital outputs for a microcontroller. As a result, design engineers can now implement a robust, contactless motion sensing system which is immune to dirt and other contaminants and which can achieve very high resolution.

For more information: www.austriamicrosystems.com [1]

Basic magnetic sensors overcome the effects of contaminants and physical wear and tear, but precision is limited by the resolution of the magnetic pole strips they sense, typically 0.5 mm. However, by using an interpolation technique this robust technology can deliver high-resolution measurements, to as small as 15 µm. This article explains how high-resolution motion sensing can be achieved, simply and effectively, using an interpolated magnetic-sensor system. This technology is suitable for applications that require motion measurement in tiny increments and where high reliability is mandated.

**Using Hall-effect Switches for Basic Magnetic Sensing**It is relatively simple to build a contactless linear motion sensor using Hall-effect switches aligned with a multi-pole magnetic strip (see Figure 1). Each Hall-effect switch turns on and off in response to changes in a magnetic field. As the magnetic strip passes a Hall-effect switch, it switches in response to the changing magnetic field, producing a square-wave output that indicates the number of magnetic poles that have passed. If the width of the magnetic poles is known, this square wave indicates the distance the magnetic strip has been displaced.

To determine the direction of motion, a second Hall-effect switch can be placed half a pole length from the first so that it produces the same output signal but phase shifted by 90°. This phase shift can be used to determine the direction of movement by evaluating which signal has a rising edge while the other signal is low. These phase-shifted signals are commonly known as quadrature signals.

As illustrated in Figure 1, a movement of the magnetic strip from left to right would generate a rising edge on signal A while signal B is low. Moving the strip from right to left would generate a rising edge on signal B while signal A is low. Looking at each quadrature signal (A and B) separately, the achievable resolution is one pulse per cycle, or one pulse per pole pair on the magnetic strip. This is referred to as a 1x quadrature signal. By applying an XOR function (A=B=0, A<>B = 1) to the combination of signals A and B, the number of pulses per cycle can be doubled, which is known as 2x decoding. A further increase in resolution is achieved by generating a pulse from both rising and falling edges of each signal, which produces 4 pulses per cycle and is known as 4x decoding.

Although 2x and 4x decoding can be used to produce more pulses per pole pair, system resolution is still limited by the length of these pole pairs, which in practice is limited to approximately 0.5 mm.

**Increasing the Resolution of Magnetic Motion Sensing**An interpolation technique can be used to overcome the limited resolution of magnetic pole strips. This approach benefits from the application of advanced analog engineering techniques, whereas the basic magnetic sensor described above is limited by the digital nature of its output.

An interpolated magnetic sensor uses linear Hall-effect sensors instead of Hall-effect switches. Linear-effect Hall sensors provide an analog output that is proportional to the strength of the magnetic field perpendicular to the Hall sensor. Sliding a multi-pole magnetic strip over a linear Hall sensor generates a sinusoidal signal at the output of the sensor, as opposed to the square wave generated by a Hall switch.

By placing four linear Hall-effect sensors exactly half a pole length apart, four sinusoidal signals are generated as the magnetic strip slides over the sensors. Each signal is phase shifted by 90° from its neighboring sensor, as shown in Figure 2. In mathematical terms, the four signals generated (H1, H2, H3 and H4) represent sine, cosine, inverted sine and inverted cosine.

By combining sine with inverted sine, and cosine with inverted cosine, sine and cosine signals of double amplitude are provided. This combination requires one of the input signals to be inverted, which therefore inverts interference from external magnetic fields. Any common-mode interference is therefore cancelled out when sine and inverted sine are combined, and when cosine and inverted cosine are combined. This prevents extraneous magnetic fields in the vicinity of the sensor from degrading its output.

The two resulting analog signals can then be converted into digital format by an Analog-to-Digital Converter (ADC) for further processing by a Digital Signal Processor (DSP). Thus, high-resolution digital angle and magnitude information is produced from the sine and cosine signals.

**Interpolation Technique in Practice**A major advantage of using linear Hall-effect sensors with interpolators is that they can be integrated on a single silicon chip using standard CMOS processing methods. The key benefit is that the precise Hall sensor outputs allow interpolation to yield high-resolution position sensing.

Devices in austriamicrosystems’ family of linear and rotary magnetic encoders use a CORDIC (COordinate to Rotation DIgital Computer) to achieve high-performance processing of the position signal. First, the differential sine and cosine signals are digitized by a high-resolution ADC. The CORDIC converts two-dimensional coordinates from one format to another, as shown in Figure 3. The input format is a rectangular coordinate system in which sine and cosine represent the X and Y axis, respectively. The output format is a polar coordinate system with phase and magnitude outputs.

By using the sine and cosine signals from the Hall sensors as shown in Figure 2, the output phase information produced by the CORDIC represents a proportion of one pole-pair length, with a value of between 0° and 360°. Depending on the resolution of the CORDIC, one 360° phase can be broken into multiple steps. The number of steps the CORDIC can resolve is called the interpolation factor. Since one phase corresponds to one pole-pair length, breaking the phase into multiple steps generates high-resolution motion detection.

To illustrate, the interpolation factor shown in the example of Figure 2 is 48 steps within one pole pair. In actual practice, much higher interpolation factors can be achieved. For instance, the AS5306 from austriamicrosystems (see Figure 5) achieves an interpolation factor of 160 steps per pole pair (see Figure 4). Based on 40 pulses per pole pair, with a pole length of 1.2 mm, this device achieves a resolution of 15 µm:

Resolution = pole length / interpolation factor

15 µm = 2.4 mm / 160

**Summary**The interpolation technique described above is complex in theory. However, its implementation in a range of single-chip devices can integrate all required analog electronics and signal processing, and provide simple digital outputs for a microcontroller. As a result, design engineers can now implement a robust, contactless motion sensing system which is immune to dirt and other contaminants and which can achieve very high resolution.

For more information: www.austriamicrosystems.com [1]