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.
Equation 9.
Most arctan2 and arcsin functions output the angle in radians. This angle can be converted to degrees using Equation 10:
Equation 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°.