Problems with HMC5883L

Hi,

You don't have to go outside. In an ordinary house, you can do calibration. I did it, and the sensor work nicely.

You have to take readings at 0°,90°,180° and 270°. Base on these numbers you have to find a correction factor to include in the formula.

For my sensor, I have to use the following correction factor for "Y" (+10):

float heading = atan2(y + 10, x);

Of course, every sensor will have a different correction factor for Y or X.