Magnometer off by 180 degrees

I have followed the instructions on for adding the Magnometer directly to the APM board in the components down pins forward orientation. I have the APM board mounted according to where the RC pins are towards the back of ArduCopter and which places the Magnometer on the "front". I have an X configuration with the APM pointed between the 2 legs.


I noticed in the Mission Planner that the HUD shows the ArduCopter pointing S when it's really pointing north. Moving the ArduCopter shows the heading changing the correct amount but always off by 180 degrees. I guess what I am doing is looking to confirm that I actually have assembled things correctly. For reference I am using


I would appreciate any suggestions on what I may have done incorrectly.

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

Join diydrones

Email me when people reply –


  • Did you run an offsetts calibration? it helped us.

    1; switch to CLI

    2. Setup

    3: offests

    4 now turn your copter over every axis up side down until the numbers do not change anymore. make sure you have your copter a few times in any attitude possible upside down allso.

    5. hit enter


    now check again.


  • I have been running from SVN anyway since I needed to change INPUT_VOLTAGE for the battery monitor, so it wasn't too much to make these changes.

    When I tried the following, the heading started around 60 degrees and only changed +-30 when rotating the copter full around.

    #define MAG_PROTOCOL       MAG_PROTOCOL_5883L

    So I commented out the MAG_PROTOCOL, but left the orientation, and that seems to work correctly. Hand rotating the copter produces the expected results and North is North!
    Just to be complete, the change that worked for me was to define only:

    I bought my HMC5843 on 5/5.

    Thanks again for the help. I have been reading the forums here for awhile and it's great to see so many people
    willing to help. I hope that I will be able to start contributing back someday soon.
  • 3D Robotics
    It appears that the new magnetometers (which have switched one orientation) started shipping earlier than we expected. The dev team is hard at work at updating the code to autodetect which version mag you've got and correct accordingly, but this may take a day or two. Sorry for the inconvinience, but stay tuned!
  • Developer


    hmm, you might not have done anything wrong.


    You've got the new magnetometer and the orientation of the chip is different compared to the old one but I suspect that the code that's being downloaded by the APM Mission Planner assumes you have the old mag.

    You are loading the code with the mission planner right?  You don't have the ability to download the code directly from SVN and modify your APM_Config.h file right?  If you did you could add a couple of lines like:

    #define MAG_PROTOCOL       MAG_PROTOCOL_5883L

    I think we will need to add some more download options from AP Mission Planner or something!
This reply was deleted.