Technical Article

Slide-By Linear Position Sensing Using Angle Sensor ICs

September 22, 2016 by Alex Latham

This article discuss the advantages of using magnetic field angle sensor ICs over traditional single-axis sensor in terms of cost, reliability and accuracy.

There are many applications, especially in automotive systems, where it is required to measure the horizontal motion of an object with high accuracy and good reliability. Some common solutions are based on potentiometers, LVDTs (linear voltage differential transformers), and magnets with a magnetic field sensor. Potentiometer based solutions are prone to mechanical wear-out, LVDTs are large and expensive, and magnet plus sensor solutions are often low accuracy.

However, by using magnetic field angle sensor ICs instead of the traditional single-axis sensor, the major error sources associated with magnet plus sensor solutions are nearly eliminated, resulting in a low-cost, high-reliability, and high-accuracy method for linear slide-by position sensing. 
Magnet plus magnetic sensor solutions are very basic in construction. A bar magnet is attached to the moving object, and the sensor IC is positioned such that the magnet slides by it. The fields seen by the sensor IC are shown in Figure1a. As the magnet slides by in the x-direction, the field in the y-direction, which is what is typically sensed, looks like a sine wave with the magnetic-field/position relationship being linear around x = 0, the centre of the magnet. In this region, the output of the sensor gives the user a linear output relative to position.


Magnetic field plotted against position of a bar magnet for multiple air gaps. Magnet length is drawn to scale in all plots
Figure 1a: Magnetic field plotted against the position of a bar magnet for multiple air gaps. Magnet length is drawn to scale in all plots
Magnetic field angle plotted against position of a bar magnet for multiple air gaps
Figure 1b: Magnetic field angle plotted against the position of a bar magnet for multiple air gaps.


There are a few challenges to this approach, including:

  1. Air-gap changes between the sensor and the magnet can cause measurement errors, which is an issue for both installation and variation over product life.
  2. The magnet strength changes over temperature, which can cause measurement errors if it is not compensated for. While one can include a temperature sensor on the magnetic sensor IC to do this compensation, the magnet and the sensor IC may not always be at the same temperature.
  3. The range of measurement over which the magnetic field is linear with position is limited to around 50% of the magnet length, resulting in the need for magnets which are significantly longer than the distance being measured.

All three of these issues are addressed by measuring the angle of the magnetic field versus its position as follows:

  1. The field angle versus position is nearly identical with respect to the air gap over a typical tolerance, as seen in Figure 1b and Figure 2. 
  2. The field angle is independent of the field strength.
  3. The field-angle versus position curve is linear over most of the magnet length, and with piecewise-linearisation, stroke lengths of 150% or more of the magnet length can be sensed. Fig.2 shows the error/position relationship over air gap, after applying piecewise-linearisation at the nominal air gap, for both the case where By (the magnetic field in the y-direction) is measured (traditional approach) and the case where the magnetic field angle is measured. With the By method, only 10 mm of stroke with ±0.5 mm of accuracy (for a ±0.5 mm air-gap tolerance) can be sensed for the 16 mm magnet shown. However, with the angle method, more than 30 mm of stroke with ±0.5 mm of accuracy can be sensed for the same physical configuration, essentially tripling the linear sensing range.

Fundamentally, the angle method of linear position sensing offers much higher accuracy over air-gap and temperature than the traditional single-axis sensing approach, with the only constraint being that one needs a high-accuracy magnetic angle sensor IC instead of a single-axis sensor. 


Error plotted against position for By field and angle sensing after linearisation at nominal air gap
Figure 2: Error plotted against position for By field and angle sensing after linearisation at nominal air gap


An ideal sensor for this application is the automotive-grade Allegro A1335 magnetic angle sensor IC, based on CVH (Circular Vertical Hall) technology. Beyond providing high-accuracy angle measurement, it includes advanced features such as:

  • Piecewise linearisation of the angle measurement: This allows compensation for the nonlinearity of the angle/position curve near the ends of the magnets, extending the linear sensing region beyond the edges of the magnet. This also allows for adjustment of the slope of the angle-output/position curve to any desired value.
  • Addressable SENT/SPI/I2C outputs: This allows for multiple ICs in an array to be on the same bus.
  • Angle output clamps and low field detection: These features are useful for systems using multiple ICs, as they can be used to recognise which sensor ICs are out of range and which should be used for determining the position.

Basic system configuration

The A1335 is available in a TSSOP-14 package (or dual-die TSSOP-24 for systems needing redundancy) and measures the angle of the magnetic field in the plane of the package. This means that for linear position sensing the IC needs to be oriented perpendicular to the magnet motion, as shown in Figure 3. This is simply done by placing the sensor at the edge of a PCB and having the magnet slide by the side of the PCB. The effective air gap is the distance from the centre of the magnetic sensing array, the CVH, to the edge of the magnet.


System configuration using A1335 angle sensor IC
Figure 3: System configuration using A1335 angle sensor IC


Magnetic system for linear sensing

The appropriate magnet size and nominal air gap must be chosen for the stroke length being measured to create a system with the desired accuracy. This involves the system being designed so that:

  1. The magnetic angle is generally linear with position.
  2. The magnetic angle is constant enough versus the air-gap tolerance of the system.
  3. The magnetic field strength is above the minimum needed for CVH based sensor ICs, which is around 300 Gauss.

Each variable in the magnetic system has a specific impact on the accuracy, allowing many degrees of freedom to improve performance or reduce cost. These include:

  • Magnet Length (L): As a rule of thumb, the magnet length should be at least 60% of the stroke length (LS), meaning a stroke of 20 mm requires a 12 mm magnet. The linearity and accuracy over air-gap tolerance degrade further past the edge of the magnet so, in general, the longer the magnet is, the lower the error will be for a given stroke length.
  • Nominal air gap (d): The air gap needs to be chosen so that the angle versus position is nearly linear. With very small air gaps, especially on longer magnets, the x and y fields will become non-sinusoidal, and the angle/position relationship will not be linear or as consistent over air-gap tolerance. In general, an air gap in the range of L/3 to L/2 works well.
  • Magnet diameter (D): In general, the larger the diameter of the magnet, the stronger the field will be. Making the diameter roughly equal to or slightly less than the air gap usually works well for neodymium magnets, weaker types of magnets will require larger diameters. 

Overall, for a given stroke length (LS), a reasonable design to start with is:

`L = LS × 0.65`

`d = D = 0.4 × L`

From there, these parameters can be increased or decreased in order to meet the goals of the application.

To determine whether the system will meet the design goals, the magnetic fields need to be modelled. While using advanced 3D magnetic modelling software will yield the most accurate result, it is not necessary in most cases. Fields can be modelled accurately enough using free 2D simulation software available online. Alternatively, the fields can be fairly easily computed in the case where a cylindrical magnet is used, and a bar magnet of similar size will result in nearly identical fields. 

Depending on the needs of the system, different linearisation or calibration methods may be used. When using the A1335, programming software is available which will guide the user through calibration/linearisation of a linear sensing system. 


Extending the sensing range with multiple sensors

Extending the sensing range can be done either by increasing the magnet size, following the guidelines above, or by adding more sensor ICs to the system. As the desired stroke length gets larger, the cost and size of the larger magnet will drive the solution towards using multiple sensors. A configuration using multiple sensors is shown in Figure 4. Here, three sensor ICs are used, but this can be extended to any number. One can use the low field detection feature of the A1335 to determine which sensor the magnet is over, and then use the output of that sensor to determine the exact magnet position.


Using multiple A1335 angle sensors to extend the measurement range
Figure 4: Using multiple A1335 angle sensors to extend the measurement range



Overall, magnetic angle sensor ICs work significantly better for linear slide-by position sensing than single-axis magnetic sensor ICs for the magnet plus sensor approach, making this method an ideal alternative to the unreliable and/or high-cost traditional solutions. The Allegro line of CVH-based angle sensor ICs, including the A1335, are well-suited for these applications, providing advanced features such as piecewise linear (PWL) linearisation, multiple digital output protocols, and automotive-grade ICs with dual IC options for safety-critical systems. Through the use of these sensor ICs and by following the guidelines provided, users can simply create robust, accurate, and low-cost linear position sensing solutions for any application.


About the Authors

Alex Latham is a Principal Systems Engineer in the Advanced Sensor Technologies division of Allegro MicroSystems, LLC. Since joining Allegro in 2011, Alex has helped to define and bring many next-generation magnetic sensor ICs to market. Alex is a graduate of Dartmouth College, where he earned both his Bachelor’s and Master’s degrees in Electrical Engineering with a focus on power electronics and magnetics.

Wade Bussing is a Systems Engineer in the Advanced Sensor Technologies division of Allegro MicroSystems, LLC. Wade joined Allegro in June of 2012, and has spent the past several years working on projects within the following portfolios: Linear Hall-Effect Sensor ICs, Hall-Effect Angular Position Sensor ICs, and Hall-Effect Current Sensor ICs. Wade recently graduated from the University of New Hampshire (UNH) in 2015 with a Bachelor’s degree in Electrical Engineering Technology.


This. article originally appeared in theBodo’s Power Systems magazine.