Circuit Note CN-0341 Devices Connected/Referenced Circuits from the Lab® reference designs are engineered and tested for quick and easy system integration to help solve today’s analog, mixed-signal, and RF design challenges. For more information and/or support, visit www.analog.com/CN0341. AD7866 Dual Channel, 1MSPS, 12-bit, Simultaneous Sampling SAR ADC AD8227 Wide Supply Range, Rail-to-Rail, Instrumentation Amplifier AD8615 Low Offset, Low Noise, Precision Amplifier Magnetoresistive Linear Position Measurement 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. EVALUATION AND DESIGN SUPPORT Circuit Evaluation Boards CN-0341 Circuit Evaluation Board (EVAL-CN0341-SDPZ) System Demonstration Platform (EVAL-SDP-CB1Z) Design and Integration Files Schematics, Layout Files, Bill of Materials 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 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. 5V 0.1µF 5V 5V REF 0.1µF 10µF 2.96kΩ 10µF 2.5V 3.3V 5V DVDD AVDD REFSEL RANGE AD8227 AD8615 VDRIVE VA1 VCC SCLK +VO1 AA745 5V –VO1 +VO2 –VO2 GND1 SDP 2.5V REF 2.96kΩ AD7866 AD8227 DOUTA 5V AD8615 CS VB1 DGND AGND DCAP A 470nF DCAP B 470nF VREF 5V 100nF 2.5V 12115-001 AD8615 Figure 1. Magnetoresistive Linear Position Measurement System (Simplified Schematic: Decoupling and All Connections Not Shown) Rev. 0 Circuits from the Lab® reference designs from Analog Devices have been designed and built by Analog Devices engineers. Standard engineering practices have been employed in the design and construction of each circuit, and their function and performance have been tested and verified in a lab environment at room temperature. However, you are solely responsible for testing the circuit and determining its suitability and applicability for your use and application. Accordingly, in no event shall Analog Devices be liable for direct, indirect, special, incidental, consequential or punitive damages due toanycausewhatsoeverconnectedtotheuseofanyCircuitsfromtheLabcircuits. (Continuedonlastpage) One Technology Way, P.O. Box 9106, Norwood, MA 02062-9106, U.S.A. Tel: 781.329.4700 www.analog.com Fax: 781.461.3113 ©2014 Analog Devices, Inc. All rights reserved. CN-0341 Circuit Note 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 inamp 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 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. 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). 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 magnetorestriction. 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. 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. M Ø HY I R R0 + ΔR R0 12115-003 CIRCUIT DESCRIPTION HY –1.0 –0.5 0 0.5 1.0 H0 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°. ALUMINUM STRIPES 12115-002 I M Figure 2. Anisotropic Magnetoresistive Example HX HY = 0 Figure 4. Barber Pole Effect in a Permalloy Strip Rev. 0 | Page 2 of 8 12115-004 HX HY Circuit Note CN-0341 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. R R0 + ΔR 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. 2.57 OUTPUT VOLTAGE (V) 2.55 –1.0 –0.5 0 0.5 H0 1.0 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. L 12115-006 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Ω. VCC1 GND1 +VO1 –VO2 VCC2 GND2 +VO2 COS (2Ø) SIN (2Ø) 2.49 2.47 2.45 2.43 0 45 90 ANGLE (°) 135 180 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. 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. 12115-007 –VO1 2.51 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. d SENSOR 2.53 12115-008 HY 12115-005 R0 Figure 7. AA745 Dual Wheatstone Bridge Configuration Rev. 0 | Page 3 of 8 CN-0341 Circuit Note 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. CALIPER 1.0005in 0.0010 MAGNET +6V 0.0005 12115-009 EVALSDP-CB1Z Figure 9. Data Collection Test Setup 0 –0.0005 –0.0010 –0.0015 –0.2 –0.1 0 0.1 DISTANCE TRAVELLED (Inches) 0.2 12115-012 USB ERROR (Inches) SENSOR EVAL-CN0341-SDPZ Figure 12. Magnetic Field Position Error: 0.4 Inch Range, Data Shown for Four Boards 12115-010 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 10. Photo of Bench Test Setup 12115-013 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. 0.002 Figure 13. Photo of Bench Test Setup: Vertical Misalignment 0.001 –0.001 –0.002 –0.003 –0.004 –0.005 –0.5 –0.4 –0.3 –0.2 –0.1 0 0.1 0.2 DISTANCE TRAVELLED (Inches) 0.3 12115-011 ERROR (Inches) 0 Figure 11. Magnetic Field Position Error: 1.0 Inch Range, Data Shown for Four Boards Rev. 0 | Page 4 of 8 Circuit Note CN-0341 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. 0.020 ERROR (Inches) 0.015 0.035 0.030 0 0.020 –0.010 –0.5 –0.4 –0.3 –0.2 –0.1 0 0.1 0.2 0.3 0.4 0.5 DISTANCE TRAVELLED (Inches) 12115-016 ERROR (Inches) 0.005 –0.005 0.25” DOWN 0.25” UP 0.5” DOWN 0.5” UP 0” 0.025 Figure 16. Magnetic Field Position Error: Rotational Misalignment 0.015 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. 0.010 0.005 –0.4 –0.3 –0.2 –0.1 0 0.1 0.2 0.3 0.4 0.5 DISTANCE TRAVELLED (INCHES) 12115-014 0 –0.005 –0.5 RIGHT STRAIGHT LEFT 0.010 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. 12115-017 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 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. 0.020 0.1” 1” 0.5” ERROR (Inches) 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. Rev. 0 | Page 5 of 8 0.010 0.005 0 –0.005 –0.010 –0.5 –0.4 –0.3 –0.2 –0.1 0 0.1 0.2 0.3 0.4 0.5 DISTANCE TRAVELLED (Inches) Figure 18. Magnetic Field Position Error: In-Plane Distance Variation 12115-018 12115-015 0.015 CN-0341 Circuit Note 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. 12115-020 A screen shot of the LabVIEW® evaluation software used for all readings and calculations is shown in Figure 19. Figure 20. Photo of the EVAL-CN0341-SDPZ PCB 12115-019 COMMON VARIATIONS 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. 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. PCB 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. D= SENSOR 1 POLE LENGTH 2 P P = POLE LENGTH 12115-021 D 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° A complete design support package for this circuit note is at www.analog.com/CN0341-DesignSupport. Rev. 0 | Page 6 of 8 Circuit Note CN-0341 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. Setup 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 EVALSDP-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. Equipment Needed Test The following equipment is needed: 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. • 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. 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. 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. 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: www.analog.com/CN0341UserGuide . Functional Block Diagram Figure 22 shows the functional block diagram of the test setup. 6V POWER SUPPLY PC J4 EVAL-SDP-CB1Z J1 120-PIN CONNECTOR 12115-022 EVAL-CN0341-SDPZ Figure 22. Test Setup Block Diagram Rev. 0 | Page 7 of 8 CN-0341 Circuit Note LEARN MORE Data Sheets and Evaluation Boards CN-0341 Design Support Package: http://www.analog.com/CN0341-DesignSupport CN-0341 Circuit Evaluation Board (EVAL-CN0341-SDPZ) System Demonstration Platform (EVAL-SDP-CB1Z) MT-031 Tutorial, Grounding Data Converters and Solving the Mystery of “AGND” and “DGND”, Analog Devices. AD7866 Data Sheet AD8227 Data Sheet MT-101 Tutorial, Decoupling Techniques, Analog Devices. AD8615 Data Sheet AN-688 Application Note, Phase and Frequency Response of iMEMS Accelerometers and Gyros, Analog Devices REVISION HISTORY AA700 Application Note, AMR Freepitch Sensors for Angle and Length Measurement, Sensitec 1/14—Rev. 0: Initial Version (Continued from first page) Circuits from the Lab reference designs are intended only for use with Analog Devices products and are the intellectual property of Analog Devices or its licensors. While you may use the Circuits from the Lab reference designs in the design of your product, no other license is granted by implication or otherwise under any patents or other intellectual property by application or use of the Circuits from the Lab reference designs. Information furnished by Analog Devices is believed to be accurate and reliable. However, Circuits from the Lab reference designs are supplied "as is" and without warranties of any kind, express, implied, or statutory including, but not limited to, any implied warranty of merchantability, noninfringement or fitness for a particular purpose and no responsibility is assumed by Analog Devices for their use, nor for any infringements of patents or other rights of third parties that may result from their use. Analog Devices reserves the right to change any Circuits from the Lab reference designs at any time without notice but is under no obligation to do so. ©2014 Analog Devices, Inc. All rights reserved. Trademarks and registered trademarks are the property of their respective owners. CN12115-0-1/14(0) Rev. 0 | Page 8 of 8