background image

Design Guide: TIDA-060040

Absolute Angle Encoder Reference Design With Hall­
Effect Sensors for Precise Motor Position Control

Description

This reference design demonstrates a method for 
absolute angle encoding typical in precision motor 
control applications such as robotic arm control. 
Angle encoding can be achieved using various 
magnetic sensing technologies. This is done by 
detecting two magnetic flux density, B-field, vector 
components which are naturally 90° out of phase. As 
the magnet spins, the sensor inputs are sinusoidal 
which allows for calculations using trigonometric 
properties. However, due to electrical and mechanical 
characteristics of the system, it is often necessary 
to correct the final result to achieve the greatest 
accuracy. Typically in most precision motor control 
applications, the final target error is less than 
0.1°. This design explores the process for selecting 
a magnet, determining placement, and correcting 
for system-level imperfections to achieve a highly-
accurate angle measurement.

Resources

TIDA-060040

Design Folder

TMAG5170

Product Folder

DRV5055

Product Folder

Ask our TI E2E

 support experts

Features

• Measure angle in on-axis, in-plane, and off-axis 

alignments for flexible alignment and sensor 
placement

• Calibration process for accuracy of 0.1°
• Selectable digital SPI communication or analog 

output

• Design files with sensor placement guidance

Applications

Mobile robot motor control

Mobile robot sensing module

Robotic lawn mower

Robot servo drive

Servo drive position sensor

Position sensors

Self-balancing personal transporter

Motor Supply 

Voltage

C2000 

LaunchPad™  

Interface

Motor Driver

Hall-Effect 

Sensor

TIDA-060040

BLDC 
Motor

3.3 V

SPI Bus

www.ti.com

Description

TIDUC07 – MARCH 2022

Submit Document Feedback

Absolute Angle Encoder Reference Design With Hall-Effect Sensors for 

Precise Motor Position Control

1

Copyright © 2022 Texas Instruments Incorporated

Summary of Contents for TIDA-060040

Page 1: ...esign explores the process for selecting a magnet determining placement and correcting for system level imperfections to achieve a highly accurate angle measurement Resources TIDA 060040 Design Folder TMAG5170 Product Folder DRV5055 Product Folder Ask our TI E2E support experts Features Measure angle in on axis in plane and off axis alignments for flexible alignment and sensor placement Calibratio...

Page 2: ...recise sensor placement for accurate phase alignment Magnet cost Hall effect Incremental Encoding Captures speed and direction of rotating magnet Simple calculation for incremental angle changes Immune to dirty working conditions Requires a multipole ring magnet Provides incremental angle position only and position at power up is unknown Inductive Sensed Angle Encoding Immune to influence from nea...

Page 3: ... to produce an output ranging from 180 An additional option is to use a device with an integrated CORDIC calculator CORDIC is an algorithm that approximates a binary search by performing vector rotations and has been optimized for digital logic Devices such as TMAG5170 and TMAG5273 are capable of generating angle outputs using the device outputs with minimal total system latency Linear Hall effect...

Page 4: ...ng with an integrated 12 bit ADC enables high accuracy and low drift magnetic field measurements while supporting a sampling of up to 20 kSPS On chip temperature sensor data is available for system level drift compensation 2 2 2 DRV5055A4 The DRV5055 is a linear Hall effect sensor that responds proportionally to magnetic flux density The device can be used for accurate position sensing in a wide r...

Page 5: ...The ability of the controller to manage this delay impacts device settings and end performance For instance TMAG5170 offers averaging modes which can help improve the observed input referred noise Minimizing this noise helps achieve the highest accuracy result but proportionally increases the overall integration time This increase in integration time determines the resulting phase related error AV...

Page 6: ... 2x Averaging 4x Averaging 8x Averaging 16x Averaging 32x Averaging Figure 2 3 Angle Phase Error vs Motor Speed 2 3 4 Sensor Location Simulations of the magnetic field were performed to evaluate the potential locations for on axis in plane and off axis alignments With a diametric magnet the largest magnitude magnetic field vector at any air gap distance occurs when evaluating the field aligned to ...

Page 7: ...45 90 135 180 225 270 315 360 400 350 300 250 200 150 100 50 0 50 100 150 200 250 300 350 400 450 Bx By Figure 2 6 2 mm Airgap Magnetic Field Inputs Additionally there is some minor harmonic distortion to the sinusoidal inputs Ultimately any distortion to the magnetic field inputs results in some periodic angle error For all magnets the sinusoidal nature typically improves with range 5 9 mm Airgap...

Page 8: ...A1 25 mT 50 mT 100 mT TMAG5170A2 75 mT 150 mT 300 mT DRV5055A1 DRV5055Z1 22 mT DRV5055A2 DRV5055Z2 44mT DRV5055A3 DRV5055Z3 88 mT DRV5055A4 DRV5055Z4 176 mT To allow for either device a horizontal sensor range of 4 65 mm DRV5055 and 5 9 mm TMAG5170 from the magnet face were selected to ensure at all possible positions that the input field would be within the BL of the TMAG5170A1 using the 100 mT s...

Page 9: ...agnetic Field Inputs shows that the in plane alignment is not ideal for DRV5055 in the SOT 23 package option due to the directionality of the magnetic field vector When perfectly coplanar to the center of the rotating magnet there is no vertical component If using the SOT 23 package option for this device the sensor detects the Z component of the field vector which in this alignment is 0 mT for al...

Page 10: ...r This placement is referred to as off axis or out of plane In effect all placements which are not coplanar to the magnet or centered on the axis of rotation fall into this category The key characteristic is that the magnetic field vector has a sinusoidal component in all three axes As a result there is a wide range of locations suitable for the SOT 23 package option System Overview www ti com 10 ...

Page 11: ...f each field component may vary and use of a 3D sensor allows for selection of the two axes which provide the best quality inputs Aside from the off axis and in plane positions the final alignment to examine is the on axis placement Figure 2 13 On Axis Sensor Alignment This is a unique location where the magnetic field vector is inherently parallel to the circular face of the magnet This condition...

Page 12: ... Based on the simulation results in Figure 2 15 Figure 2 16 and Figure 2 17 it is now possible to estimate any angle error resulting from amplitude mismatch or non sinusoidal inputs TMAG5170 Error Figure 2 15 Expected TMAG5170 In Plane Angle Error System Overview www ti com 12 Absolute Angle Encoder Reference Design With Hall Effect Sensors for Precise Motor Position Control TIDUC07 MARCH 2022 Sub...

Page 13: ...each option provides a viable path to design angle encoding However each of these cases has assumed ideal mechanical tolerances Test Results details the actual observed error from each of these device configurations www ti com System Overview TIDUC07 MARCH 2022 Submit Document Feedback Absolute Angle Encoder Reference Design With Hall Effect Sensors for Precise Motor Position Control 13 Copyright ...

Page 14: ...5 0 1 0 2 0 3 0 5 1 2 3 5 10 20 30 50 100 180 Figure 2 19 Noise Induced Angle Error 2 3 6 Layout for Sensor Location One important factor when designing an angle encoder using these devices is the actual sensor location on the PCB The sensor placement in the package may result with unintentional placement errors in any of the 3 axes Figure 2 20 TIDA 060040 Sensor Placement System Overview www ti c...

Page 15: ...package depending on the sensor location Figure 2 22 TMAG5170 Sensor Location For TMAG5170 the layout files TIDA 060040 contain an alignment layer which indicates the actual sensor location Additionally a via has been placed at the target sensor location to assist with alignment www ti com System Overview TIDUC07 MARCH 2022 Submit Document Feedback Absolute Angle Encoder Reference Design With Hall...

Page 16: ... phase error is introduced which is a function of the total mismatch between the two channels This phase error is depicted as β in Equation 5 To properly use inputs with a phase error the following trigonometric adjustment to the arctangent calculation is helpful Acos θ β Acos θ cos β Asin θ sin β 5 In2 In1 Acos β cos θ Asin θ sin β Asin θ 6 In2 In1 cos β tan θ sin β 7 tan θ cos β In2 In1 sin β 8 ...

Page 17: ...RT_1 6 3V 0 1uF C4 OUT2 DRV5055 OUT1 GND DRV5055 GND VCC DRV5055 VCC OUT1 DRV5055 OUT2 GND_3 GND_3 VCC_3 VCC_3 CS_1 MOSI_1 MISO_1 SCLK_1 ALERT_1 CS_1 SCLK_1 MOSI_1 MISO_1 ALERT_1 0 R15 OUT 2 VCC 1 GND 3 DRV5055A1QDBZT U3 OUT 2 VCC 1 GND 3 DRV5055A1QDBZT U4 6 3V 0 1uF C6 GND_3 GND_3 6 3V 0 1uF C8 GND_3 GND_3 VCC 1 OUT 3 GND 2 DRV5055A1QLPGM U5 VCC 1 OUT 3 GND 2 DRV5055A1QLPGM U6 10V 1uF C5 10V 1uF ...

Page 18: ...AG5170 orthogonal TMAG5170 at 45 rotation and DRV5055 it is likewise possible to reduce the PCB layout for a single sensor option as desired Hardware Software Testing Requirements and Test Results www ti com 18 Absolute Angle Encoder Reference Design With Hall Effect Sensors for Precise Motor Position Control TIDUC07 MARCH 2022 Submit Document Feedback Copyright 2022 Texas Instruments Incorporated...

Page 19: ...printed magnet holder Figure 3 3 Holder 3D printed mounting plate Figure 3 4 Mounting Plate TI SCB SENS077 Micro USB cable www ti com Hardware Software Testing Requirements and Test Results TIDUC07 MARCH 2022 Submit Document Feedback Absolute Angle Encoder Reference Design With Hall Effect Sensors for Precise Motor Position Control 19 Copyright 2022 Texas Instruments Incorporated ...

Page 20: ...is possible to perform first order calibration of the system a Based on X Y and Z channel outputs select inputs to require the least sensitivity gain correction i TMAG5170 is capable of an 11 bit gain correction with a multiplication factor ranging from 0 to 2 ii Scale up a channel where possible or to use the minimum attenuation needed to achieve equally matched amplitude from two sinusoidal inpu...

Page 21: ...A 060040 PCB may result in various orientation and position errors that may similarly impact the phase and magnitude of the inputs Near field behavior At close proximity to many magnet types the magnetic field may produce a non ideal input for the sensor The target input field is a purely sinusoidal waveform The observed field when a sensor is placed very close to a magnet will typically take on s...

Page 22: ...s the resulting peak error is continually reduced Depending on the required system accuracy 8 points to 64 points can often provide adequate accuracy In a more advanced approach it is possible to match the error profile to a set of equations which are a combination of harmonics of the rotation frequency By performing complex analysis it is possible to generate a series of coefficients αi and βi th...

Page 23: ...2 2 8 2 4 2 1 6 1 2 0 8 0 4 0 0 4 0 8 1 2 1 6 2 2 4 2 8 3 2 3 6 4 Natural Error 3rd Harmonic Approximation Figure 3 9 Third Harmonic Approximation For all of the test results the data was captured at 0 25 intervals and analyzed for harmonic reduction To achieve consistent results in a real manufacturing environment some degree of calibration for each system is likely necessary as each unit would e...

Page 24: ...he entire setup resulted with mechanical errors which must be addressed These alignment flaws demonstrated in the test results are crucial for the purpose of demonstrating the significance of alignment errors and how the calibration process can correct even large scale angle error Strictly controlled manufacturing practices results with a reduced error from what is depicted for each case Figure 3 ...

Page 25: ...rall measurement latency 3 3 3 TMAG5170 In Plane The in plane alignment differs from the on axis approach in that the sensor is placed coplanar to the magnet This produces the smallest profile solution overall but produces highly imbalanced input magnitudes Additionally this alignment is the most susceptible to mechanical errors which is evident when examining the peak angle error This position is...

Page 26: ...xtreme With the assembly alignment errors for this test setup a very dramatic angle error resulted Even with this extreme of an error it is still possible to apply a calibration to the end result to achieve accuracy below 0 1 Table 3 3 In Plane Harmonic Correction Factors HARMONIC αi βi 1 5 33 2 68 2 0 5 1 22 3 0 26 0 51 4 0 17 0 05 5 0 04 0 02 Hardware Software Testing Requirements and Test Resul...

Page 27: ...l it is normal for the off axis case to have field components in all three directions With the versatility of TMAG5170 to detect 3D fields it is possible to use various sensor orientations and use any two vector components which are 90 out of phase In this case XZ field components were used to calculate angular position The observed error for this alignment were similar to what was observed with t...

Page 28: ...0 05 1 12 3 0 15 0 07 4 0 13 0 13 5 0 02 0 03 Off Axis Calibrated Angle Error shows the resulting error after applying the harmonic data Angle deg Angle Error deg 0 45 90 135 180 225 270 315 360 1 0 9 0 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 Calibrated Arctangent Error Calibrated CORDIC Error Figure 3 18 Off Axis Calibrated Angle Error Hardware Software Testing Requi...

Page 29: ...ase correction is captured for this alignment and shown in 45 Angle Alignment Mechanical Angle Error Figure 3 19 45 Angle Alignment Mechanical Angle Error Table 3 5 45 Angle Alignment Harmonic Correction Factors HARMONIC αi βi 1 2 64 4 34 2 0 18 5 59 3 0 82 0 51 4 0 43 0 05 5 0 06 0 1 6 0 0 05 7 0 025 0 005 45 Calibrated Angle Error shows the resulting error after applying the harmonic data Angle ...

Page 30: ...he resulting pre calibrated error captured for this alignment The challenge observed using this configuration is that the number of mechanical errors possible in the system are now doubled with a second sensor This produces a more complex error profile Despite this the same procedure for calibration applies and yields excellent results Angle deg System Angle Error deg 0 45 90 135 180 225 270 315 3...

Page 31: ... resulting error after applying the harmonic data Figure 3 23 DRV5055 Off Axis Calibrated Angle Error www ti com Hardware Software Testing Requirements and Test Results TIDUC07 MARCH 2022 Submit Document Feedback Absolute Angle Encoder Reference Design With Hall Effect Sensors for Precise Motor Position Control 31 Copyright 2022 Texas Instruments Incorporated ...

Page 32: ...Hall Effect Sensor data sheet 4 4 Support Resources TI E2E support forums are an engineer s go to source for fast verified answers and design help straight from the experts Search existing answers or ask your own question to get the quick design help you need Linked content is provided AS IS by the respective contributors They do not constitute TI specifications and do not necessarily reflect TI s...

Page 33: ...o 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 indemn...

Reviews: