I am using the BMM150 on a waveshare module (https://www.amazon.de/dp/B0C4TSB47S) under Python (code below).
Data seem to be coming out ok, like:
X:36.325 µT Y:0.000 µT Z:48.786 µT Magnitude:60.825 µT Heading: 86.349 DEG
The chip is oriented so that the X-direction (as printed on the PCB) is pointing due North.
I do expect this to give a heading of 0 (zero) degrees, yet it is giving 86.3°, which I take as 90°.
Do I use wrong code, or am I mistaken on my interpretation?
Code used:
import numpy as np
import bmm150
device = bmm150.BMM150()
x, y, z = device.read_mag_data()
heading = np.degrees(np.arctan2(x, y))