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.

 

Views: 1306

Reply to This

Replies to This Discussion

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/...

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?

 

 

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.

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.

Perfect.

Please put a small note to the current documentation.

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.

Hello dears

I would like to report a problem that I'm having with the HCM5843 from DIY Drones.
I connected the HCM5843 board to Arduino´s Duelmilanove I2C (pins A4=SDA and A5=SCL). The code that I´m using is copy from ArduIMU ("Compass").
When I turn on the Arduino and the HCM5843 boards, everything works good, but after ~30 seconds the heading value become crazy (oscillating to much). The HCM5843 and Arduino both are working with 5V.
The problem I described above is similar to the reported by Fabio Varesano on the Arduino forum: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291403700
Pull-up resistors: I've tried no pull-up resistor and values of 10K, 3.3K 4.7K and it works stable for a little more time with high values pull-up resistors.
Luis, I'm not sure our libraries will work on regular Arduino boards. We don't see any problems with the magnetometer on APM boards.

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.

 

Attachments:

RSS

Social Networking

Contests

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.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service