Azimuth Calculation Basics - Calculating from the horizontal component of the earth's magnetic field
In a real compass (compass needle), the needle follows the earth's magnetic field over the base plate and points to magnetic north.
Compared to this, the 2-axis electric compass measures the x and y axes' magnetic fields of the horizontal components of earth's magnetic field, and then calculates the magnetic field's direction θ using the following equation.
θ = arctan (Y-axis value of the earth's magnetic field / X-axis value of the earth's magnetic field)
To convert this calculated value to the Azimuth angle (with north as the origin point of 0 degrees and proceeding clockwise), convert using the following equation.
Azimuth = 90° - θ
If the standard magnetic field can be measured, the azimuth can be found by use of the above two equations alone.