Contents
Is there a way to calibrate a magnetometer?
For capturing I used the M5Stack MPU9250 4MB which as the name suggest has a MPU-9250 9DOF sensor inside. MPU-9250 is a System in Package (SiP) which combines two chips: MPU-6500 which contains 3-axis gyroscope and 3-axis accelerometer and an AK8963 which is a 3-axis digital compass.
Are there any problems with using a magnetometer?
There is one problem though, magnetometers are prone to distortion. The magnetic field used for determining the heading is the earth’s magnetic field. In addition to earth’s, there are additional magnetic fields which cause interference.
What causes interference in the magnetic field of a magnetometer?
The magnetic field used for determining the heading is the earth’s magnetic field. In addition to earth’s, there are additional magnetic fields which cause interference. Interference can be caused by ferromagnetic material or equipment in the magnetometers vicinity. If the magnetic field is permanent it is called “hard iron”.
How often should a magnetometer rotate around the axles?
The sensor should rotate multiple times around the X, Y and Z axles. After approximately 1-2 minutes of waving, copy paste the sensor readings from the console to a csv file. Let’s call it magnetometer.csv. The more data you capture the better. Gnuplot is an excellent cross plaform command line graphing utility.
How to calculate the heading of a magnetometer?
Now a simple heading calculation according to journal_of_sensors_renaudin et al_2010c.pdf should have been MAG_Heading = atan2 (-magnetom_y, magnetom_x) ; and with compensation as above. Overall code is simply from OPEN AHRS. Data in format Roll, Pitch and Yaw.
What kind of magnetometer is a hard iron?
If the magnetic field is permanent it is called “hard iron”. For example a mobile phone has a speaker. The speaker is permanently attached to the phone. Because of this the location and the orientation of the speakers magnetic field does not change over time. For the magnetometer inside the phone the speaker is considered hard iron.
What kind of Speaker does a magnetometer use?
For the magnetometer inside the phone the speaker is considered hard iron. Good thing about hard iron bias is that it can be easily corrected. Hard iron distortion is always additive to the to the earth’s magnetic field.