MPU9250 Tilt compensation

Hello everyone, I bought an MPU9250 with the idea of being able to locate the north of the Earth regardless of the inclination of the sensor. I have seen at https://www.instructables.com/id/Tilt-Compensated-Compass/ that it is possible, but still following the steps I still can't get it to fit well.

Has anyone worked with this IMU before and know how to do this? I'm with an Arduino NANO at 16MHz (supposed).

Thanks in advance.

Magnetometers don't work out of the box as a North reference, so it is essential to calibrate them. The procedure described in the Instructable does not work very well. A much better procedure is described in this tutorial.

You'll find code to assist in that process and also much simpler code for a tilt-compensated compass at GitHub - jremington/MPU-9250-AHRS: Arduino Mahony AHRS, includes magnetometer and accelerometer calibration code.