AN-2570: Magnetoresistive Linear Position Measurement

Circuit Function and Benefits

The circuit shown in Figure 1 provides a contactless, AMR (anisotropic magnetoresistive) linear position measurement solution with 2 mil (0.002 inch) accuracy over a 0.5 inch range. The circuit is ideal for applications where high speed, accurate, non-contact length and position measurements are critical.

Figure 1. Magnetoresistive Linear Position Measurement System (Simplified Schematic: Decoupling and All Connections Not Shown).

Figure 1. Magnetoresistive Linear Position Measurement System (Simplified Schematic: Decoupling and All Connections Not Shown).

The circuit provides all necessary signal conditioning including instrumentation amplifiers, buffers, and a dual channel ADC that efficiently process the AMR sensor low level bridge outputs.

The result is an industry leading position measurement solution suitable for valve and flow measurement, machine tool speed control, motor speed measurement, and other industrial or automotive applications.

Circuit Description

The Sensitec AA745 is an AMR-based angular sensor containing two galvanically separated Wheatstone bridges at a relative angle of 45° to each other. The AA745 offers minimal offset voltage (±2 mV) and high signal amplitude (70 mV). A rotating magnetic field stimulates the sensor, creating an output voltage of ±70 mV

An AD8227 instrumentation amplifier amplifies the signal of interest while rejecting the Wheatstone bridge common-mode voltage of 2.5 V. The common-mode output voltage of the in-amp is set to 2.5 V by driving the VREF pin to 2.5 V. A 2.96 kΩ gain resistor sets the gain of 32. This creates an analog output voltage of 0.2 V to 4.8 V for a bridge output of 2.5 V ±70 mV.

The circuit signal bandwidth is determined by the AD8227 that has an approximate 100 kHz bandwidth for a gain of 32.

A unity gain AD8615 op amp buffers the in-amp output voltage and connects directly to the ADC. This buffer has a rail-to-rail output stage that swings to within 200 mV of the supply rails.

The AD7866 is a dual channel 12-bit 1 MSPS SAR ADC. The polarity of the RANGE pin determines the analog input range and output coding. If this pin is tied to a logic high when the chip select goes low, the analog input range of the next conversion is 0 V to 2 VREF (0 V to 5 V), leaving approximately 200 mV headroom for the 0.2 V to 4.8 V input signal from the buffer amplifier.

Connecting the REFSEL pin low configures the ADC to use the internal 2.5 V reference voltage. This voltage is available on the VREF pin but requires a buffer before it can be used elsewhere in the system. The DCAPA pin and DCAPB pin are decoupled with 470 nF capacitors to ensure proper operation of the ADC. The reference voltage is buffered by the AD8615 and sets the common-mode output voltage of the AD8227 in-amp.

The AD7866 simultaneously samples both channels of the magnetoresistive sensor. The digital words are normally available on DOUTA and DOUTB. Each data stream consists of one leading zero followed by three status bits and then twelve bits of conversion data. However, by holding the chip select low for an additional 16 clock cycles, both digital words are read from one channel, DOUTA.

An SPI interface allows access to both channels on one data line.


Magnetoresistive (MR) Theory


Magnetoresistivity is the ability of a material to change the value of its resistance when subjected to an external magnetic field. The most commonly used MR sensors are based on the anisotropic magnetoresistive (AMR) effect.

An example of the AMR effect is shown in Figure 2. A current (I), flowing through a conductor, is subject to an external magnetic field (HY). The resistance of the conductor changes as a function of the angle (Ø) between the magnetization vector (M) and the current flow vector (I). The magnetization vector is the net sum of the internal magnetic field (HX) and the applied external magnetic field (HY).

Figure 2. Anisotropic Magnetoresistive Example.

Figure 2. Anisotropic Magnetoresistive Example

The maximum resistance occurs when the magnetization vector (M) is parallel to the current vector (I). The minimum resistance occurs when the magnetization vector (M) is perpendicular to the current vector (I).

Effective utilization of the AMR effect requires the conductor to be a material insensitive to mechanical stress but sensitive to magneto-restriction. For these reasons, permalloy (80% nickel, 20% iron) is the most commonly used alloy in AMR sensor manufacturing.


Permalloy Properties


There are two properties of permalloy strips that provide design challenges when creating angular measurement systems.

First, permalloy has a narrow linear operating region (see Figure 3). Only when the angle (Ø) between the magnetization vector (M) and current flow vector (I) becomes larger, does the response become linear. Unfortunately, shortly after the response becomes linear, it saturates.

Figure 3. Permalloy Resistance vs. Magnetic Field.

Figure 3. Permalloy Resistance vs. Magnetic Field.

Secondly, permalloy is insensitive to polarity. The resistance of a permalloy strip decreases whether the angle (Ø) between the magnetization vector (M) and the current flow vector (I) is positive or negative.


Barber Poles


A common method used to improve both the linearity and polar insensitivity of the permalloy strip is to add aluminum stripes angled at 45° to the strip axis called barber poles, as shown in Figure 4. Any current flowing between barber poles takes the shortest path—the perpendicular path, and the angle between the current flow vector (I) and magnetization vector (M) shifts by 45°.

Figure 4. Barber Pole Effect in a Permalloy Strip.

Figure 4. Barber Pole Effect in a Permalloy Strip.

Figure 5 shows the result of adding barber poles to a permalloy strip. The current flow vector shifts by 45°, but the magnetization vector remains unchanged. Notice the linear behavior now present in the middle of the graph.

Figure 5. Barber Pole Permalloy Resistance vs. Magnetic Field.

Figure 5. Barber Pole Permalloy Resistance vs. Magnetic Field.


Magnetic Field Strength and Orientation


The AA745 magnetoresistive sensor requires a minimum magnetic field strength of 25 kA/m to ensure the error specification found in the data sheet. This stimulating magnetic field must intersect the center of the sensor package.

When selecting a magnet, consider the air gap between the sensor and the magnet as shown in Figure 6. The distance between magnet and sensor should be equal to half of the magnet length (d = 0.5 × L). It is critical to align the magnet and sensor in three dimensions as accurately as possible. Any misalignment introduces errors and create nonlinearities in the signal of interest. Misalignment errors in any dimension are discussed in the Test Results section.

Figure 6. Magnet Orientation and Air Gap for Linear Position Measurement.

Figure 6. Magnet Orientation and Air Gap for Linear Position Measurement.


Sensor Basics


The standard AMR sensor consists of two Wheatstone bridges, with one bridge at a relative angle of 45° with respect to the other. Permalloy strips comprise each element of both bridges and have nominal resistance values of 3.2 kΩ.

Figure 7. AA745 Dual Wheatstone Bridge Configuration.

Figure 7. AA745 Dual Wheatstone Bridge Configuration.

The maximum peak signal amplitude of the AA745 is 70 mV (14 mV/VCC on a 5 V supply). The sensor offset voltage is ±10 mV (±2 mV/VCC on a 5 V supply) giving a useable 2.5 V ±0.70 mV output signal. A rotating magnetic field produces the sin (2ø) and cos (2ø) outputs seen in Figure 8. Both signals are periodic over a 180° range, making the detection of full 360° measurements impossible without additional circuitry and components.

Figure 8. Magnetoresistive Sensor Output Voltage.

Figure 8. Magnetoresistive Sensor Output Voltage.


Channel Sensitivity


The sensor has a nominal sensitivity of 2.35 mV/° for each channel. This means each degree of change between the magnetization vector and the sensor orientation produces an output voltage change of 2.35 mV. The sensitivity is not constant with respect to the angle. The areas of decreased sensitivity are the portions of each output where the slope of the line approaches zero.

Referring to Figure 8, channel one (the blue line) loses sensitivity as the magnetization vector angle nears 45° or 135°. Similarly, channel two (the red line) loses sensitivity around 0° and 90°. Fortunately, when one channel has reduced sensitivity, the other channel is in a region of high sensitivity.

The software takes advantage of this, measuring the angle based on whichever sensor is most accurate at the time. If channel one is approaching 45°, channel two is used to calculate the angle and maintain the system accuracy


Test Results


This circuit is tested by mounting a magnet to the arm of a digital caliper. This circuit sits in position with the face of the AA745 AMR sensor (U5) perpendicular to the face of the magnet. As the magnet moves, the caliper displays the distance travelled accurate to 0.0005 inch. Simultaneously, the magnetic field lines intersect the sensor and provide a useable output voltage. A functional diagram of the setup is shown in Figure 9, and a photo of the setup is shown in Figure 10.

Figure 9. Data Collection Test Setup.

Figure 9. Data Collection Test Setup.

Figure 10. Photo of Bench Test Setup.

Figure 10. Photo of Bench Test Setup.

The magnet used in testing is 2 inches long and is positioned 1 inch away from the sensor. Data is collected by moving the magnet and comparing the evaluation software reading to the caliper digital display reading. Figure 11 shows the output position error recorded over a 1.0 inch range. The error is ±2 mil over the entire range.

Figure 11. Magnetic Field Position Error: 1.0 Inch Range, Data Shown for
Four Boards.

Figure 11. Magnetic Field Position Error: 1.0 Inch Range, Data Shown for Four Boards.

Restricting the measurement range to 0.4 inches produces better error results. Note that 0.4 inches coincides with the linear portion of the trigonometric waves shown in Figure 8 and confines measurement to a 30˚ range. Applying a new gain correction factor for this modified range produces a ±1 mil error seen in Figure 12.

Figure 12. Magnetic Field Position Error: 0.4 Inch Range, Data Shown for
Four Boards.

Figure 12. Magnetic Field Position Error: 0.4 Inch Range, Data Shown for Four Boards.

The sensor is positioned so it sits in the middle of the body of the magnet as seen in Figure 13. A common error source, vertical misalignment, occurs when the sensor is moved up or down with respect to the magnet.

Figure 13. Photo of Bench Test Setup: Vertical Misalignment.

Figure 13. Photo of Bench Test Setup: Vertical Misalignment.

Figure 14 shows the errors introduced by misaligning the sensor and magnet vertically. This test consists of moving the PCB up or down by 0.25 inch and 0.5 inch before collecting data. For a measurement range of 1.0 inch, moving the 0.25 inch up or down seriously degrades the performance, adding several mils of error to the calculation. Moving the sensor 0.5 inch up or down makes matters worse, adding tens of mils of error to the original reading.

Figure 14. Magnetic Field Position Error: Vertical Misalignment.

Figure 14. Magnetic Field Position Error: Vertical Misalignment.

By modifying the gain correction factor, these large errors can be improved but not removed completely. Increasing the distance from the magnet negatively influences the magnetic field strength and orientation of the magnetic field lines making some of the data unrecoverable.

Figure 15 shows a second common error source, rotational misalignment. While the sensor and magnet are positioned ideally with respect to the vertical, the sensor is not parallel to the face of the magnet.

Figure 15. Photo of Bench Test Setup: Rotational Misalignment.

Figure 15. Photo of Bench Test Setup: Rotational Misalignment.

Figure 16 shows the readings associated with this error source. The green line shows the errors recorded for a parallel configuration while the red and blue lines show the additional errors introduced by rotating the sensor left or right with respect to the face of the magnet.

Figure 16. Magnetic Field Position Error: Rotational Misalignment.

Figure 16. Magnetic Field Position Error: Rotational Misalignment.

Figure 17 displays one last common error source, sensor-to-magnet distance. The ideal distance between the sensor and magnet is half of the magnet length. Increasing or decreasing this distance introduces errors into the measurement. Figure 17 shows the bench test setup where the magnet and sensor are too close together.

Figure 17. Photo of Bench Test Setup: In-Plane Distance Variation.

Figure 17. Photo of Bench Test Setup: In-Plane Distance Variation.

The distance between the magnet and sensor is set to 0.1 inch, 0.5 inch and 1 inch, and then data sets are collected. Figure 18 shows the errors associated with the different configurations.

Figure 18. Magnetic Field Position Error: In-Plane Distance Variation.

Figure 18. Magnetic Field Position Error: In-Plane Distance Variation.

By modifying the gain correction factor, these large errors can be improved but not removed completely. Increasing or decreasing the distance from the magnet negatively influences the magnetic field strength and orientation of the magnetic field lines making some of the data unrecoverable.


PCB Layout Considerations


In any circuit where accuracy is crucial, it is important to consider the power supply and ground return layout on the board. The PCB should isolate the digital and analog sections as much as possible. The PCB for this system was constructed in a 4-layer stack up with large area ground plane layers and power plane polygons. See the MT-031 Tutorial for more discussion on layout and grounding, and the MT-101 Tutorial for information on decoupling techniques.

Decouple the power supply to all ICs with 1 µF and 0.1 µF capacitors to properly suppress noise and reduce ripple. Place the capacitors as close to the device as possible. Ceramic capacitors are advised for all high frequency decoupling.

Power supply lines should have as large a trace width as possible to provide low impedance paths and reduce glitch effects on the supply line. Shield clocks and other fast switching digital signals from other parts of the board by digital ground.

Common Variations

Two changes are required to create a linear position measurement system from the angular position system. First, replace the AA747 sensor with the AA745. This sensor specifically senses linear movement and has identical electrical characteristics as the AA747. Second, replace the magnet with a multi-pole bar magnet consisting of a series of alternating north and south poles as shown in Figure 19.

Figure 19. Linear Position Measurement Magnet, PCB, and Sensor.

Figure 19. Linear Position Measurement Magnet, PCB, and Sensor.

The AA745 comes in a horizontal package that mounts flush against the edge of the PCB. This allows optimization of the distance between the magnet and sensor, the ideal distance being one-half the pole length of the magnet.

As the sensor moves parallel to the magnet it detects the magnetic field which rotates 180° for every pole length travelled. The pole length of the magnet (P) and the angular accuracy of the sensor (ΔØ = 0.05°) determine the theoretical accuracy (Δx).

Δx = P × ΔØ/180°

This provides an absolute measurement system for only one pole length. If the magnet has more than one pole, counting the number of poles passed provides a more accurate reading. Additional electronics are required to implement this functionality, and traditionally a second magnet with different pole length provides a reference point for an additional sensor.