SBAA463A january 2021 – april 2023 TMAG5170 , TMAG5170-Q1 , TMAG5170D-Q1 , TMAG5173-Q1 , TMAG5273
A traditional approach to angular measurements using rotating magnets utilizes two linear Hall-effect sensors which are placed 90º apart in plane with a diametric cylinder magnet.
A standard Hall-effect sensor is only capable of detecting the component of the magnetic flux density, or B-Field, which is normal to the face of the device. With the configuration in Figure 1-1, each sensor is detecting only the portion of the B-Field which is directed radially outward from the center of the magnet along one axis. As the magnet is rotated, the resulting outputs produce matched sine and cosine waveforms with a 90º offset which correlates to the physical placement. We can observe that the peak magnetic flux density each sensor detects occurs when the pole of the magnet is perfectly aligned toward that sensor.
Given the trigonometric relationship of the outputs, the angle can be calculated by using the arctangent function. Specifically, the ATAN2 or ARCTAN2 function common in many math libraries is capable of accepting Cartesian (X,Y) inputs from all four quadrants and will calculate the associated angle.
This relationship provides a reliable method to determine the angle of rotating magnets. The Linear Hall Effect Sensor Angle Measurement Theory, Implementation, and Calibration Application Report is an additional resource that discusses this configuration in more detail.