Slya 036 B
Slya 036 B
Application Note
Linear Hall-Effect Sensor Angle Measurement Theory,
Implementation, and Calibration
Table of Contents
1 Introduction.............................................................................................................................................................................1
2 Overview..................................................................................................................................................................................2
2.1 Types of Magnetization...................................................................................................................................................... 2
2.2 Types of Magnets...............................................................................................................................................................2
3 Device Descriptions............................................................................................................................................................... 4
3.1 2.5-V to 38-V, Bipolar Hall Effect Sensor Family: DRV5053 and DRV5053-Q1.................................................................4
3.2 High-Accuracy, 3.3-V or 5-V, Ratiometric, Bipolar Hall Effect Sensor Family: DRV5055 and DRV5055-Q1..................... 4
3.3 High-Accuracy, 3.3-V or 5-V, Ratiometric, Unipolar Hall Effect Sensor Family: DRV5056 and DRV5056-Q1................... 4
4 Methods................................................................................................................................................................................... 5
4.1 Uncalibrated Implementations............................................................................................................................................6
4.2 Peak Calibrated Implementations.................................................................................................................................... 12
4.3 Lookup Table Calibration Implementations...................................................................................................................... 15
4.4 Peak Calibrated Plus Lookup Table Hybrid......................................................................................................................19
5 References............................................................................................................................................................................ 23
6 Revision History................................................................................................................................................................... 23
Trademarks
All trademarks are the property of their respective owners.
1 Introduction
Linear Hall effect sensors measure the strength of a magnetic field and output a voltage proportional to that
measurement. Based on the degree range and resolution needed, one or more linear Hall sensors can be used
to determine the magnet direction. This application report covers angle measurements using no calibration, peak
calibration, lookup table calibration, and a hybrid method of both the peak calibrated and lookup table methods.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 1
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Overview www.ti.com
2 Overview
2.1 Types of Magnetization
The two main types of magnetization in permanent magnets are axial and diametric. This terminology makes
most sense when talking about discs, cylinders, and ring magnets. Axial magnets have north and south poles
that are on the flat surfaces of the magnet. Diametric magnets have north and south poles that are on the
rounded edges of the magnet.
Some examples of axially magnetized magnets are the two left magnets in Figure 2-1 and the two left magnets
in Figure 2-2.
Some examples of diametrically magnetized magnets are the two right magnets in Figure 2-1 and the two right
magnets in Figure 2-2.
Other magnet types are typically referred by shape, such as block and sphere magnets (Figure 2-3 and Figure
2-4), or by unique polarity, for example a multipole ring magnet (Figure 2-5).
2.2 Types of Magnets
2 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Overview
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 3
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Device Descriptions www.ti.com
3 Device Descriptions
When using linear Hall effect sensors to measure angles, a bipolar sensor is generally most practical to use,
although unipolar sensors can still be used for limited-angle measurements. Bipolar sensors respond to both
the north and south poles of a magnet, and allow for wider-angle measurements. Unipolar sensors respond to
one pole of the magnet allowing for only half of the movement range. The following subsections list some of the
linear Hall effect devices from TI.
3.1 2.5-V to 38-V, Bipolar Hall Effect Sensor Family: DRV5053 and DRV5053-Q1
The DRV5053 is a chopper-stabilized Hall effect sensor that offers a magnetic sensing solution with superior
sensitivity stability over temperature and integrated protection features.
The 0-V to 2-V analog output responds linearly to the applied magnetic flux density, and distinguishes the
polarity of magnetic field direction. A wide operating voltage range of 2.5 V to 38 V with reverse polarity
protection up to –22 V makes this device suitable for a wide range of industrial and consumer applications.
Internal protection functions are provided for reverse-supply conditions, load dump, and output short circuit or
overcurrent.
The DRV5053-Q1 is the automotive-grade version of the DRV5053.
3.2 High-Accuracy, 3.3-V or 5-V, Ratiometric, Bipolar Hall Effect Sensor Family: DRV5055 and
DRV5055-Q1
The DRV5055 is a linear Hall effect sensor that responds proportionally to magnetic flux density. This device can
be used for accurate position sensing in a wide range of applications.
The device operates from 3.3-V or 5-V power supplies. When no magnetic field is present, the analog output
drives half of VCC. The output changes linearly with the applied magnetic flux density, and four sensitivity
options enable maximal output voltage swing based on the required sensing range. North and south magnetic
poles produce unique voltages.
Magnetic flux perpendicular to the top of the package is sensed, and the two package options provide different
sensing directions.
The device uses a ratiometric architecture that can eliminate error from VCC tolerance when the external
analog-to-digital converter (ADC) uses the same VCC as a reference. Additionally, the device features magnet
temperature compensation to counteract magnet drift for linear performance across a wide –40°C to +125°C
temperature range.
The DRV5055-Q1 is the automotive-grade version of the DRV5055.
3.3 High-Accuracy, 3.3-V or 5-V, Ratiometric, Unipolar Hall Effect Sensor Family: DRV5056 and
DRV5056-Q1
The DRV5056 is a linear Hall effect sensor that responds proportionally to flux density of a magnetic south pole.
The device can be used for accurate position sensing in a wide range of applications.
The devices features a unipolar magnetic response. The analog output drives 0.6 V when no magnetic field is
present, and increases when a south magnetic pole is applied. This response maximizes the output dynamic
range in applications that sense one magnetic pole. Four sensitivity options further maximize the output swing
based on the required sensing range.
The device operates from 3.3-V or 5-V power supplies. Magnetic flux perpendicular to the top of the package is
sensed, and the two package options provide different sensing directions.
The device uses a ratiometric architecture that minimizes error from the VCC tolerance when the external
analog-to-digital converter (ADC) uses the same VCC as a reference. Additionally, the device features magnet
temperature compensation to counteract magnet drift for linear performance across a wide –40°C to +125°C
temperature range.
The DRV5056-Q1 is the automotive-grade version of the DRV5056.
4 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
4 Methods
Table 4-1 shows a summary of the angle measurement methods discussed in this application report. For the column labeled Magnet Placement
Orientation Required?, the term Approximately means that the magnet must be oriented during placement, but not very precisely. For more information
about each method, see the associated sections linked in Table 4-1.
Note
When trying to achieve high accuracy and resolution with 360° rotation, the Peak + Lookup Hybrid method is easier to implement than the
standard lookup table. The Peak + Lookup Hybrid method is used for the DRV5055-ANGLE-EVM.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and Calibration 5
Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
6 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
2.8875
2.475
Sensor Output (V)
2.0625
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D001
4.1.2.3 Accuracy
The accuracy for this setup is the size of each region, 180°.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 7
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
2.8875
2.475
Sensor Output (V)
2.0625
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D002
4.1.3.3 Accuracy
The accuracy for this setup is the size of each region, 90°.
8 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
2.8875
2.475
Sensor Output (V)
2.0625
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D003
4.1.4.3 Accuracy
The accuracy for this setup depends on the size of the current region. Out of the four regions, two regions have
an accuracy of n° and the other two regions have an accuracy of (180 – n)°.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 9
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
2.8875
2.475
Sensor Output (V)
2.0625
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D004
10 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
4.1.5.3 Accuracy
The accuracy for this setup depends on the current region and the value of n. When using evenly spaced
regions, where n = (180 / s)°, the accuracy for each region is (180 / s). To determine the accuracy when using
any other value for n, adapt the method described in Section 4.1.4.3 to adjust for the number of sensors (s) and
spacing (n).
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 11
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
3. The normalized data is then put directly into the arctan2 (two sensors, 0° to 360° output) or arcsin (one
sensor, 0° to ±90° output) function in order to get the angle of the magnet.
4.2.1.2 Preferred Magnet Types
• Diametrically magnetized disc or cylinder
4.2.1.3 General Accuracy and Resolution
• Good accuracy, ≈ 8° max error peak-to-peak (found experimentally using the DRV5055)
• High resolution is possible (depending on ADC)
• Results come in degrees
• Accuracy is affected by physical setup and magnet selection
4.2.1.4 Considerations
• The magnet must be oriented to align the degree output to the desired physical location.
• The sensors and magnet must be placed so that the sensor voltage output is not clipped or railed at either
the north or south pole.
• If writing code that uses both the arctan2 and arcsin functions, consider using the identity in Equation 2. This
identity saves on program space because the arctan2 function already uses the arctan function.
x
arcsin x = 2 × arctan (2)
1 + 1 − x2
• Most arctan2 and arcsin functions output the angle in radians. The angle can be converted to degrees using
Equation 3.
A° = Ar × 180
π (3)
• While a ±90° range is possible with one sensor, the voltage measurement accuracy and sensor noise limit the
angle to a value less than ±90°.
12 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
2.475
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D005
-2
-3
-4
-5
-6
-7
-90 -70 -50 -30 -10 10 30 50 70 90
Angle (q) D007
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 13
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
3.3
VOUT 2, amplitude V = 1.2
2.8875 VOUT 1, amplitude V = 1
2.475
1.65
1.2375
0.825
0.4125
0
0 30 60 90 120 150 180 210 240 270 300 330 360
Magnet Angle to Sensor (q) D006
2
Error (q)
-1
-2
-3
0 30 60 90 120 150 180 210 240 270 300 330 360
Ange (q) D008
14 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
Note
It is important to note that calibration regions where Vabove – Vbelow ≈ 0 do not work in Equation 4, and
therefore must not be used for this method.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 15
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
4.3.1.4 Considerations
• The magnet does not need to be oriented when using two sensors, and only needs to be roughly oriented
when using one sensor because a 0° point can be set during calibration.
• The sensors and magnet must be placed so that the sensor voltage output is not clipped or railed at either
the north or south pole.
• 0° and 360° are the same angle; therefore, use 0 as ANGLEbelow and 360 as ANGLEabove in Equation 4.
• Although it is possible to measure voltages that are out of the range of the lookup table (either above the max
or below the min recorded voltage values), the absolute min and max values are unknown. Therefore, these
measurements are unusable for linear interpolation.
• The lookup table calibration method can be more difficult to implement when using two sensors than methods
that use the arctan2 function for the following reasons:
– Exceptions must be coded to account for when Vabove – Vbelow ≈ 0 V in order to avoid dividing by 0.
– Data from the nonlinear regions of each sensor output must be avoided.
– Calibration data for each sensor must be stored (instead of storing the arctan2 output); therefore:
• It is harder to determine which calibration region to use because the voltage from each sensor appears
in two different regions of the respective lookup tables.
• It is possible that near a calibration boundary line, the data from each sensor is on either side of that
boundary.
16 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
3 3
2 2
1 1
Error (q)
Error (q)
0 0
-1 -1
-2 -2
-3 -3
-90 -70 -50 -30 -10 10 30 50 70 90 -90 -70 -50 -30 -10 10 30 50 70 90
Angle (q) D009
Angle (q) D010
Figure 4-14. One Sensor Lookup Table Calibrated Figure 4-15. One Sensor Lookup Table Calibrated
Error, 7 Cal Points, ≈ 4° Peak-to-Peak Error Error, 10 Cal Points, ≈ 2° Peak-to-Peak Error
3
1
Error (q)
-1
-2
-3
-90 -70 -50 -30 -10 10 30 50 70 90
Angle (q) D011
Figure 4-16. One Sensor Lookup Table Calibrated Error, 16 Cal Points, ≈ 1° Peak-to-Peak Error
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 17
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
3 3
2 2
1 1
Error (q)
Error (q)
0 0
-1 -1
-2 -2
-3 -3
0 30 60 90 120 150 180 210 240 270 300 330 360 0 30 60 90 120 150 180 210 240 270 300 330 360
Angle (q) D012
Angle (q) D013
Figure 4-17. Two Sensors Lookup Table Calibrated Figure 4-18. Two Sensors Lookup Table Calibrated
Error, 14 Cal Points, ≈ 4° Peak-to-Peak Error Error, 26 Cal Points, ≈ 2° Peak-to-Peak Error
3
1
Error (q)
-1
-2
-3
0 30 60 90 120 150 180 210 240 270 300 330 360
Angle (q) D014
Figure 4-19. Two Sensors Lookup Table Calibrated Error, 45 Cal Points, ≈ 1° Peak-to-Peak Error
18 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
6. Then, all new angle values (An) can be calculated using Equation 7:
An = M × Ap + B (7)
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 19
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
4.4.1.4 Considerations
• When using two sensors, the magnet does not need to be oriented. When using one sensor, the magnet only
needs to be roughly oriented because a 0° point can be set during calibration.
• The sensors and magnet must be placed so that the sensor voltage output is not clipped or railed at either
the north or south pole.
• 0° and 360° are the same angle; therefore, use 0 as AiB and use 360 as AiA in Equation 6.
• If writing code that uses both the arctan2 and arcsin functions, consider using the identity in Equation 9,
which saves on program space because the arctan2 function already uses arctan.
x
arcsin x = 2 × arctan (9)
1 + 1 − x2
• Most arctan2 and arcsin functions output the angle in radians. This angle can be converted to degrees using
Equation 10:
– A° = Ar × 180
π (10)
• While a ±90° range is possible with one sensor, the voltage measurement accuracy and sensor noise limit the
angle to a value less than ±90°.
20 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com Methods
3 3
2 2
1 1
Error (q)
Error (q)
0 0
-1 -1
-2 -2
-3 -3
-90 -70 -50 -30 -10 10 30 50 70 90 -90 -70 -50 -30 -10 10 30 50 70 90
Angle (q) D015
Angle (q) D017
Figure 4-20. One Sensor Peak Calibrated Plus Figure 4-21. One Sensor Peak Calibrated Plus
Lookup Table Error, 3 Cal Point, ≈ 4° Peak-to-Peak Lookup Table Error, 5 Cal Points, ≈ 2° Peak-to-Peak
Error Error
3
1
Error (q)
-1
-2
-3
-90 -70 -50 -30 -10 10 30 50 70 90
Angle (q) D018
Figure 4-22. One Sensor Peak Calibrated Plus Lookup Table Error, 9 Cal Points, ≈ 1° Peak-to-Peak Error
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 21
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
Methods www.ti.com
4.4.3 Two Bipolar Sensors 90° Apart, Hybrid Calibrated (Recommended High Accuracy Method)
Note
This is the method that is used on the DRV5055-ANGLE-EVM.
3 3
2.5
2 2
1.5
1 1
0.5
Error (q)
Error (q)
0 0
-0.5
-1 -1
-1.5
-2 -2
-2.5
-3 -3
0 30 60 90 120 150 180 210 240 270 300 330 360 0 30 60 90 120 150 180 210 240 270 300 330 360
Angle (q) D019
Angle (q) D020
Figure 4-23. Two Sensors Peak Calibrated Plus Figure 4-24. Two Sensors Peak Calibrated Plus
Lookup Table Error, 8 Cal Points, ≈ 4° Peak-to-Peak Lookup Table Error, 14 Cal Points, ≈ 2° Peak-to-
Error Peak Error
3
1
Error (q)
-1
-2
-3
0 30 60 90 120 150 180 210 240 270 300 330 360
Angle (q) D021
Figure 4-25. Two Sensors Peak Calibrated Plus Lookup Table Error, 25 Cal Points, ≈ 1° Peak-to-Peak
Error
22 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and SLYA036B – JULY 2018 – REVISED NOVEMBER 2021
Calibration Submit Document Feedback
Copyright © 2021 Texas Instruments Incorporated
www.ti.com References
5 References
• Texas Instruments, Overview Using Linear Hall Effect Sensors to Measure Angle application brief
• Texas Instruments, Breakout Adapter for SOT-23 and TO-92 Hall Sensor Evaluation Module tools page
• Texas Instruments, DRV5055 Evaluation Module tools page
• Texas Instruments, DRV5055-ANGLE-EVM tools page
• Texas Instruments, Angle Measurement With Multi-Axis Linear Hall-Effect Sensors application report
• Texas Instruments, E2E forums at https://e2e.ti.com/
6 Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
SLYA036B – JULY 2018 – REVISED NOVEMBER 2021 Linear Hall-Effect Sensor Angle Measurement Theory, Implementation, and 23
Submit Document Feedback Calibration
Copyright © 2021 Texas Instruments Incorporated
IMPORTANT NOTICE AND DISCLAIMER
TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE
DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS”
AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD
PARTY INTELLECTUAL PROPERTY RIGHTS.
These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate
TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable
standards, and any other safety, security, regulatory or other requirements.
These resources are subject to change without notice. TI grants you permission to use these resources only for development of an
application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license
is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you
will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these
resources.
TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with
such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for
TI products.
TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2022, Texas Instruments Incorporated