I have a magnetometer from where I get X, Y and Z which point to the direction of the detectable magnetic fields.
I'm using these values to get the angle between X and Y using atan2. I am a bit suprised of the result because North is not "aligned" with South. In fact there is not an angle of 90° between any "axes" (N, S, E or W). I can reproduce it with my phone. Can someone explain me why ? Am I Wrong ? Am I missing something ?
In fact my real problem is that my angle is not "linear". For example, in the image below, between North and East, with atan2 I get 270° which is obviously wrong regarding to the direction.
Here below, what it looks like :
magnetic cardinal points
Edit :
My magnetometer is a IIS2MDC mems from STMicroelectronic. I am getting values from registers with a nordic MCU (but it would be the same with a ST MCU)