Compass Module with Tilt Compensation - HMC6343

The HMC6343 is a solid-state compass module with tilt compensation from Honeywell. The HMC6343 has three axis of magneto, three axis of accelerometer, and a PIC core running all the calculations. What you get is a compass heading over I2C that stays the same even as you tilt the board. Solid-state (and many classic water based) compasses fail badly when not held flat. The tilt compensated HMC6343 is crucial for those real-world compass applications. Who says robots have to stay flat?

  • I2C interface
  • 2 degree heading accuracy
  • All in one compass solution
  • Compass heading and tilt outputs
  • 0.8x0.8"

Compass Module with Tilt Compensation - HMC6343 Product Help and Resources

Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • FreeGroup / about 15 years ago * / 3
    ------------------------------------------------
    Arduino Header HMC6343
    ------------------------------------------------
    #ifndef HMC6343_h
    #define HMC6343_h
    /**
     *  analog input 5 - I2C SCL
     *  analog input 4 - I2C SDA
     **/
    class HMC6343
    {
      private:
        // I2C Client Address of the sensor
        const static int i2cAddress= (0x32 >> 1);
        HMC6343(){};
      public:
        static int getAngle();
    };
    #endif
    ------------------------------------------------
    Arduino CPP Code HMC6343
    ------------------------------------------------
    #include "WProgram.h"
    #include
    #include
    #include "HMC6343.h"
    int HMC6343::getAngle()
    {
       byte headingData[6];
       Wire.beginTransmission(HMC6343::i2cAddress);
       Wire.send(0x50);
       Wire.endTransmission();
       delay(2);
       Wire.requestFrom(HMC6343::i2cAddress, 6);
       int i = 0;
       while(Wire.available() && i < 6)
       {
         headingData[i] = Wire.receive();
         i++;
       }
       return (headingData[0]*256 + headingData[1])/10;
    }
    
  • captain_obvious / about 11 years ago / 1

    Hi!

    Hope this might prove itself useful for somebody.

    I wrote a library to simplify using this with the arduino, have a look at my github: https://github.com/n-ovesen/hmc6343/blob/

    and please let me know if you find some bugs

  • Member #138408 / about 12 years ago / 1

    How do these perform with vibrations?

    • Mr.Thermistor / about 12 years ago * / 1

      I tested this chip with vibration from a diesel engine at various RPMs and it faired poorly. The heading varied by +/- 15 degrees at times. It behaved similarly when I repeatedly bumped the wooden test bench it was mounted to. I tried different mounting methods, including using vibration dampening gel tape (used in RC helicopter gyro mounts) but nothing seemed to make much difference.

      The 2 dimensional HMC 6352 was much more vibration resistant but of course it suffers significant accuracy loss when tilted more than a few degrees.

      After testing several other accelerometer + magnetometer solutions for vibration sensivity, I came to the conclusion that a gyroscope was a necessary component. I ended up using the CH Robotics UM6-LT which has a gyroscope. It has been extremely vibration resistant, and was similarly priced to the 6343.

  • Member #269521 / about 12 years ago / 1

    I have two questions regarding the HMC6343.

    1) I understand that the x, y, and z magnetic field readings are each returned as 2 byte value. What are the units for these values? How can I convert them to more familiar units, such as Gauss?

    2) The temperature reading is also a 2 byte value. How can I convert this to degrees C?

  • Member #238923 / about 13 years ago / 1

    could you please send me example AVR code?
    mersi
    turlan1979@yahoo.fr

  • herctrap / about 13 years ago / 1

    can you add the breakout board to the SFE Eagle library please?

  • Member #159115 / about 13 years ago / 1

    Is this supposed to have a temperature dependence?
    I tried testing this over a range of temperatures using a peltier cooler and ended up getting a linear temp dependence.

    • phil3 / about 13 years ago * / 1

      The peltier cooler is a current device. Temp depends on current, more current also means higher local magnetic field. Could it be that your "temp dependance" is actually due to the magnetic field of the current through the peltier device?

  • Member #209893 / about 13 years ago / 1

    Does anyone know if this comes with the board as shown in the image?

    • Member #167287 / about 13 years ago / 1

      I bought this and board is red, not the same as pictured. I couldn't get it working with arduino uno and we are trying to figure out with sparkfun support.

      • JayKay / about 13 years ago / 1

        Did you end up sorting this out? I ordered this part too and !would like to know if it will work with my Uno before I begin. Thanks

  • mbrown9412 / about 13 years ago / 1

    Why is this so gosh-darned expensive compared to all the other compasses you have? all the other bobs hover around 30 bucks or so. what does this one have over those?

    • Member #167287 / about 13 years ago / 1

      This gives all euler angles in one compact unit with 3 axis compensation. Same thing like imu9 which has similar price.
      I got this unit but unfortunately does not run with arduino uno, still waiting for support to figure it out.

  • Member #167287 / about 13 years ago / 1

    Can someone post Arduino Uno code for this item? I can't get this working although my code looks right and I asked sparkfun to try and they seem to get nothing with my code.
    I have this which doesnt work

    include

    define compass_ADR (0x32>>1)

    byte data[6];
    int x;
    int y;
    int z;
    void getHeading()
    {
    Wire.beginTransmission(compass_ADR);
    Wire.send(0x50); // command
    Wire.endTransmission();
    delay(5);
    Wire.requestFrom(compass_ADR, 6);
    for (int i=0; i

  • Member #167287 / about 13 years ago / 1

    are there any socket/connectors for this?

  • ralewis / about 13 years ago / 1

    I've run into a problem with the sensor where it does not cleanly detect a 360 degree rotation. The sensor seems like it gets 'stuck' at a certain angle and then makes a large jump to catch up. I'm thinking the sensor might have become magnetized. Has anyone else run into this problem?<br />
    <br />
    The datasheet says to degauss the sensor if this happens, but doesn't explain how to degauss the part. Is the degaussing part supposed to be common knowledge, or is there a specific way to perform it with this sensor?

  • NikitaB / about 14 years ago / 1

    FSD Penguin
    Perhaps you can help me out with a bit of this code as well. It seems as though >int slaveAddress> and have to be dimensionalized.
    I am using this code for autonomous navigation and when I placed it into the header file and into the main header, then I still had to create those two variables because they did not exist. In the header file, they are private.
    So my question is, then what does one set the address to? I have it set to
    Thanks

  • lguy2000 / about 14 years ago / 1

    In the code example provided below (thank you!!!) I noticed that the wire.send is for 0x50, whereas the documentation specifies 0x32 for the heading. Can anyone clarify this? Thank you again.

    Arduino CPP Code HMC6343

    include "WProgram.h"

    include

    include

    include "HMC6343.h"

    int HMC6343::getAngle()
    {
    byte headingData[6];
    Wire.beginTransmission(HMC6343::i2cAddress);
    Wire.send(0x50);
    Wire.endTransmission();
    delay(2);
    Wire.requestFrom(HMC6343::i2cAddress, 6);
    int i = 0;
    while(Wire.available() && i < 6)
    {
    headingData[i] = Wire.receive();
    i++;
    }
    return (headingData[0]*256 + headingData[1])/10;
    }

    • FSDPenguin / about 14 years ago / 1

      i just got the chip a week or 2 ago and haven't powered it up but i hope i understand the coding example from FreeGroup.
      it appears that the 0x32 (pg 9 tbl 1) is the I2C address that is being queried based on the documentation. this value is stored in the H file with
      const static int i2cAddress= (0x32 >> 1);
      once that address is being communicated with the 0x50 (pg 10 Tbl 2) command is sent to request data
      Post Heading Data. HeadMSB, HeadLSB, PitchMSB, PitchLSB, RollMSB, RollLSB
      hope that helps. i will try it in the next few days and see if i really do understand it.

  • There's some code to interact with this module from an embedded X86 board running XP or Linux called RoBoard here

  • Buzz / about 14 years ago / 1

    85958: _
    ...and if anyone is wondering im building an autonumus quad rotor ..._
    Hi!
    I am also building my own autonomous quad rotor, I would like to get in contact with you if you are interested to share few ideas...
    my e-mail: buzzo182@hotmail.com
    Let me know!

  • roycohen2013 / about 14 years ago / 1

    can you guys tell me what calculations are needed for the tilt compensation because i have the razor 6dof imu and probably getting the 3 axis magnometer so how do i use the accelerometer to do compensation for the compass
    and if anyone is wondering im building an autonumus quad rotor

  • PeterM / about 15 years ago / 1

    Does anyone know if this device is officially 5V I/O tolerant? The datasheet has no useful electrical specification data

  • David Gitz / about 15 years ago / 1

    I couldn't find this in the datasheet, but does this output pitch and roll tilt angles? Or just 1 tilt output?

    • Jollian / about 15 years ago / 1

      On page 10 of the datasheet - the command table shows you what data it can output.
      Pretty cool as you can get raw data from the 3D magnetometer, 3D Accelerometer as well as the pitch & roll angles - oh, yeah, and also the compass heading :P

  • Darron / about 15 years ago / 1

    Has anyone gotten this compass to work with the Devantech usb-i2c module? After frustrated coding, and finally scoping the data and clock lines, my conclusion is that this compass utilizes clock stretching which the Devantech module does not support. I would love to hear otherwise, if anyone has gotten it to work. Thanks.

  • Hey p07gbar I'm using this device with 5v output from my arduino and it's running fine.
    And syvwich, yes, I do believe that that's what the cap is and that's what it is for as recommended in the HMC6343's datasheet.
    Lastly, this thing is fun and easy to work with, but I may have accidentally reset my hard iron offsets because my compass heading is giving me errors. The tilt and pitch are fine though.
    Thanks for breaking this out Sparkfun!
    -bg

    • c9brown / about 13 years ago / 1

      What are you talking about? The data sheet clearly says 3.6V max.
      I'm now afraid I've blown my chip listening to commenter advice. It never seems to send any data back i.e. Wire.available() never becomes true.

    • joachim / about 15 years ago / 1

      BilalGhalib,
      Can you share the arduino code with us?

  • p07gbar / about 16 years ago / 1

    Can this chip cope with a +5V input for control logic?
    Thanks

  • Syvwlch / about 16 years ago / 1

    Hi there,
    Could you please confirm that the small surface mount component to the left of the chip is a 1uF capacitor to eliminate noise from the power supply?
    If it is not, could you say what it is, and what it is for?
    Thanks!

Customer Reviews

No reviews yet.