Testing my code for the HMC5843 turns out that the labeling for the axis may be wrong. The sign directions are different too. I checked against the Board from Sparkfun. Looking at the datasheet, the components axis described there are when you look at the bottom of the device. The schematic pictures is mirrored upside down to show a view from the top.
Tags:
Yes, I believe you are correct. You're not the first one to find this problem but you are the first one to illustrate it with a picture so clearly! It's up to Jordi to fix this one on an upcoming batch.
Of course I don't know exactly how you're using the compasses, but if you're using Arduino + the AP_Compass library then the orientation can be set with the set_orientation call and there are a bunch of predefined constants for both boards which makes it easy to get it working properly.
https://code.google.com/p/arducopter/source/browse/#svn/trunk/libra...
https://code.google.com/p/arducopter/source/browse/trunk/libraries/...
Permalink Reply by Uwe Gartmann on December 14, 2010 at 5:58pm Hi Randy,
I watch the code very close :-)
Honestly, the code for the magnetometer has never been official released yet. There is more than just a readout from the adc.
Can somebody explain me why the X and Z axis in the AP_Compass_HMC5843.cpp has different Signs (-)?
{
// MSB byte first, then LSB, X,Y,Z
mag_x = -((((int)buff[0]) 8) | buff[1]) * calibration[0]; // X axis
mag_y = ((((int)buff[2]) 8) | buff[3]) * calibration[1]; // Y axis
mag_z = -((((int)buff[4]) 8) | buff[5]) * calibration[2]; // Z axis
last_update = millis(); // record time of update
}
Is this not covered by the declaration of the orentiation of the sensor?
Permalink Reply by Fabio Varesano on December 14, 2010 at 7:03pm They are probably aligning the HMC5843 axis to those of the accelerometer and gyro.
Negating X and Z is like making a 180deg rotation around the HMC5843 Y axis.
Permalink Reply by Uwe Gartmann on December 15, 2010 at 4:06am Ok, I see. It corrects wrong axis when you mount the board direct on the shield (see wiki).
ok - good point about being able to use the orientation instead of the -ve on x & y. Nothing's broken but perhaps it's unnecessarily confusing.
I'll give that a go (unless someone else wants to fix it an send me the changes!).

Jordi is aware of this cosmetic issue and will correct in the next version.
Permalink Reply by Uwe Gartmann on December 15, 2010 at 3:51pm Perfect.
Please put a small note to the current documentation.

Permalink Reply by Darren on December 15, 2010 at 3:58pm Please note, you have v1.1 pic which is also different from the previous ver. which I have that has two removable sides. (4 holes)
Also, did you notice that your right hand digram is inverted? Also in that diagram is an X vs. a Dot which indicates out rather than in... or up vs down I believe.
Permalink Reply by Luis Mauro on January 2, 2011 at 6:51pm 
Permalink Reply by Luis Mauro on January 2, 2011 at 7:44pm Hello Chris
Thank you for your reply. I´m using the wire.h library (Arduino's regular library).
The code is attached (Compass.txt) that is a modified copy from ArduIMU code (by Jordi Munoz and William Premerlani, Supported by Chris Anderson (Wired) and Nathan Sindle (SparkFun).
I only made small modifcations to run the code alone and no tilt compensated.
During the test I keep HCM5843 board with roll and pitch angles equal to zero and fixed yaw (no movement, static).
I took this board (http://store.diydrones.com/HMC5843_Triple_Axis_Magnetometer_p/br-hm...) because it works with 5V devices, I believe that no level conversion is necessary.
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.688 members
185 members
24 members
51 members
1295 members
© 2013 Created by Chris Anderson.
Powered by
