MAGNETIC MICROSYSTEMS FOR POSITION MEASUREMENT Blaž Šmid University of Ljubljana, Faculty of electrical Engineering, Ljubljana, Slovenia Key words: magnetic microsystem, Hall sensor, angle measurement, linearization algorithm, distance measurement Abstract: Position measuring devices are used in numerous fields in everyday life. Automobile industry uses them for detecting the throttle position, steering wheel position, clutch position, ignition key position, etc. Home appliances like washing machines use them for measuring the rotation and axis displacement of the drum. Basically every movement in a device that determines its operation needs to be measured more or less accurately. Magnetic microsystems that measure position are a good alternative to older mechanical solutions. A magnetic microsystem usually consists only of an ASIC (application specific integrated circuit) and a permanent magnet. The setup is simple and requires no mechanical contacts or switches. The whole setup is usually relatively small and cheap. In the paper several solutions for measuring the position with magnetic microsystems are presented. The mathematical model is built for each. Some solutions are already integrated in ASICs that are used in the industry. Magnetni mikrosistemi za merjenje absolutne pozicije Kjučne besede: magnetni mikrosistem, Hall-ov senzor, merjenje kota, algoritem linearizacije, merjenje razdalje Izvleček: Naprave za merjenje pozicije se uporabljajo v vsakdanjem življenju na različnih področjih. Avtomobilska industrija jih uporablja pri določanju položaja stopalke za plin, sklopke, pri določanju kota krmila in zagonskega ključa, itd. V gospodinjskih aparatih, na primer v pralnem stroju, so merilne naprave uporabljene za merjenje obratov in gibanja bobna. V bistvu vsak premik, ki določa delovanje naprave, mora biti izmerjen bolj ali manj točno. Magnetni mikrosistemi za merjenje pozicije so lahko dobra alternativa starejšim mehanskim rešitvam. Magnetni mikrosistem ponavadi sestavljata integrirano vezje in trajni magnet. Sestav je enostaven in ne zahteva mehanskih kontaktov ali stikal. Je razmeroma majhen in poceni. V prispevku je prikazanih nekaj rešitev za merjenje pozicije z magnetnimi mikrosistemi. Za vsako rešitev je razvit matematični model in nekatere so že vgrajene v integrirana vezja in uporabljene v industriji. 1. Introduction The basic function of magnetic microsystems is to measure magnetic field. The magnetic field is generated by a permanent magnet that is located in the proximity of an integrated circuit (ASIC). That means that the microsystem consists only of an integrated circuit and permanent magnet. In some setups more magnets are used. The permanent magnets are of different shapes and sizes. Also the magnetization direction and strength varies from one type of position measuring magnetic microsystem to another. The magnet changes its position relative to the integrated circuit which means that the magnetic field strength changes at the position of the integrated circuit. The position can be measured absolutely or relatively. If the magnetic field is generated by multiple permanent magnets and is periodic over a certain span of distance, the position is measured relatively. That means that the given information from the ASIC about the distance is relative. If the magnetic field is not a periodic function and the position is measured absolutely, one value of the magnetic field strength in the position of the ASIC corresponds to only one value at the output. In practice the difference between these two cases is that when the position is measured relatively, the reference position has to be known or it may not be relevant at all. The integrated circuits embedded in the magnetic microsystems measure the magnetic field with integrated Hall element (elements). Many different approaches for integrated Hall element signal processing are published in /3/ and /4/, providing a solid basis for different algorithm implementation. Hall element senses only the perpendicular component of the magnetic field strength vector which means that only one dimension of permanent magnet movement can be measured. In some cases it is beneficial to use more Hall elements that are positioned perpendicular to each other. That way two or three components of the magnetic field strength vector are measured. This gives more information about the magnetic field. One component of the magnetic field strength can determine the position over one part of the measuring range and the other component can determine the position over the other part of the measuring range, and that can increase the measuring resolution or increase the position measuring range. Also more components of the magnetic field strength vector mean that position can be measured in two or three dimensions. In the paper three different magnetic microsystems are described: - magnetic microsystem for absolute angle measurement - magnetic microsystem for absolute distance measurement - magnetic microsystem for accurate position measurement Each of them is comprised of a permanent magnet and the ASIC. All measure one dimension of permanent magnet movement relative to the integrated circuit. The first microsystem gives information about the rotation of the permanent magnet, second about the distance between the permanent magnet and the ASIC and the third measures the position of the permanent magnet that moves parallel to the ASIC. For all three systems signal processing ASICs are designed with methodologies for mixed signal design /1/, /8/ and optimization technologies /7/. 2. Absolute angle measurement magnetic microsystem The microsystem is comprised of the permanent magnet and the ASIC (Figure 1). The permanent magnet is diametrically magnetized. The ASIC measures the perpendicular component of the magnetic field strength vector and gives the information about the absolute rotational angle of the permanent magnet above the ASIC. Fig. 1: Magnetic microsystem for absolute angle measurement 2.1 Angle measurement principle There are sixty four Hall elements integrated in the ASIC. They are positioned in a circle. The axis of the circle coincides with the rotational axis of the permanent magnet. For clearer principle presentation only eight Hall elements are shown in Figure 2. This can be easily generalized into the case with sixty four Hall elements. • H4 • H2 H6 HB • • ki t Fig. 2: Eight Hall elements placed in a circle By rotating the permanent magnet above the ASIC, the perpendicular component of the magnetic field strength to every Hall element describes a sine shaped signal. That means that eight (sixty four) sine signals are the result of one permanent magnet turn. The ASIC has two output signals. A sine signal and a cosine signal. They are a derivative of all eight (sixty four) sine signals that come directly from the Hall elements and are calculated as shown in (1) and (2). sine = 51 + 52 + 53 + 54 - 55 - 56 - 57 - 53 (1) cosine = 53 + 54 + 55 + 56 - 57 - 58 - 51 - 52 (2) The angle is calculated as shown in (3). a = arctan—--(3) The used principle is very beneficial and robust. Any external homogenous magnetic field that is added to the magnetic field generated by the permanent magnet is eliminated. This comes from (1) and (2). Also the sensitivity of Hall element is a process parameter. If the sensitivity changes from one ASIC to the other the sensitivity changes for all Hall elements on one ASIC and sine and cosine signals are amplified. According to (3) the angle remains unchanged. 2.2 Microsystem characterization The principle is implemented in the integrated circuit. Special care was paid to front end signal processing design / 2/, low noise input amplifier /5/ and to Hall element modeling /6/. The microsystem is composed of a permanent magnet sized 3-6mm x 3-6mm and diametrically magnetized and the ASIC in one of the standard packages. The distance between the magnet and the ASIC is variable from 0.5mm to 5mm. 2.2.1 Angle error The setup allows an accurate absolute angle setting. The angle is set from -21° to 21° with a step of 1°. The angle is calculated from output sine and cosine voltage. The error is then calculated as the difference between manually set angle and calculated angle from output sine and cosine voltage. Figure 3 shows the angle error in angular degrees which is approximately ±0.04 degrees. 0,04 0.03 0.02 0.01 0 t LU 0 Q> -o.or- < -0,02 -0,03 -0,04 Angle Error A K f Mt A u AN ^ I ■ Wß H It . w Set Angle ("] Fig. 3: Angle error 2.2.2 Noise The resolution of the measurement is limited by the noise. One thousand samples are measured at a randomly set angle. Figure 4 shows the noise in angular degrees. The peak to peak angle noise is 0.015 degrees, the RMS value is 0.065 degrees, and standard deviation is 0.0021 degrees. Fig. 4: Noise measurements 2.2.3 Angle depending on the temperature The angle calculated from sine and cosine voltage is measured at temperatures from -40°C to 100°C with a step of 10°C. A random angle is set. Figure 5 shows the angle depending on the temperature which is approximately 0.001 angular degrees per Kelvin. Fig. 5: Angle depending on the temperature 3. Magnetic microsystem for absolute distance measurement The main idea of accurately measuring the distance is to measure the magnetic field strength in the position of the ASIC which is caused by a permanent magnet placed close to the ASIC (Figure 6). The distance between the ASIC and the permanent magnet varies and it is limited to the maximum distance which depends on signal to noise ratio, offset and sensitivity of the ASIC. While the magnetic field strength is inversely proportional to the distance and is nonlinear with distance, the output of the ASIC should be linear. To solve the problem of nonlinearity a linearization algorithm is developed using the piecewise linear approach. Fig. 6: Magnetic microsystem for absolute distance measurement 3.1 Linearization algorithm The perpendicular (to the ASIC) component of the magnetic field strength vector is measured with Hall sensor at distances between permanent magnet and the probe varying from 22 to 12 millimeters. The correlation between magnetic field and the output voltage of the ideal Hall element is linear. For the analysis the maximum distance is selected as a reference point since the magnetic field at maximum distance is the weakest. Figure 7 shows the measured (scaled) values and the ideal linear output voltage. Fig. 7: Input (scaled) and output voltage The distance range is divided into 20 segments called linearization points. At each linearization point the gain decreases so the signal at that point becomes equal to the desired output voltage. The result is a saw-tooth shaped signal with large error. The saw-tooth shaped signal and the ideal output voltage is shown in Figure 8. Fig. 8: Saw-tooth shaped and ideal output voltage The resulting signal still has a large error. Additional smoothing procedure is implemented in the linearization algorithm. The gain between linearization points is calculated as a linear interpolation of two neighboring linearization points. Theoretically the magnetic field strength is inversely proportional to the distance (1/x). The relation between magnetic field strength and output voltage of the Hall element is linear and the gain at linearization points can be adjusted infinitely accurate. In this case the overall error after linearization is zero. In the real environment the Hall element is not linear, the data are measured and the gain cannot be accurately set because only finite gain steps are available. These factors contribute to the resulting linearized output voltage with an error. The linearized output signal error in percentage is shown in Figure 9. Fig. 9: Output error 3.2 Microsystem linearization characterization The linearization algorithm and Hall element with corresponding electronics is implemented in the integrated circuit. The distance from ASIC to permanent magnet varied from 22 to 12 millimeters. The input nonlinear voltage curve is linearized from 0.35 V to 3.5V. Also 20 linearization points are used, the same as in the mathematical linearization. Figure 10 shows the linearized output voltage and Figure 11 shows the overall error in percentage. Fig. 10: Measured linearized output voltage Fig. 11: Overall linearization error of the measured linearized output voltage 4. Magnetic microsystem for accurate position measurement The magnetic microsystem is composed of a permanent magnet and two integrated circuits. The main integrated circuit contains all the circuitry including the algorithm realization and Hall sensor. The additional integrated circuit is simpler since it contains only a Hall sensor and some elements needed by Hall sensor, such as amplifiers, etc. In Figure 12 the setup is shown. The Hall sensor of the main integrated circuit is positioned in the centre of the Cartesian coordinate system. The additional integrated circuit is positioned away from the main integrated circuit so the Hall sensor is at the point with coordinates x=0mm, y=-1mm and z=3mm. The Hall sensor in the main circuit is set horizontally, therefore it is sensitive to vertical component (By) of the vector of magnetic field density. In contrast the Hall sensor in the additional integrated circuit is set vertically and is sensitive to the horizontal component (Bx) of the vector of magnetic field density. Fig. 12: Magnetic microsystem setup In order to perform further analysis and linearization, both vertical and horizontal components are measured from x=0 millimetres to the position of x=16 millimetres. Since the measured components are symmetrical over the y axis the other half of measurements are not necessary. The measurements are presented in Figure 13. The full line presents the vertical component of magnetic field density vector and the dashed line presents the horizontal component of the magnetic field density. Fig. 13: Vertical and horizontal component measurement 4.1 Idea of electronic realization of linearization Before the algorithm is designed, some basics need to be known concerning the electronic realization. In Figure 14 the idea of electronic realization of the algorithm is presented. With properly calculated resistors, the coefficients are set and the comparators are switching linearly according to the position. The linearization is therefore discrete and there are as many steps as the number of comparators. Fig. 14: The idea of electronic realization The requirement of such realization is that the input signal on the resistor chain needs to have higher voltage values than the signal on the comparators otherwise the switching would not occur. Another requirement is that the ratio between the signal on the resistor chain and the signal on the comparators must be a rising or a falling function or in other words the derivative of the ratio must not change its sign. Therefore the signal from the vertical Hall sensor is inverted from the point where it reaches its minimum. The signals are divided into three distance regions. One distance region is from the position 0 millimetres to the position where the two signals meet. Second region is from the end of the first region to the point where the lower signal reaches its minimum. The third region is from the end of the second region to the 16 millimetres. Figure 15 shows the two signals prepared for the linearization algorithm. Position I Fig. 15: Signals divided into three regions 4.2 Linearization results of mathematical model The two signals are divided into three distance regions that are further divided into more segments. 45 segments are selected for all three distance regions together. At every segment the output changes it value for one step. The ratios of two signals are calculated at segments and also the resistor values are calculated which are later used in electronic realization. If the ratios are calculated correctly, the output is changing its value linearly versus the position of the magnet. Figure 16 shows the results. A step function is the output of the algorithm and the linear function is a linear interpolation of the output function so the linearity of the output is more evident. The y axis shows the output level number and as the figure shows there are 45 steps for a range of 16 millimetres. 4.3 Electronic realization of the algorithm and simulation results According to the idea of the electronic realization and resistors values calculated mathematically, an electronic realization of the algorithm is designed. Three separate resistor chains with comparators are Fig. 16: The output of the mathematical algorithm formed. First block has 5 comparators, thus it covers 5 steps of the first of three segments of a whole position range. Second block has 17 comparator and the third block has 23 comparators, all together 45 comparators. On each out of 45 segments one comparator changes its state from 0 to 5 volts (the supply voltage) and enables the transistor switch. The transistor then adds current to the output resistor and the voltage on the resistor rises. Figure 17 shows the first block with resistor chain, comparators, etc. There is some additional logic added so the first block functions only in the first segment. That is from the 0 millimetre to the position where the signals meet. The outputs are then connected to the cell with transistor switches which add the current to the output resistor. Fig. 17: First linearization block The other two blocks used for second and third segment are similar to the first block. All three blocks together cover only half of the position span, that is 0 millimetre to 16 millimetre. The goal is to cover 32 millimetre span, from -16 millimetres to 16 millimetres according to Fig. 12. Since the hor- izontal component of the magnetic field strength is symmetrical and vertical component is inversely symmetrical, only the vertical component has to be inverted for the other half of the position span. Also the output is inverted in the other half of the position. Simulation results are shown in Figure 18. The upper part of the Figure shows two inputs and the bottom part shows the output of the algorithm. tion. Some of the characterization results are presented in the paper. 6. References /1/ TRONTELJ, Janez. Trends in mixed signal ASIC design. Inf. MIDEM, vol. 24, št. 4(72), str. 221-226, 1994 /2/ TRONTELJ, Janez. Integrated Hall sensor array electronics. Inf. MIDEM, let. 28, št. 2(86), str. 95-101, 1998 /3/ TRONTELJ, Janez. Smart integrated magnetic sensor cell. Inf. MIDEM, let. 29, št. 3, str. 126-128, 1999 /4/ TRONTELJ, Janez. Integrated magnetic sensors design examples. Inf. MIDEM, let. 29, št. 4, str. 190-194, 1999 /5/ TRONTELJ, Janez, SEŠEK, Aleksander. Ultra low noise PAGC amplifier for microsystem sensor signal processing. Inf. MIDEM, letn. 35, št. 1, str. 8-12, 2005 /6/ SEŠEK, Aleksander, TRONTELJ, Janez. A new model for six terminal Hall element. Inf. MIDEM, letn. 37, št. 2, str. 61-66, 2007 /7/ TRONTELJ, Janez. Optimization of integrated magnetic sensor by mixed signal processing. Proceedings of the 16th IEEE Instrumentation and Measurement Technology Conference, Venice, Italy, vol. 1, str. 299-302, 1999 /8/ TRONTELJ, Janez, TRONTELJ, Lojze, SHENTON, Graham. Analog digital ASIC design. London [etc.]: McGraw-Hill Book Company, XVI, 249 str., 1989 Fig. 18: Simulation resuits 5. Conclusion Three different magnetic microsystems are presented in the paper. One is for absolute angle measurement, second for absolute distance measurement and the third for absolute position measurement. All of them are verified with mathematical analysis; the ASICs for all three are designed and verified with accurate simulations tools. Two of them are realized, fully characterized and released to produc- Blaž Šmid, univ. dipl. ing. el. Univerza v Ljubljani, Fakulteta za elektrotehniko Tržaška 25, SI-1000 Ljubljana E-mail: blaz.smid@fe.uni-lj.si Telefon: (01) 4768 - 340 Prispelo (Arrived): 09.12.2009 Sprejeto (Accepted): 09.03.2010