HMC5843 3 axis Magnetometer wrong axis labeling

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.


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • What exactly do you mean when you say that there is lot of work?

    Hi Fabio,


    Well, when you get older many things get more and more complicated :-)

    The days I started my programmer career as hobbiest, DOS 3.1 was cutting edge technology.


    Calculating 3D vectors and such thing are very new to me. Reading source code of others and googling for education videos helps me to understand a bit more.

    I found out that I have to calibrate values from the sensors to get valid results on the processing code.


    Thanks to everybody helping with information and knowhow here!

  • Chris,

    I already double checked the solder jumper, It´s connecting the center pad with the pad labeled 5V.

    I´ll record the values supplied by the board and show in a time-stamp graph for a better understanding of the problem.

    I´m thinking to make a non-sense trying: set-up the 5843 board to 3V and connect to the Arduino board through a logic level converter (Sparkfun)!



  • 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:
    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.
  • 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.

  • Developer

    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.


This reply was deleted.


sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19