Mag + Gyro correct directions AND MagZ axis question

Hi,

can someone confirm that I put the orientation of my IMU right.
IMU: http://www.ebay.de/itm/New-10DOF-9-axis-Attitude-Indicator-L3G4200D-ADXL345-HMC5883L-BMP085-Module-/350646462688?pt=LH_DefaultDomain_0&hash=item51a42868e0#ht_4341wt_1166

Mag:

  • If I point X to North and turn it right, MagX decreases. So MagX=MagX*-1 , correct?
  • If I point Y to North and turn it right, MagY decreases. So MagY=MagX*-1 , correct?

Gyro:

  • If I point X(front) upwards, AccX raises. So AccX=AccX, correct?
  • If I point Y(front) upwards, AccY raises. So AccY=AccY, correct?
  • If I pint Z up, the value is negative. If I point Z down it is negatve. So AccZ=AccZ*-1, correct?

Regarding MagZ: I point it North (IMU 90° tilt - so upside north) and I get positive values. I turn it right 360° but the values always stay positive.
The only way to get negative values for MagZ is if I point it 45° down and North .
What am I doing wrong here? How do I find the correct orientation for MagZ?

Thanks
Robert

I suggest you look at how the earth's magnetic field works. It depends where you are.

The lines of the earth's magnetic field head generally in the direction of the north magnetic pole
and they also point down into the ground ( or out of the ground ). The readings from the magnetic
sensor form a vector which shows the direction of this field. When you wave the device around, this
vector will always point in the same physical direction, but its apparent coordinates in terms of the
nominal axes of the device will seem to change, as you move those axes around.

If you hold the device so that one of the axes of the device is aligned with the earths magnetic field,
then the vector coordinate for that axis will be maximum and the coordinate for the other two axes
will be close to zero.

The different sensor devices on your board are not necessarily all aligned the same way. If they are not,
you just swap the coordinates in your code so they are.