This paper presents the principle of the proposed elliptical fitting calibration algorithm and compares it to the published ellipsoidal fitting algorithm for correcting the orientation of magnetic measurement, yaw angle. Two algorithms are implemented on a real device which is the magnetometer in an inertial measurement unit (IMU) that is applied to validate the effectiveness of the 2D calibration method. The validation considers the accuracy of the yaw angle with the stepper motor generating the referred angles. It could be noted that the 2D-calibration algorithm can be implemented and be made compatible with the autonomous mobile robot using the data acquired from the magnetometer and IMU for determining the accuracy yaw angle. The result of the comparison to the referred device’s calibrated data assures the potential for subsequent supervising or controlling processes.