#Magnetometer north issue

1 messages · Page 1 of 1 (latest)

fickle trellis
#

Hi
I'm having an issue, that the magnetometer always sets north into the direction, the drone is facing when i plug in the battery. This then confuses the position hold flight mode. If i point the drone north and plug in the battery the position hold works, but if i point it in any other direction while pugging in the battery, the drone flys off at a werid angle in position hold mode. The Mag alignment should be correct, the magnetic declination is set and i have calibrated the sensor several times. Could this be a bug on the firmware side or am i setting up something wrong?

@urban owl do you maybe know what this could be?

urban owl
#

The default angle is set to North at power up when there is no Mag available. It sounds like your Mag is not working at all. Did you check the Mag in Sensors? There is info in the Betaflight.com site about how to check it.

fickle trellis
#

i checked the betaflight wiki again and my settings should all be fine. i see in the configurator, that the mag is detected (QMC5883), the values in the sensors tab also change, when i move the quad, i did the calibration again according to the betaflight wiki, but the angle is still set to north at power up... i'm not sure what i can try next.

urban owl
#

Thanks for sending the images and your confirmation.
If you go 'status' in CLI what does it say?

Pls check the map in the GPS tab. If Mag is working, and you have valid GPS, the icon representing the quad points north (or the map rotates so north is up, I forget which).

If, in the CLI if you go get mag_calibration what does it return?
If in CLI the get mag_calibration request returns 0,0,0 then the calibration is failing to complete. The sensor will still report values, but the Mag data will not be used.

Note that if you use stick commands to calibrate gyro, they will also recalibrate Mag, and typically if the quad is held 'still' at that time, the Mag Cal will fail.

You can hack the cal by entering fake cal values set mag_calibration = 1,1,1
That should test whether a failed calibration was the cause, but then the returned heading is likely to be incorrect.

ripe veldt
#

can you make sure your mag is configured correctly and you can use the setup page iirc to see the actual degrees and compass direction your drone is pointed at. lmk if this works

fickle trellis
#

thanks for your help.
In the GPS tab, the icon representing the quad turns, when i turn the quad (the map is fixed with north up). Unfortunately north is still set, where the quad is pointing at system boot. It doesn't make¨any difference, if i set the mag_calibration to 1,1,1 or use my values from the calibration. I did the calibration with stick commands and also tried it with the cable attached to betaflight configurator. neither of the methods solved the issue.

the orientation of the mag chip was sketched up by hand and then rechecked with the INAV alignment tool (configurator in demo mode) and they matched, so i think this should be correct.

urban owl
#

Thanks for all that detail.
I’m not entirely sure but my experience is that if the quad always points North it implies the mag is not being used at all.
Can I check that your setup has only one i2c device (no Baro, for example, since only one is detected.
Otherwise it does seem that mag is detected so it should work, or at least it should reset the heading away from North to wherever the mag data says North is.
It won’t fix your problem but
The mag chip is upside down on the bottom of the gps board, when the gps is mounted with the ceramic antenna (the brown flat thing) uppermost. So it would require a flip orientation
Maybe temporarily make it ‘flat to the fc and set the orientation to an inverted one. Then go to sensors tab and look at Mag values. Use your phone to determine where magnetic north is. Find out what your inclination angle is - if in Northern Hemisphere it will be downward into the ground. Point the quad down and into the ground at that angle and North. Then the X value should be maximally positive (say1500) and the Y and Z values much lower. That’s what you get when the orientation is right.
If you see that consistently in sensors then the data is coming in. Obviously if all is good, when the left side of the quad points due North, and at the correct inclination angle, it you should see max to the same amount as x did, and x goes to zero region. Likewise if the top of the quad points into the magnetic field vector and north, Z should be max and y,x close to zero.
Wh