Application Note DN[Document ID] AS5510 Extending the useful measurement range ams Application Note [v1-02] 2014-Aug-19 Page 1 Document Feedback AS5510 Extending the useful measurement range Content Guide 1 Overview..........................................................................................................................3 2 Using the AS5510 as a Position Sensor ...........................................................................3 3 Designing a system ..........................................................................................................4 4 Choosing a magnet ..........................................................................................................4 5 Example with Single AS5510............................................................................................4 6 Calibration........................................................................................................................7 7 Determining Absolute Position from Two AS5510 .............................................................8 8 Conclusion .......................................................................................................................9 9 Programming Example ................................................................................................... 10 10 Schematic and PCB Details ........................................................................................... 11 11 Contact Information ........................................................................................................ 12 12 Copyrights & Disclaimer ................................................................................................. 13 13 Revision Information ...................................................................................................... 13 ams Application Note [v1-02] 2014-Aug-19 Page 2 Document Feedback AS5510 Extending the useful measurement range 1 Overview The AS5510 is a Hall Effect sensor with a single Hall element in a 1.1 x 1.8 mm chip scale package. It contains an integrated 10 bit ADC and uses I2C communication. In combination with a small magnet the AS5510 can be used as a linear position sensor with a travel range of any arbitrary length. However, longer travel ranges necessarily require longer magnets and larger gaps with the result that system volume increases much more rapidly than useful range. As an example, a sensor with 0.5mm linear range can occupy less than 4 mm 3 while a system with 3.0 mm range can require more than 125 mm3. This application note describes how to use multiple AS5510 with a single magnet to create more compact systems than would be possible with a single sensor. Specifically, we detail a system using two AS5510 providing 3 mm linear range and occupying only 42 mm 3. 2 Using the AS5510 as a Position Sensor The Hall Effect element in the AS5510 is only sensitive to magnetic fields that are perpendicular to the mounting surface of the device; the z axis. The field at the sensor can be in any direction, but only the z component will be measured. When queried, the AS5510 will return a 10 bit integer in the range 0 to 1023 that is proportional to the z component of the field at its current location. Figure 1 shows an example of the reported value over a range of positions. The important thing to notice is that there is a region in the center where the curve is nearly a straight line; the position of the magnet relative to the sensor is linearly proportional to the field as reported by the sensor. We will assume linearity when calculating position from the numbers reported by the AS5510. Figure 1: The values reported by the AS5510 when scanned near a 4 mm long magnet. 10 Bit Value Reported by AS5510 Raw Value Returned From AS5510 1024 768 512 256 0 -3 -2 -1 0 1 2 3 Position Relative to Magnet (mm) ams Application Note [v1-02] 2014-Aug-19 Page 3 Document Feedback AS5510 Extending the useful measurement range 3 Designing a system Designing a position sensor system around the AS5510 involves establishing three requirements: 1. Total range of motion over which good linearity is required 2. Required resolution. That is the smallest increment of position that must be detected. 3. Geometric constraints – how much space is available for the entire sensor? Once the requirements are established magnet material, size, shape and gap can be chosen. 4 Choosing a magnet The following "rules of thumb" can be used as a first determination of magnet dimensions when sintered NdFeB is used. Other magnet materials generally require larger magnets. 1. The length of the magnet should be 2.5 to 3 times the required travel range. Longer magnets can provide greater linearity over the important range, however they also need to be correspondingly stronger (thicker) and will necessitate a larger gap. This increases the overall space requirements. 2. Thickness from 20% to 50% of the length. 3. The gap from the magnet to the internal Hall sensor will be 1 to 2 times the magnet thickness. Subtract the thickness of the AS5510 package (0.36 mm) to estimate the gap from magnet to the top of the AS5510. 4. Width should be at least as great as the thickness. In cases where long range, high resolution, and small size are all required, experimentation will be necessary. FEA calculations can reduce the window of uncertainty, but manufacturing tolerances in magnet material and system geometry might still require some prototyping to achieve the desired goal. 5 Example with Single AS5510 As an example we will design a sensor with the following requirements: 1. Travel range: 1.5 mm 2. Resolution: < 5.0 um per encoder count 3. Volume: Must fit within 8mm x 5mm x 2mm volume From this we can estimate magnet dimensions: 1. Length: 3.75 mm to 4.5 mm 2. Thickness: 0.75 mm to 2.25 mm 3. Gap: 0.15 mm to 3.9 mm from magnet to top of AS5510 4. Width: 0.75 mm to 2.25 mm (or greater) A search of commercially available NdFeB shows that the AS5000-MA4x2H-1 is a possible candidate. This magnet is 4 mm long, 1 mm thick, and 2 mm wide. This is the longest and widest ams Application Note [v1-02] 2014-Aug-19 Page 4 Document Feedback AS5510 Extending the useful measurement range magnet that will fit the space requirements. The 5 mm height limitation leaves room for up to 3.4 mm gap with 1 mm thick magnet and 0.60 mm thick AS5510. A test setup was constructed that moves an AS5510 sensor linearly under an AS5000-MA4x2H-1 magnet. Figure 2 shows the experimental setup and figure 3 shows a close view of just the PCB and magnet. The raw 10 bit value reported by the AS5510 is shown in figure 4. This data was obtained with the sensor sensitivity set to ±50 mT. Figure 2: The test setup used to collect data Figure 3: A close view of the PCB and magnet used. ams Application Note [v1-02] 2014-Aug-19 Page 5 Document Feedback AS5510 Extending the useful measurement range Figure 4: Scan of a 4x1x2 mm Magnet Scan of 4 x 1 x 2 mm Magnet (AS5000-MA4x2H-1) 1024 Value Returned From AS5510 896 768 640 0.25 mm gap 0.50 mm gap 512 0.75 mm gap 384 1.00 mm gap 256 1.25 mm gap 128 0 -2 -1,5 -1 -0,5 0 0,5 1 1,5 2 Position (mm) Also shown in figure 4 are least-square linear fits to the center 1.5 mm of each curve. The straight line represents the position that would be calculated from AS5510 readings. Calculation error is seen as the horizontal distance between the curve and straight line. It is apparent by inspection that small gaps will result in larger errors. The resolution at each gap can be calculated as Δposition / ΔAS5510 reading. Figure 5: Δposition / ΔAS5510 reading Gap (mm) Change in Position (mm) Change in ADC Value (counts) Resolution (um / count) 0.25 1.5 756 – 148 = 608 2.5 0.50 1.5 712 – 210 = 502 3.0 0.75 1.5 667 – 270 = 397 3.8 1.00 1.5 636 – 318 = 318 4.7 1.25 1.5 621 – 340 = 281 5.3 1.0 mm and 1.25 mm gaps both use less than half of the available dynamic range of 1024 counts. In this application a good solution will be to use 1.00 mm gap and increase the sensitivity of the AS5510s from ±50 mT to ±25 mT. This will double the fraction of available dynamic range used and consequently improve resolution by a factor of 2. Figure 6 shows data acquired by two AS5510 spaced 1.5 mm apart with gaps of 1.00 mm. ams Application Note [v1-02] 2014-Aug-19 Page 6 Document Feedback AS5510 Extending the useful measurement range Figure 6: Data of 2 AS5510 spaced 1.5mm to each other at 1mm airgap Two Sensors 1.5 mm apart, 1.00 mm gap 1024 Bmax Amax AS5510 Output 768 512 A B 256 Bmin Amin 0 -2,00 -1,50 -1,00 -0,50 0,00 0,50 1,00 1,50 2,00 Measured Position (mm) Sensor A will be used between -1.5 and 0 mm while sensor B will be used between 0 and +1.5 mm. Notice that each takes a maximum and minimum value within its respective region. Each saturates outside of its valid region, but that is not important. 6 Calibration The values returned by the AS5510s are dimensionless. Converting those values to physical units (i.e. um) requires calibration. Recall that position will be calculated from AS5510 readings. To this end, the data in figure 4 is plotted in figure 7 with sensor readings as the independent variable. Advantage has been taken of a spreadsheet application to calculate the slope and intercept of each line by least squares fit. ams Application Note [v1-02] 2014-Aug-19 Page 7 Document Feedback AS5510 Extending the useful measurement range Figure 7: Position as a function of sensor reading Position as a Function of Sensor Reading 2,0 1,5 Position = -0.00233B + 1.9617 Measured Position (mm) 1,0 0,5 0,0 A B -0,5 -1,0 Position = -0.00235A + 0.4284 -1,5 -2,0 0 256 512 768 1024 Reported by AS5510 In the formulas written on the graph, the first term (the slope) is a conversion coefficient that we will use to calculate position from the raw numbers reported by the AS5510's, the second term (the y intercept) puts the 0 position in the center of travel. Other values can be substituted to put the "home" position anywhere desired. Here we have used a table of data and linear regression to calculate the equation for the line. In fact, we could have found any two points on the line (preferably far apart) and calculated the slope as ΔPosition/ΔAS5510 reading. The simpler method might be more practical when calibrating sensor systems that are not on a lab bench but integrated into a larger system, perhaps on an assembly line. 7 Determining Absolute Position from Two AS5510 A problem remains: which of the two sensor readings should be used at any given position? The solution involves examining both. Refer to figure 6 where the two sensors readings are labeled A and B. Notice that A is valid between -1.5 and 0 mm while B is valid between 0 and +1.5 mm. In their respective regions the numbers reported by each AS5510 is bounded by a minimum and maximum value. It is necessary only to read both sensors and determine which is within its valid bounds. With the coefficients above (slope and y-intercept) available, we can use the 10 bit values reported by both AS5510 to calculate position. Figure 8 shows calculated position and error as a function of ams Application Note [v1-02] 2014-Aug-19 Page 8 Document Feedback AS5510 Extending the useful measurement range measured position. The error is calculated as the difference between measured and calculated position. No more than 20 um error over 1.5 mm travel is found in this case. Figure 8: Calculated Position and Error 2,0 20 1,5 15 1,0 10 0,5 5 0,0 0 -0,5 -5 -1,0 -10 -1,5 -15 -2,0 -20 -2,0 -1,5 -1,0 -0,5 0,0 0,5 1,0 1,5 Error (um) Calculated Position (mm) Calculated Position and Error Position Error 2,0 Measured Position (mm) 8 Conclusion A sensor system was designed using two AS5510 and one magnet. The initial specification and final results are shown in figure 9. Figure 9: Specification and result Specification Result Travel Range (mm) 1.5 1.5 Resolution (um / encoder count) < 5.0 < 2.4 Space 8x5x2 8 x 2.6 x 2 Accuracy ams Application Note [v1-02] 2014-Aug-19 < 20 um Page 9 Document Feedback AS5510 Extending the useful measurement range 9 Programming Example The following example in the C programming language is an example of how to calculate absolute position from the two sensor readings. float Get_Position(float SlopeA, float SlopeB, float OffsetA, float OffsetB, int Amin, int Amax, int Bmin, int Bmax) { unsigned char I2C_AdrA = 0x56, I2C_AdrB = 0x57; // the I2C addresses unsigned char Data_LSB, Data_MSB; unsigned int ValueA, ValueB; // 10-bit output value (0~1023) float Position; // Query both sensors Data_LSB = I2C_Read8(I2C_AdrA, 0x00); // Read D7..0 Data_MSB = I2C_Read8(I2C_AdrA, 0x01); // Read D9..8 + OCF + Parity ValueA = ((Data_MSB & 0x03)<<8) + Data_LSB; if ( (Data_MSB & 0x08) == 0 ) ValueA = 1025; // Offset Compensation not complete // Outside the valid range AS5510 Data_LSB = I2C_Read8(I2C_AdrB, 0x00); // Read D7..0 Data_MSB = I2C_Read8(I2C_AdrB, 0x01); // Read D9..8 + OCF + Parity ValueB = ((Data_MSB & 0x03)<<8) + Data_LSB; if ( (Data_MSB & 0x08) == 0 ) ValueB = 1025; // Offset Compensation not complete // Outside the valid range AS5510 // determine which sensor to use and calculate absolute position if (ValueA >= Amin && ValueA <= Amax) { Position = SlopeA * ValueA + OffsetA; } else if (ValueB >= Bmin && ValueB <= Bmax) { Position = SlopeB * ValueB + OffsetB; } else { error_message("encoder error"); Position = -100; } return (Position); } ams Application Note [v1-02] 2014-Aug-19 Page 10 Document Feedback AS5510 Extending the useful measurement range 10 Schematic and PCB Details Figure 10: Schematic of the PCB used to acquire all data in this document. AS5510 B1 B2 B3 SDA VDD SCL ADR TST VSS U1 AS5510 A3 B1 A2 B2 A1 B3 SDA VDD SCL ADR TST VSS A3 A2 A1 U2 J6 C0 C1 C2 10uF 0.1uF 0.1uF SCL SDA GND VCC 4 3 2 1 Header 4 Figure 11: The PCB. Top layer copper is red while bottom layer copper is blue. Extra traces on the top layer were added for alignment purposes. Figure 12: Close-up view of the region of the PCB containing U1, U2, C1, and C2 ams Application Note [v1-02] 2014-Aug-19 Page 11 Document Feedback AS5510 Extending the useful measurement range 11 Contact Information Buy our products or get free samples online at: www.ams.com/ICdirect Technical Support is available at: www.ams.com/Technical-Support Provide feedback about this document at: www.ams.com/Document-Feedback For further information and requests, e-mail us at: [email protected] For sales offices, distributors and representatives, please visit: www.ams.com/contact Headquarters ams AG Tobelbaderstrasse 30 8141 Unterpremstaetten Austria, Europe Tel: +43 (0) 3136 500 0 Website: www.ams.com ams Application Note [v1-02] 2014-Aug-19 Page 12 Document Feedback AS5510 Extending the useful measurement range 12 Copyrights & Disclaimer Copyright ams AG, Tobelbader Strasse 30, 8141 Unterpremstaetten, Austria-Europe. Trademarks Registered. All rights reserved. The material herein may not be reproduced, adapted, merged, translated, stored, or used without the prior written consent of the copyright owner. Information in this document is believed to be accurate and reliable. However, ams AG does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information and shall have no liability for the consequences of use of such information. Applications that are described herein are for illustrative purposes only. ams AG makes no representation or warranty that such applications will be appropriate for the specified use without further testing or modification. ams AG takes no responsibility for the design, operation and testing of the applications and end-products as well as assistance with the applications or end-product designs when using ams AG products. ams AG is not liable for the suitability and fit of ams AG products in applications and end-products planned. ams AG shall not be liable to recipient or any third party for any damages, including but not limited to personal injury, property damage, loss of profits, loss of use, interruption of business or indirect, special, incidental or consequential damages, of any kind, in connection with or arising out of the furnishing, performance or use of the technical data or applications described herein. No obligation or liability to recipient or any third party shall arise or flow out of ams AG rendering of technical or other services. ams AG reserves the right to change information in this document at any time and without notice. 13 Revision Information Revision History Revision Date Owner Description 1.0 15.07.2014 D. Cigna Initial Revision 1.01 12.08.2014 D. Cigna Added images for PCB and magnet 1.02 19.08.2014 A. Zenz Updated to new template ams Application Note [v1-02] 2014-Aug-19 Page 13 Document Feedback