Page 1 of 1
MAG sensor orientation - how?
Posted: Mon Jun 20, 2011 6:23 pm
by Hamburger
Hi,
I found info on how to setup the gyro and acc orientation with the feedback from GUI.
But how do I find out the MAG orientation? I can see the values in the GUI change when I rotate the copter, but how do I translate that into the X,Y,Z orientation?
I have a freeimu v.01 with hmc5843. The gyro and acc are setup already.
Thanks, Hamburger
Re: MAG sensor orientation - how?
Posted: Mon Jun 20, 2011 10:52 pm
by Alexinparis
Hi,
Z MAG should be positive and not move a lot if the multi remains flat.
X MAG: ROLL RIGHT = positive; ROLL LEFT = negative
Y MAG: PITCH FORWARD = positive; PITCH backward = negative
Re: MAG sensor orientation - how?
Posted: Mon Jun 20, 2011 11:47 pm
by Hamburger
thanks.
Then the submitted code fragment for FREEimu v01 is correct.
Re: MAG sensor orientation - how?
Posted: Mon Aug 01, 2011 10:39 pm
by skygizmo
Hi
have a question about the MAG sensor.
if I activate the MAG sensor on the front boom pointing north. if the wind turns towards north-west quad, then of course the quad to turn towards the north again.
What would happen if I activate the MAG sensor on the front boom pointing towards the north-west? and the wind driving it toward the south, it will then turn towards the north-west again?
it means that the front beam is locked to the compass directions in which MAG sensor is activated?
thanks in advanc
Re: MAG sensor orientation - how?
Posted: Tue Aug 02, 2011 8:44 pm
by Alexinparis
The important thing is not the absolute direction of the arrow, but the difference to the direction at the time the MAG was activated.
This difference is computed to be a -180;+180 angle difference and this is the input for the mag correction.
Re: MAG sensor orientation - how?
Posted: Mon Feb 27, 2012 6:39 pm
by Sven
Alexinparis wrote:Hi,
Z MAG should be positive and not move a lot if the multi remains flat.
X MAG: ROLL RIGHT = positive; ROLL LEFT = negative
Y MAG: PITCH FORWARD = positive; PITCH backward = negative
Sorry for dragging this old cow ashore again, but it seems ive run into a bit of trouble.
I suspect despite running the numbers like mentioned above, something is amiss orientation wise.
Unless its normal for a magnetometer to completely lose its marbles after being tilted >10' ?
Im running a HMC5883L mag, on dev_20120225 firmware.
The mag behaving so dodgy in the winGui makes me hesitant about flipping it into headfree mode.

Re: MAG sensor orientation - how?
Posted: Thu May 31, 2012 9:21 pm
by Tommie
I am having the same issues. The compass goes completely bonkers once I tilt the copter by more than a few degrees. Any ideas?
Re: MAG sensor orientation - how?
Posted: Thu May 31, 2012 9:28 pm
by Katch
Tommie wrote:I am having the same issues. The compass goes completely bonkers once I tilt the copter by more than a few degrees. Any ideas?
Some sort of electromagnetic interference. I get this on 3 out of 4 MWC flight controllers I own.
The best one has the IMU mounted on 8mm nylon pillars over the top of the FC. Try getting a little more distance between the frame and the mag if possible in your setup.
Re: MAG sensor orientation - how?
Posted: Fri Jun 01, 2012 3:33 pm
by Tommie
I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.
Re: MAG sensor orientation - how?
Posted: Fri Jun 01, 2012 3:42 pm
by Katch
Tommie wrote:I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.
try it on a longer lead well away from frame an power source. If it still plays up you could have a duff sensor.
Re: MAG sensor orientation - how?
Posted: Fri Jun 01, 2012 5:26 pm
by LenzGr
Tommie wrote:I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.
What exactly do you mean by "MAG going crazy"? Do you see noise on the three axis? Or is the compass simply spinning quickly and no longer indicating the proper orientation? Is the compass code actually tilt-compensated to cope with this?
Re: MAG sensor orientation - how?
Posted: Fri Jun 01, 2012 6:04 pm
by Tommie
The compass deviates from the original direction. But I found the issue, changing the direction of the MAGs Z axis fixed it.