SBAA503A march   2021  – may 2023

Rotation-based devices such as dials, joysticks, thermostats, electronic steering assemblies, and motor-controlled joints typical to gimbals or robotic arms all rely on the ability to accurately define angular position. While there are means to monitor rotation angle using mechanical contacts, these types of sensors are prone to wear out with use and can suffer performance loss in cases where dirt and grime are present. Hall-effect sensors are a contactless sensing alternative which can offer longer product life, improved reliability, and higher performance for angle sensing.

In applications where angular rotation is present, feedback to a controller can provide valuable insight to the device configuration. This can be user input from a knob or steering wheel, or exact position control for motor-driven configurations. Implementing this design using a Hall-effect sensor normally requires placing a magnet on the rotating body with a nearby sensor capable of detecting the magnetic flux density produced by the magnet. Monitoring angles with linear Hall-effect sensors can be most easily achieved when using a diametric cylinder magnet installed along the axis of rotation.

Figure 1 Diametric Magnet

Since this type of magnet is rotated axially, the various components of field vectors (which are indicative of magnetic flux density) vary cyclically. Depending on the position relative to the magnet, there are always at least two components to select from. These components are sinusoidal when the sensor is placed at an appropriate distance from the surface of the magnet. Consider the following curves representing each component produced by a rotating magnet.

Figure 2 Magnetic Flux Density vs Magnet Angle

If a sensor element is oriented in the XZ plane By, which is the component of the vector directed in the Y direction, the sensor element can be monitored. Using this input, it is possible to resolve up to 180° of rotation using the following relationship.

Equation 1. Device Output = α sin(θ)

Adding a second sensor 90° out of phase from the first enables expanding the absolute angle sensing design to a full 360°.

Figure 3 Field Components With 90° Phase Shift

When using two signals 90° out of phase, it is possible to calculate angle using the arctangent function.

Equation 2. θ = atan(B1/B2)

One method to set up an angle calculation is to use two one-dimensional sensors. For this method, the two sensors must be placed such that they are physically spaced 90° about the center of the magnet. This can be done with the sensors either In-Plane (coplanar to the magnet polarization) or Out-of-Plane. The In-Plane approach places the sensors directly aligned with the magnet pole, and therefore the observed inputs are larger, but the Out-of-Plane alignment requires less physical space.

Figure 4 Configurations for Angle Sense With One-Dimensional Hall-Effect Sensors

A mechanical spacing of 90° provides the required phase shift at the output.

Since each device is monitoring the equivalent field components, this approach is easy to implement using a device such as DRV5055, but this approach can have challenges related to sensitivity matching, mechanical alignment, and physical space.

Calibration can prove vital to achieving the highest level of precision when correcting for these errors.

A second option is to implement the design using a 3D position sensor. Returning to the plot in Figure 2, notice that the Y and Z components are naturally 90° out of phase. When using 3D position sensors, where more than one axis of sensitivity is available, it is possible to use a single device to simultaneously monitor each field component required for angle calculation.

Figure 5 3D Position Sensor

Integrating multiple sensors in a single package has the benefit of more consistent channel to channel magnetic field sensitivity and minimizes the required PCB area needed for the sensors. This makes multi-axis sensors an attractive option when designing for this function. An additional feature for 3D position sensors is an integrated CORDIC calculator capable of replicating the results of the arctangent function and generating angular position directly from the output data of any two axes.

Generally, there are three different orientations possible for this measurement: On-Axis, In-Plane, and Out-of-Plane (Off-Axis).

Figure 6 Configurations for Angle Sense With Multi-Axis Hall-Effect Sensors

Of these three, the easiest to implement is On-Axis, where the field components are naturally matched. An In-plane sensor placement can often be convenient, but there are only two measurable field components. Out-of-Plane essentially describes every other location. There is a measurable field in all three directions in various magnitudes and placement is flexible to the constraints of the design.

Consider that the input amplitudes of the magnetic field components are typically not equal in magnitude for most locations when using In-Plane or Out-of-Plane orientations.

Figure 7 Unequal Magnetic Field Components

As a result, calculations using the arctangent result in measurement error. This can be corrected for with careful placement to achieve matched inputs or by digitally scaling the outputs to match. This normalization function is built into devices such as TMAG5170-Q1, TMAG5170D-Q1, and provides design flexibility for all sensor placements, but can be achieved at the controller by implementing a scalar adjustment during calculations.

For more details and guides related to using linear Hall-effect sensors for absolute angle measurements with either one dimensional or 3D position sensors, see Table 1 and Table 2.

Table 1 Alternate Device Recommendations
DeviceCharacteristicsDesign Considerations
DRV5055Single axis linear Hall-effect sensor with Analog output available in SOT-23 and TO-92 packages.Analog outputs are subject to electrical noise and calculations require MCU computations. This device provides the lowest cost design. Full 360 monitoring requires two devices.
DRV5055-Q1Automotive grade single axis linear Hall-effect sensor with analog output available in SOT-23 and TO-92 packages.Similar to the commercial grade, but operates over a wider temperature range.
DRV5057Single axis linear Hall-effect sensor with PWM output available in SOT-23 and TO-92 packages.PWM outputs require conversion, but are less susceptible to coupled noise. Full 360 monitoring requires two devices.
DRV5057-Q1Automotive grade single axis linear Hall-effect sensor with PWM output available in SOT-23 and TO-92 package.Similar to the commercial grade, but operates over a wider temperature range.
TMAG5170-Q1Automotive grade linear 3D Hall-effect position sensor with SPI available in 8-pin DGK package.Is a single device design capable of sensing all field components and integrates angle calculation and field normalization. This device operates over SPI.
TMAG5170D-Q1Automotive grade dual die linear 3D Hall-effect position sensor with SPI available in 16-pin TSSOP package.Is a dual device design capable of sensing all field components and integrates angle calculation and field normalization. This device operates over SPI.
Table 2 Related Technical Resources
NameDescription
DRV5055 Angle EVMA demonstration of angle measurement using one dimensional Hall-effect sensors.
TMAG5170 EVMGUI and attachments incorporate angle measurement using a three dimensional linear Hall-effect sensor.
TMAG5170DEVMGUI and attachments incorporate angle measurement using three dimensional dual die linear Hall-effect sensor.
TMAG5170 2D Angle Error CalculatorThis tool helps evaluate expected errors that come as a result of rotation speed, conversion settings, and device level errors.
SBAA463Angle Measurement With Multi-Axis Linear Hall-Effect Sensors application note.
SLYA036Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and Calibration application note.
TI Precision Labs - Magnetic SensorsA video series describing the Hall effect and how the Hall effect is used in various applications.