Magnetoresistive Linear Position Measurement
Manufactured by:

Circuit Function & 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.

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.

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

Circuit Description

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 2VREF (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.

For the theory of MR sensors, please refer to the CN0341 PDF.

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

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

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

The EVAL-CN0341-SDPZ PCB is tested by mounting a magnet to the arm of a digital caliper. The EVAL-CN0341-SDPZ PCB 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 Setupre 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

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

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 13. Photo of Bench Test Setup: Vertical Misalignment

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 14. Magnetic Field Position Error: 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 15. Photo of Bench Test Setup: Rotational 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 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 Misalign

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

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

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.

A screen shot of the LabVIEW® evaluation software used for all readings and calculations is shown in Figure 19.

Figure 19. Screenshot of the CN-0341 Evaluation Software

The calibration tab determines the maximum and minimum voltage (VMAX and VMIN) output of each Wheatstone bridge. Knowing these values allows a more precise mapping of voltage to digital code. The user can manually enter the values to minimize calculation errors.

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. Figure 20 is a photo of the PCB.

A complete design support package for this circuit note is at

Figure 20. Photo of the EVAL-CN0341-SDPZ PCB

Common Variations

Two changes are required to create a linear position measurement system from the angular position system described in the CN-0323 Circuit Note. 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 21.

Figure 21. 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

Circuit Evaluation And Test

This circuit uses the EVAL-SDP-CB1Z System Demonstration Platform (SDP) evaluation board and the EVAL-CN0341-SDPZ circuit board. The two boards have 120-pin mating connectors, allowing for the quick setup and evaluation of the performance of the circuit.

The EVAL-CN0341-SDPZ contains the circuit to be evaluated, as described in this note. The EVAL-SDP-CB1Z is used with the CN-0341 evaluation software to capture the data from the EVAL-CN0341-SDPZ evaluation board.

Equipment Needed

PC with a USB port and Windows® XP or Windows Vista® (32-bit), or Windows® 7 (32-bit)
EVAL-CN0341-SDPZ evaluation board
EVAL-SDP-CB1Z evaluation board
6 V power supply or wall wart
CN-0341 evaluation software
Neodymium magnet with a minimum magnetic field strength of 25 kA/m at the package of the sensor.

Getting Started

Load the evaluation software by placing the CN-0341 evaluation software CD into the PC. Using My Computer, locate the drive that contains the evaluation software CD and open the Readme file. Follow the instructions contained in the Readme file for installing and using the evaluation software.

Functional Block Diagram

Figure 22 shows the functional block diagram of the test setup.

Figure 22. Test Setup Block Diagram


Connect the 120-pin connector on the EVAL-CN0341-SDPZ to the connector on the EVAL-SDP-CB1Z. Use nylon hardware to firmly secure the two boards, using the holes provided at the ends of the 120-pin connectors.

With power to the supply off, connect a 6.0 V DC barrel jack to connector J4. Connect the USB cable supplied with the EVAL-SDP-CB1Z to the USB port on the PC. Note: Do not connect the USB cable to the mini-USB connector on the SDP board at this time.

Place the neodymium magnet directly on top of the IC or in some fixture designed to spin the magnet, which minimizes the distance between the IC and magnet itself.

It is important to keep other sources of magnetic fields away from the IC as any stray magnetic field can cause errors in the output voltage of the sensor.


Apply power to the DC barrel jack, connector J4. Launch the CN-0341 evaluation software and connect the USB cable from the PC to the mini-USB connector on the EVAL-SDP-CB1Z.

Once USB communications are established, the EVAL-SDP-CB1Z can now be used to send, receive, and capture serial data from the EVAL-CN0341-SDPZ.

Information regarding the EVAL-SDP-CB1Z can be found in the SDP User Guide.

Information and details regarding test setup and calibration, and how to use the evaluation software for data capture can be found in the CN-0341 Software User Guide at:

Sample Products





Available Product
Models to Sample

AD7866 Dual 1MSPS, 12-Bit, 2-Channel SAR ADC with Serial Interface



AD8227 Wide Supply Range, Rail-to-Rail Output Instrumentation Amplifier



AD8615 Precision 20 MHz CMOS Single RRIO Operational Amplifier


Evaluation Boards Pricing displayed is based on 1-piece.
Pricing displayed is based on 1-piece. The USA list pricing shown is for budgetary use only, shown in United States dollars (FOB USA per unit), and is subject to change. International prices may vary due to local duties, taxes, fees and exchange rates.