Firmware: Magnetometer - ImpulseRC/OSD GitHub Wiki
Introduction
ImpulseOSD supports a variety of Magnetometers which typically come with your GPS module. Simply connect it via i2c (SDA to SDA and SDL to SDL) it will be automatically detected.
Hardware support:
- HMC5883L
- QMC5883L
- IST8308
- LIS3MDL (implemented, but not tested)
Magnetometer is completely optional - but recommended for GoPro Finder
It is not necessary to use a magnetometer for the home arrow or compass direction to work. With ImpulseOSD V39.12 or higher you have the option to "Trust" your magnetometer - in that case it will always use the mag data which results in a faster and smoother home arrow! Only activate the "Trust" option if you are 100% sure your magnetometer works correctly! Using a magnetometer involves several steps of manual calibration for it to work correctly. We strongly advise not to use a magnetometer if you are a beginner or this already sounds too complicated for you.
Attention CRSF/SBUS users: If you are not using a KISS or BF FC it is not recommended to use a Magnetometer. The tilt correction won't work (since we cannot get the accelerometer data from the FC) so the mag will only display the correct heading if it is level to the ground.
Mounting your GPS/Mag module
For Magnetometer use we recommend mounting the module so the arrow or notch on the module points towards forward flying movement. You can also mount the module 90 or 180 degrees rotated, however that will require a change in the Magnetometer configuration further below.
Magnetometer configuration
Enter the menu (yaw left while disarmed for more than two seconds), go to SETUP and then GPS and then MAGNETOMETER
- COMPASS FLIP: If your arrow is pointing away from you, try turning the compass flip on.
- MAGNET DECL.: Magnetic declination in Degrees. Find out your magnetic declination parameters here.
- MAGNET DECL.: Magnetic declination in Minutes. Find out your magnetic declination parameters here.
- MAGNETOMETER CALIBRATION Starts the Magnetometer calibration. Please read the instruction below for a proper calibration!
- TRUST MAGNET.: OFF: The magnetometer data will only be used for the compass label if the GPS is below 10 kph. ON: The magnetometer data will be used at all times. Double check that your home arrow is pointing in the right direction! Follow instructions below!
- TRUST MAG RTH: OFF: GPS course will be sent to KISS for RTH. ON: MAG data will be sent to KISS for RTH. Double check that your home arrow is pointing in the right direction before you activate this setting! Follow instructions below!
- SAVE+EXIT: Save all changes (and also changes made in other menus except the VTX menu) and exit the menu.
- BACK: Go back to GPS Menu. Changes are not discarded, but they are not saved until you exit with SAVE+EXIT from any menu.
Magnetometer support
Setting up the magnetometer requires a calibration, and a manual correction using the magnetic declination parameters. If you choose to connect your magnetometer we strongly recommend that you double check it is pointing the right way no matter how you turn your quad.
Magnetometer Step 1: Configure tilt correction
Enter the menu (yaw left while disarmed for more than two seconds), go to SETUP, then GPS and finally MAGNETOMETER.
ImpulseOSD needs to know at what angle you have your magnetometer tilted, so please enter the value under TILT CORRECTION. Default is 0 degrees which assumes it is mounted parallel to the FC.
Magnetometer Step 2: Calibration
For the calibration to work, you must activate the Accelerometer on your FC. For KISS you don't have to do anything, BF users must activate the Accelerometer in the Configurator!
Enter the menu (yaw left while disarmed for more than two seconds), go to SETUP, then GPS and finally MAGNETOMETER.
Roll right on MAGNETOMETER CALIBRATION and turn your quad slowly multiple times around all 3 axes: Roll, Pitch and Yaw. You have 60 seconds to complete the calibration. Magnetometers tend to have different readings when they warm up, so doing the calibration twice sometimes yields better results.
Magnetometer Step 3: Magnetic declination and offset correction
Now that the tilt correction and calibration is set properly, we need to double check if the magnetometer displays the correct heading. Move your quad to an area with little magnetic distortions (go out in a field) and align it on the ground to a certain heading (e.g. 0 degrees or 180 degrees) using the compass app on your phone or any other compass you trust. Do not hold the phone/compass too close to your quad/magnetometer as this can cause interference and cause your phone and magnetometer to report false readings!
Enter the menu (yaw left while disarmed for more than two seconds), go to SETUP, then GPS and finally MAGNETOMETER.
First you should enter your magnetic declination settings as a baseline, you can find them here. On the bottom of the screen it will show the current heading under COMPASS RAW DEGREES. You can use this as an aid to correct the compass offset. Use the MAGNET DECL. adjustments to correct the heading value so it corresponds with your reference compass (e.g. phone compass app). The upper adjustment is a course adjustment, the lower a fine adjustment.
Once you have aligned the magnetometer, turn your quad to a different heading and double check again with your reference compass.
If you are sure that the magnetometer shows the right direction even if you tilt your quad slightly and point it in different directions - you can activate the option TRUST MAGNET. That will drastically speed up your home arrow. Fly around yourself in close range and double check if your home arrow points towards home. If your home arrow points correctly home in all situations then you can activate the TRUST MAG RTH setting - then KISS/BF can take advantage of the mag data as well.