Texas Instruments | Linear Hall Effect Sensor Angle Measurement Theory, Implementation (Rev. A) | Application notes | Texas Instruments Linear Hall Effect Sensor Angle Measurement Theory, Implementation (Rev. A) Application notes

Texas Instruments Linear Hall Effect Sensor Angle Measurement Theory, Implementation (Rev. A) Application notes
Application Report
SLYA036A – July 2018 – Revised August 2018
Linear Hall Effect Sensor Angle Measurement Theory,
Implementation, and Calibration
Mitch Morse ........................................................................................... Current and Magnetic Sensing
ABSTRACT
This application report discusses how linear Hall effect sensors can be used to measure 2D angles,
including both limited-angle and 360° rotation measurements. This report provides details on some
calibrated and uncalibrated implementations to help meet angle measurement accuracy requirements.
This report also covers the number of sensors needed, and the preferred magnet types for each method.
1
2
3
4
5
Contents
Introduction ................................................................................................................... 3
Overview ...................................................................................................................... 3
Device Descriptions ......................................................................................................... 5
Methods ....................................................................................................................... 6
References ................................................................................................................. 24
List of Figures
1
Disc and Cylinder Magnets ................................................................................................. 3
2
Ring Magnets
3
Block Magnets
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
................................................................................................................ 3
............................................................................................................... 4
Sphere Magnet ............................................................................................................... 4
Multipole Ring Magnet ...................................................................................................... 4
Uncalibrated Sensor Positions ............................................................................................ 7
One Sensor Near Magnet .................................................................................................. 8
One Sensor Uncalibrated Data ............................................................................................ 8
Two Sensors 90° Apart ..................................................................................................... 9
Two Sensors 90° Apart Uncalibrated Data ............................................................................... 9
Two Sensors 45° Apart .................................................................................................... 10
Two Sensors 45° Apart Uncalibrated Data ............................................................................. 10
Three Sensors 60° Apart .................................................................................................. 11
Three Sensors 60° Apart Uncalibrated Data ........................................................................... 11
One Sensor Peak Calibrated Data ....................................................................................... 14
One Sensor Peak Calibrated Error ...................................................................................... 14
Two Sensors Peak Calibrated Data ..................................................................................... 15
Two Sensors Peak Calibrated Error .................................................................................... 15
One Sensor Lookup Table Calibrated Error, 7 Cal Points, ≈ 4° Peak-to-Peak Error ............................. 18
One Sensor Lookup Table Calibrated Error, 10 Cal Points, ≈ 2° Peak-to-Peak Error ............................ 18
One Sensor Lookup Table Calibrated Error, 16 Cal Points, ≈ 1° Peak-to-Peak Error ............................ 18
Two Sensors Lookup Table Calibrated Error, 14 Cal Points, ≈ 4° Peak-to-Peak Error .......................... 19
Two Sensors Lookup Table Calibrated Error, 26 Cal Points, ≈ 2° Peak-to-Peak Error .......................... 19
Two Sensors Lookup Table Calibrated Error, 45 Cal Points, ≈ 1° Peak-to-Peak Error .......................... 19
One Sensor Peak Calibrated Plus Lookup Table Error, 3 Cal Point, ≈ 4° Peak-to-Peak Error .................. 22
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
1
www.ti.com
26
27
28
29
30
................
One Sensor Peak Calibrated Plus Lookup Table Error, 9 Cal Points, ≈ 1° Peak-to-Peak Error ................
Two Sensors Peak Calibrated Plus Lookup Table Error, 8 Cal Points, ≈ 4° Peak-to-Peak Error ...............
Two Sensors Peak Calibrated Plus Lookup Table Error, 14 Cal Points, ≈ 2° Peak-to-Peak Error ..............
Two Sensors Peak Calibrated Plus Lookup Table Error, 25 Cal Points, ≈ 1° Peak-to-Peak Error ..............
One Sensor Peak Calibrated Plus Lookup Table Error, 5 Cal Points, ≈ 2° Peak-to-Peak Error
22
22
23
23
23
List of Tables
1
Angle Measurement Summary ............................................................................................. 6
2
One Sensor Regions ........................................................................................................ 8
3
Two Sensors 90° Apart Regions........................................................................................... 9
4
Two Sensors 45° Apart Regions ......................................................................................... 10
5
Three Sensors 60° Apart Regions ....................................................................................... 12
Trademarks
All trademarks are the property of their respective owners.
2
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Introduction
www.ti.com
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.
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 1 and the two left
magnets in Figure 2.
Some examples of diametrically magnetized magnets are the two right magnets in Figure 1 and the two
right magnets in Figure 2.
Other magnet types are typically referred by shape, such as block and sphere magnets (Figure 3 and
Figure 4), or by unique polarity, for example a multipole ring magnet (Figure 5).
2.2
Types of Magnets
Figure 1. Disc and Cylinder Magnets
Figure 2. Ring Magnets
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
3
Overview
www.ti.com
Figure 3. Block Magnets
Figure 4. Sphere Magnet
Figure 5. Multipole Ring Magnet
4
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
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.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
5
Methods
4
www.ti.com
Methods
Table 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 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.
Table 1. Angle Measurement Summary
Calibration Method
Recommended Magnet
Options
Magnet Placement Orientation
Required?
# Sensors
Needed
Estimated Accuracy
Peak-to-Peak Error
(Based on measured data with a
DRV5055)
1 Sensor
2+ Sensors
Accuracy
Improved by
Adding:
Yes
Yes
Sensors
1+
2+
= 180° / #Sensors
< 180°
360°
Complexity
Uncalibrated
Diametrically magnetized disc or
axially magnetized cylinder or
block
Peak Calibrated
Diametrically magnetized disc
Yes
Yes
N/A
1
2
≈ 8°
Low
Lookup Table
Diametrically magnetized disc
Approximately
No
Calibration points
1
2
≈ (Spacing Between Cal Points) / 8
High
Peak + Lookup Hybrid
Diametrically magnetized disc
Approximately
No
Calibration points
1
2
≈ (Spacing Between Cal Points) / 15
Medium
6
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
Low
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
4.1
Uncalibrated Implementations
4.1.1
Overview
4.1.1.1
General Implementation
The peak amplitude of the signal is unknown with an uncalibrated system. Therefore, the only usable
information from the sensor is whether VOUT is greater or less than VVCC / 2, as shown in Figure 6. This
information indicates whether the magnet is pointing towards a degree range (or region) where the sensor
is sensing more north or more south polarity. The number of regions for a system depends on the number
of sensors used.
Figure 6. Uncalibrated Sensor Positions
4.1.1.2
•
•
•
4.1.1.3
•
•
•
•
4.1.1.4
•
•
•
Preferred Magnet Types
Diametrically magnetized disc or cylinder
Axially magnetized cylinder
Block magnet
General Accuracy and Resolution
Low accuracy
Low resolution
Results come in the form of general regions
Accuracy can be improved by adding sensors
Considerations
The magnet must be oriented to align desired regions.
The boundary line for each sensor is at VOUT = VVCC / 2. If VVCC / 2 is measured, then either side of the
boundary line may be chosen as the measured region.
The uncalibrated implementations discussed here are for 360° rotation. For smaller ranges of
movement, fewer regions are available.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
7
Methods
4.1.2
www.ti.com
One Bipolar Sensor, Uncalibrated
4.1.2.1
Specific Implementation
With one sensor, as shown in Figure 7, the sensor output voltage takes the form shown in Figure 8.
Because there is no calibration phase, the peak amplitude is unknown.
Figure 7. One Sensor Near Magnet
3.3
2.8875
Sensor Output (V)
2.475
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
Figure 8. One Sensor Uncalibrated Data
4.1.2.2
Calculating Region
To determine the region that the magnet points towards, measure to see if VOUT is greater or less than
VVCC / 2, as shown in Table 2.
Table 2. One Sensor Regions
4.1.2.3
VOUT
Region
> VVCC / 2
0° to 180°
< VVCC / 2
180° to 360°
Accuracy
The accuracy for this setup is the size of each region, 180°.
8
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
4.1.3
Two Bipolar Sensors 90° Apart, Uncalibrated
4.1.3.1
Specific Implementation
With two sensors 90° apart, as shown in Figure 9, the sensor output voltage takes the form shown in
Figure 10. There is no calibration phase, so the peak amplitude is unknown; therefore, an example
amplitude is shown.
Figure 9. Two Sensors 90° Apart
3.3
2.8875
Sensor Output (V)
2.475
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
Figure 10. Two Sensors 90° Apart Uncalibrated Data
4.1.3.2
Calculating Region
To determine the region that the magnet points towards, measure VOUT for each sensor to see if VOUT is
greater or less than VVCC / 2, as shown in Table 3.
Table 3. Two Sensors 90° Apart Regions
4.1.3.3
VOUT 1
VOUT 2
Region
> VVCC / 2
> VVCC / 2
0° to 90°
> VVCC / 2
< VVCC / 2
90° to 180°
< VVCC / 2
> VVCC / 2
180° to 270°
< VVCC / 2
< VVCC / 2
270° to 360°
Accuracy
The accuracy for this setup is the size of each region, 90°.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
9
Methods
4.1.4
www.ti.com
Two Bipolar Sensors n° Apart, Uncalibrated
4.1.4.1
Specific Implementation
When the two sensors are not 90° apart, the regions sizes are no longer the same, and instead depend on
the degree (n) between the sensors. With two sensors that are n° apart, as in Figure 11, the sensor output
voltage takes the form shown in Figure 12. Both of these images use n = 45° as an example. There is no
calibration phase, so the peak amplitude is unknown; therefore, an example amplitude is shown. To avoid
losing the benefit of two sensors, n cannot approximately equal either 0° or 180°.
Figure 11. Two Sensors 45° Apart
3.3
2.8875
Sensor Output (V)
2.475
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
Figure 12. Two Sensors 45° Apart Uncalibrated Data
4.1.4.2
Calculating Region
To determine the region that the magnet points towards, measure VOUT for each sensor to see if VOUT is
greater or less than VVCC / 2, as shown in Table 4.
Table 4. Two Sensors 45° Apart Regions
4.1.4.3
VOUT 1
VOUT 2
Region for n
> VVCC / 2
> VVCC / 2
0° to (180 – n)°
Region at n = 45°
0° to 135°
> VVCC / 2
< VVCC / 2
(180 – n)° to 180°
135° to 180°
< VVCC / 2
> VVCC / 2
180° to (360 – n)°
180° to 315°
< VVCC / 2
< VVCC / 2
(360 – n)° to 360°
315° to 360°
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)°.
10
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
4.1.5
Three or More Bipolar Sensors, Uncalibrated
4.1.5.1
Specific Implementation
With s number of sensors n° apart, the sensor system output varies for every setup, but produces s × 2
regions. For evenly spaced regions, place the sensors so that n = (180 / s)° apart. For example, Figure 13
and Figure 14 use s = 3 sensors and n = (180 / 3) = 60° and produces 3 × 2 = 6 regions. Region sizes
can be adjusted by changing the degree n between each sensor. There is no calibration phase, so the
peak amplitude is unknown; therefore, an example amplitude is shown. To avoid losing the benefit of each
sensor, n between any given two sensors cannot approximately equal either 0° or 180°.
Figure 13. Three Sensors 60° Apart
3.3
2.8875
Sensor Output (V)
2.475
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
Figure 14. Three Sensors 60° Apart Uncalibrated Data
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
11
Methods
4.1.5.2
www.ti.com
Calculating Region
To determine the region that the magnet points towards, measure VOUT for each sensor to see if VOUT is
greater or less than VVCC / 2 while considering the degree n between each sensor. The regions from the
example where s = 3 sensors and n = (180 / 3) = 60° are shown in Table 5. To calculate the regions when
using any other value for n, adapt the equations shown in Table 4 to adjust for the number of sensors (s)
and spacing (n).
Table 5. Three Sensors 60° Apart Regions
4.1.5.3
VOUT 1
VOUT 2
VOUT 3
Region
> VVCC / 2
> VVCC / 2
> VVCC / 2
0° to 60°
> VVCC / 2
> VVCC / 2
< VVCC / 2
60° to 120°
> VVCC / 2
< VVCC / 2
< VVCC / 2
120° to 180°
< VVCC / 2
< VVCC / 2
< VVCC / 2
180° to 240°
< VVCC / 2
< VVCC / 2
> VVCC / 2
240° to 300°
< VVCC / 2
> VVCC / 2
> VVCC / 2
300° to 360°
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).
12
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
4.2
Peak Calibrated Implementations
4.2.1
Overview
4.2.1.1
General Implementation
With a peak-calibrated system, bipolar sensor data can be normalized to ±1 for use with the arctan2 (two
sensors) or arcsin (one sensor) function in order to determine the angle. Arctan2 must be used instead of
arctan, because arctan2 accounts for which of the two values are negative. The process for calibration is:
1. Find the min and max values from each sensor by continuously reading voltages while rotating the
magnet 360°. One full rotation is required, but more rotations help make sure that more accurate min
and max values are found.
2. Then, during normal operation, each new measured voltage can be normalized to ±1 using Equation 1.
(1)
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
•
•
•
•
4.2.1.4
•
•
•
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
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.
(2)
•
Most arctan2 and arcsin functions output the angle in radians. The angle can be converted to degrees
using Equation 3.
(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°.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
13
Methods
4.2.2
www.ti.com
One Bipolar Sensor, Peak Calibrated
4.2.2.1
Specific Implementation
With one sensor, as in Figure 7, the sensor output voltage takes the form shown in Figure 15. With a peak
calibration phase, both the min and max voltage values are known.
3.3
VOUT, amplitude V = 1.2
2.8875
Sensor Output (V)
2.475
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)
D005
Figure 15. One Sensor Peak Calibrated Data
4.2.2.2
Calculating Angle
To determine the angle that the magnet points towards, input the normalized data into the arcsin function,
as outlined in Section 4.2.1.1. The identity in Equation 2 may be used instead of arcsin if desired.
4.2.2.3
Accuracy
The output from the arcsin function has a swing of ±90°. However, the accuracy generally decreases
when the angle is too close to 90° or –90° because there is not much variance in the output voltage for
those regions. In general, the accuracy is usually within 8° peak-to-peak when operating at a swing of
≈±80°, based on datasheet parameters and experimental data taken with the DRV5055. Figure 16 shows
an example of a possible error curve for this setup.
3
2
1
Error (q)
0
-1
-2
-3
-4
-5
-6
-7
-90
-70
-50
-30
-10
10
Angle (q)
30
50
70
90
D007
Figure 16. One Sensor Peak Calibrated Error
14
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
4.2.3
Two Bipolar Sensors 90° Apart, Peak Calibrated
4.2.3.1
Specific Implementation
With two sensors 90° apart, as in Figure 9, the sensor output voltage takes the form shown in Figure 17.
With a peak calibration phase, both the min and max voltage values are known for each curve.
3.3
VOUT 2, amplitude V = 1.2
VOUT 1, amplitude V = 1
2.8875
Sensor Output (V)
2.475
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)
D006
Figure 17. Two Sensors Peak Calibrated Data
4.2.3.2
Calculating Angle
To determine the angle that the magnet points towards, input the normalized data into the arctan2
function, as outlined in Section 4.2.1.1.
4.2.3.3
Accuracy
The output from the arctan2 function goes from 0° to 360°. In general, the accuracy is usually within 8°
peak-to-peak, based on datasheet parameters and experimental data taken with the DRV5055. Figure 18
shows an example of a possible error curve for this setup.
5
4
3
Error (q)
2
1
0
-1
-2
-3
0
30
60
90 120 150 180 210 240 270 300 330 360
Ange (q)
D008
Figure 18. Two Sensors Peak Calibrated Error
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
15
Methods
4.3
www.ti.com
Lookup Table Calibration Implementations
4.3.1
Overview
4.3.1.1
General Implementation
With a lookup table calibrated system, sensor voltage data for known angles are recorded, and then the
angle for any measured voltage is taken from a linear interpolation between the known voltages. The
process for calibration is:
1. For each desired calibration angle, rotate the magnet to the angle, and record the measured voltage
for each sensor.
2. Then, during normal operation, measured voltages for each sensor fall between two of the previously
recorded voltages, referenced as Vabove and Vbelow. When using two sensors, make sure that the Vabove
and Vbelow for each sensor are associated with the same calibration angle.
3. The measured angle is then taken as a ratio of those two voltages and the respective known angles
using Equation 4:
(4)
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.
4.3.1.2
•
4.3.1.3
•
Preferred Magnet Types
Diametrically magnetized disc or cylinder
General Accuracy and Resolution
High accuracy is achievable, but depends significantly on the number of calibration points used. A
good starting point to estimate the spacing (in degrees) needed between calibration points for a
desired peak-to-peak accuracy (in degrees) is found using Equation 5, based on experimental data
collected with the DRV5055. This equation uses peak-to-peak error, so a peak-to-peak accuracy of 1°
gives an approximate error of ±0.5°. With a lookup table calibration, the spacing between calibration
points must not be greater than 30°, or the error may be unpredictable.
(5)
•
•
•
16
High resolution is possible (depending on ADC)
Results come in degrees
Accuracy is also affected by physical setup (when using one sensor) and magnet selection
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
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.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
17
Methods
4.3.2
www.ti.com
One Bipolar Sensor, Lookup Table Calibrated
4.3.2.1
Specific Implementation
With one sensor, as in Figure 7, the sensor output voltage takes the form shown in Figure 15. With a
lookup table calibration phase, specific voltages for various angles are known, but the min and max
voltage values are not known.
4.3.2.2
Calculating Angle
To determine the angle that the magnet points towards, find the estimated angle between two lookup table
points, as outlined in Section 4.3.1.1.
4.3.2.3
Accuracy
With just one sensor, only the linear region of the curve in Figure 15 is usable. This span is ≈140°;
therefore, the magnet must be roughly positioned so that the desired measurement range falls within the
140° linear region. The accuracy for this method largely depends on the spacing between the calibration
points, and is estimated using Equation 5.
3
3
2
2
1
1
Error (q)
Error (q)
Figure 19, Figure 20, and Figure 21 each show an example of a possible error curve for this setup with a
different number of calibration points, calibrated between ±70°.
0
0
-1
-1
-2
-2
-3
-90
-70
-50
-30
-10
10
Angle (q)
30
50
70
-3
-90
90
-70
-50
-30
D009
Figure 19. One Sensor Lookup Table Calibrated Error,
7 Cal Points, ≈ 4° Peak-to-Peak Error
-10
10
Angle (q)
30
50
70
90
D010
Figure 20. One Sensor Lookup Table Calibrated Error,
10 Cal Points, ≈ 2° Peak-to-Peak Error
3
2
Error (q)
1
0
-1
-2
-3
-90
-70
-50
-30
-10
10
Angle (q)
30
50
70
90
D011
Figure 21. One Sensor Lookup Table Calibrated Error, 16 Cal Points, ≈ 1° Peak-to-Peak Error
18
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Methods
www.ti.com
Two Bipolar Sensors ≈ 90° Apart, Lookup Table Calibrated
4.3.3
4.3.3.1
Specific Implementation
With two sensors, as in Figure 9, the sensor output voltage takes the form shown in Figure 17. These
sensors do not need to be 90° apart to have unique data for the lookup table. However, best practice is to
have the sensors close to 90° apart so that the unusable peaks of one signal are at the linear regions of
the other signal, allowing the peak data to be ignored. To avoid losing the benefit of two sensors, the
spacing cannot be approximately equal to either 0° or 180°. With a lookup table calibration phase, specific
voltages for various angles are known, but the min and max voltage values are not known.
4.3.3.2
Calculating Angle
To determine the angle that the magnet points towards, find the estimated angle between two lookup table
points, as outlined in Section 4.3.1.1. This process must be done for each sensor, and then the two results
are averaged to find the angle associated with the magnet. Areas where Vabove – Vbelow ≈ 0 (the peaks) are
not usable in this method; therefore, the best practice is to use the value from the other sensor in these
regions.
4.3.3.3
Accuracy
The accuracy for this method largely depends on the spacing between the calibration points, and can be
estimated using Equation 5.
3
3
2
2
1
1
Error (q)
Error (q)
Figure 22, Figure 23, and Figure 24 each show an example of a possible error curve for this setup with a
different number of calibration points.
0
0
-1
-1
-2
-2
-3
-3
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D012
Figure 22. Two Sensors Lookup Table Calibrated Error,
14 Cal Points, ≈ 4° Peak-to-Peak Error
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D013
Figure 23. Two Sensors Lookup Table Calibrated Error,
26 Cal Points, ≈ 2° Peak-to-Peak Error
3
2
Error (q)
1
0
-1
-2
-3
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D014
Figure 24. Two Sensors Lookup Table Calibrated Error, 45 Cal Points, ≈ 1° Peak-to-Peak Error
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
19
Methods
4.4
www.ti.com
Peak Calibrated Plus Lookup Table Hybrid
4.4.1
Overview
4.4.1.1
General Implementation
With a peak calibrated plus lookup table hybrid system, bipolar sensor data is first normalized to ±1 for
use with the arctan2 (two sensors) or arcsin (one sensor) function to determine a preliminary angle (Ap).
Arctan2 must be used instead of arctan because arctan2 accounts for which of the two values are
negative. Then the calculated Ap for various known ideal angles (Ai) are recorded as calibration angles
(Ac), and a linear error adjustment is done to all future Ap based on the error between the recorded Ac and
the known Ai. The process for calibration is:
1. Find Ap by inputting the normalized data into the arctan2 or arcsin function, as outlined in
Section 4.2.1.1).
2. Rotate the magnet to the 0° point and use this Ap as a zero-offset for all other Ap calculations.
3. Rotate the magnet to the desired calibration Ai and record the Ap as Ac. (The Ac for 0° is 0° because of
the zero-offset adjustment done previously).
4. Then, during normal operation, each new Ap falls between two of the previously recorded Ac; the angle
just above Ap (AcA) and the angle just below Ap (AcB).
5. The error for any point between AcA and AcB is estimated from a linear approximation of the known
error from AcA to AiA and Acb to AiB in the form of y = Mx + b, where:
(6)
6. Then, all new angle values (An) can be calculated using Equation 7:
(7)
4.4.1.2
•
4.4.1.3
Preferred Magnet Types
Diametrically magnetized disc or cylinder
General Accuracy and Resolution
•
High accuracy is achievable, but significantly depends on the number of calibration points used. A
good starting point to estimate the spacing (in degrees) needed between calibration points for a
desired peak-to-peak accuracy (in degrees) is found using Equation 8, based on experimental data
collected with the DRV5055. This equation uses peak-to-peak error, so a peak-to-peak accuracy of 1°
gives an approximate error of ±0.5°.
•
•
•
High resolution is possible (depending on ADC).
Results come in degrees.
Accuracy is also affected by physical setup and magnet selection.
(8)
20
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
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.
(9)
•
Most arctan2 and arcsin functions output the angle in radians. This angle can be converted to degrees
using Equation 10:
(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°.
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
21
Methods
4.4.2
www.ti.com
One Bipolar Sensor, Hybrid Calibrated
4.4.2.1
Specific implementation
With one sensor, as shown in Figure 7, the sensor output voltage takes the form shown in Figure 15. With
a lookup table plus peak calibration phase, specific voltages for various angles, as well as the min and
max voltage values, are known.
4.4.2.2
Calculating Angle
To determine the angle that the magnet points towards, input the normalized data into the arcsin
functionand calibrating for accuracy using a lookup table, as outlined in Section 4.4.1.1. The identity in
Equation 9 may be used instead of arcsin, if desired.
4.4.2.3
Accuracy
The output from the arcsin function has a swing of ±90°, but the accuracy generally decreases when too
close 90° or -90°, as there is not much variance in the output voltage for those regions. In general, this
leaves an operating region of ≈±80°. Therefore, the magnet needs to be roughly positioned so that the
desired measurement range falls within the ±80° region. The accuracy for this method largely depends on
the spacing between the calibration points, which can be estimated using Equation 8.
3
3
2
2
1
1
Error (q)
Error (q)
Figure 25, Figure 26, and Figure 27 each show an example of a possible error curve for this setup with a
different number of calibration points, calibrated between ±80°.
0
0
-1
-1
-2
-2
-3
-90
-70
-50
-30
-10
10
Angle (q)
30
50
70
-3
-90
90
-70
-50
-30
D015
Figure 25. One Sensor Peak Calibrated Plus Lookup Table
Error, 3 Cal Point, ≈ 4° Peak-to-Peak Error
-10
10
Angle (q)
30
50
70
90
D017
Figure 26. One Sensor Peak Calibrated Plus Lookup Table
Error, 5 Cal Points, ≈ 2° Peak-to-Peak Error
3
2
Error (q)
1
0
-1
-2
-3
-90
-70
-50
-30
-10
10
Angle (q)
30
50
70
90
D018
Figure 27. One Sensor Peak Calibrated Plus Lookup Table Error, 9 Cal Points, ≈ 1° Peak-to-Peak Error
22
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
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.
4.4.3.1
Specific Implementation
With two sensors at 90° apart as in Figure 9, the sensor output voltage will take the form shown in
Figure 17. Note that with a lookup table plus peak calibration phase, specific voltages for various angles
are known, as well as the min and max voltage values.
4.4.3.2
Calculating Angle
To determine the angle that the magnet points towards, input the normalized data into the arctan2 function
and calibrating for accuracy using a lookup table, as outlined in Section 4.4.1.1.
4.4.3.3
Accuracy
The accuracy for this method largely depends on the spacing between the calibration points, and can be
estimated using Equation 8.
Figure 28, Figure 29, and Figure 30 each show an example of a possible error curve for this setup with a
different number of calibration points.
3
3
2.5
2
2
1.5
1
Error (q)
Error (q)
1
0.5
0
-0.5
0
-1
-1
-1.5
-2
-2
-2.5
-3
-3
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D019
Figure 28. Two Sensors Peak Calibrated Plus Lookup
Table Error, 8 Cal Points, ≈ 4° Peak-to-Peak Error
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D020
Figure 29. Two Sensors Peak Calibrated Plus Lookup
Table Error, 14 Cal Points, ≈ 2° Peak-to-Peak Error
3
2
Error (q)
1
0
-1
-2
-3
0
30
60
90 120 150 180 210 240 270 300 330 360
Angle (q)
D021
Figure 30. Two Sensors Peak Calibrated Plus Lookup Table Error, 25 Cal Points, ≈ 1° Peak-to-Peak Error
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
23
References
5
References
•
•
•
•
•
24
www.ti.com
Overview Using Linear Hall Effect Sensors to Measure Angle Application note
Breakout Adapter for SOT-23 and TO-92 Hall Sensor Evaluation
DRV5055 Evaluation Module
DRV5055-ANGLE-EVM
E2E forums at https://e2e.ti.com/
Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and
Calibration
Copyright © 2018, Texas Instruments Incorporated
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Revision History
www.ti.com
Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
Changes from Original (July 2018) to A Revision ........................................................................................................... Page
•
Changed document title .................................................................................................................. 1
SLYA036A – July 2018 – Revised August 2018
Submit Documentation Feedback
Revision History
Copyright © 2018, Texas Instruments Incorporated
25
IMPORTANT NOTICE FOR TI DESIGN INFORMATION AND RESOURCES
Texas Instruments Incorporated (‘TI”) technical, application or other design advice, services or information, including, but not limited to,
reference designs and materials relating to evaluation modules, (collectively, “TI Resources”) are intended to assist designers who are
developing applications that incorporate TI products; by downloading, accessing or using any particular TI Resource in any way, you
(individually or, if you are acting on behalf of a company, your company) agree to use it solely for this purpose and subject to the terms of
this Notice.
TI’s provision of TI Resources does not expand or otherwise alter TI’s applicable published warranties or warranty disclaimers for TI
products, and no additional obligations or liabilities arise from TI providing such TI Resources. TI reserves the right to make corrections,
enhancements, improvements and other changes to its TI Resources.
You understand and agree that you remain responsible for using your independent analysis, evaluation and judgment in designing your
applications and that you have full and exclusive responsibility to assure the safety of your applications and compliance of your applications
(and of all TI products used in or for your applications) with all applicable regulations, laws and other applicable requirements. You
represent that, with respect to your applications, you have all the necessary expertise to create and implement safeguards that (1)
anticipate dangerous consequences of failures, (2) monitor failures and their consequences, and (3) lessen the likelihood of failures that
might cause harm and take appropriate actions. You agree that prior to using or distributing any applications that include TI products, you
will thoroughly test such applications and the functionality of such TI products as used in such applications. TI has not conducted any
testing other than that specifically described in the published documentation for a particular TI Resource.
You are authorized to use, copy and modify any individual TI Resource only in connection with the development of applications that include
the TI product(s) identified in such TI Resource. NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE TO
ANY OTHER TI INTELLECTUAL PROPERTY RIGHT, AND NO LICENSE TO ANY TECHNOLOGY OR INTELLECTUAL PROPERTY
RIGHT OF TI OR ANY THIRD PARTY IS GRANTED HEREIN, including but not limited to any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information
regarding or referencing third-party products or services does not constitute a license to use such products or services, or a warranty or
endorsement thereof. Use of TI Resources may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
TI RESOURCES ARE PROVIDED “AS IS” AND WITH ALL FAULTS. TI DISCLAIMS ALL OTHER WARRANTIES OR
REPRESENTATIONS, EXPRESS OR IMPLIED, REGARDING TI RESOURCES OR USE THEREOF, INCLUDING BUT NOT LIMITED TO
ACCURACY OR COMPLETENESS, TITLE, ANY EPIDEMIC FAILURE WARRANTY AND ANY IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL
PROPERTY RIGHTS.
TI SHALL NOT BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY CLAIM, INCLUDING BUT NOT
LIMITED TO ANY INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON ANY COMBINATION OF PRODUCTS EVEN IF
DESCRIBED IN TI RESOURCES OR OTHERWISE. IN NO EVENT SHALL TI BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL,
COLLATERAL, INDIRECT, PUNITIVE, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES IN CONNECTION WITH OR
ARISING OUT OF TI RESOURCES OR USE THEREOF, AND REGARDLESS OF WHETHER TI HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
You agree to fully indemnify TI and its representatives against any damages, costs, losses, and/or liabilities arising out of your noncompliance with the terms and provisions of this Notice.
This Notice applies to TI Resources. Additional terms apply to the use and purchase of certain types of materials, TI products and services.
These include; without limitation, TI’s standard terms for semiconductor products http://www.ti.com/sc/docs/stdterms.htm), evaluation
modules, and samples (http://www.ti.com/sc/docs/sampterms.htm).
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2018, Texas Instruments Incorporated
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertising