Without an accelerometer, tilt correction is impossible

Azimuth Calculation - Without an accelerometer, tilt correction is impossible

When you have a magnetic sensor but no accelerometer a slope-corrected azimuth calculation is impossible.  The reason is explained below.

First, think of the scenario where the device sensor is placed at level and there is a magnetic field perpendicular passing through it.

The left picture has a device with a perpendicular magnetic field through it. The right picture shows a model of the sensor within the device.

The magnetic field measured by the sensor has a zero value with level x and y components, and only measures the vertical z component.

When the device is rotated while level, the recorded value of the magnetic field will not change regardless of which direction the device is facing.

In practice, the earth's magnetic field is not vertical but is sloped at an oblique angle.

Compared to an oblique magnetic field, in the case of a device stood perpendicular and facing that direction, it will be the same as the level device from before.

When compared to the orientation of the device's magnetic field, even if rotated parallel to the vertical face, the magnetic sensor's recorded value won't change.

In short, the device's direction cannot be judged from the recorded value.

Compared to the device, the same thing will happen not only for a magnetic field that is perpendicular but for a magnetic field facing any direction.

In this picture, compared to an arbitrary magnetic field, the magnetic sensor is rotated one time as shown in the frame, but the magnetic field's recorded value (Hx, Hy, Hz) won't change at all.

In other words, there are an infinite number of magnetic fields with the recorded value (Hx, Hy, Yz) that was recorded and there is no way to tell whether the device is facing north or east.