Xadow - Compass

Introduction

Xadow Compass is a 3-Axis Digital Compass which is a member of Xadow family. The module is based on a low field magnetic sensor HMC5883. It features 1° to 2° compass heading accuracy, and it is using I2C serial bus to communicate with your microcontroller. Xadow Compass is a useful tool for helping you to get the direction information.

Specification


  • Working voltage: 3.3V
  • Linearity: 0.1(Max) ±% FS
  • Resolution: 10 milli-gauss
  • Mag Dynamic Range: ±1 ~ ±8 gauss
  • IIC Address:
  • 7-bit address: 0x1E
  • 8-bit read address: 0x3D
  • 8-bit write address: 0x3C
  • Operating Temperature: -30 ~ +85 °C
  • Dimensions: 25.43mm x 20.35mm

Demonstration


This demo is going to show you how to read raw data, how to calibrate the data with your local magnetic declination angle and how to get heading angle.

Get the local magnetic declination

Firstly, before any action you are going to take, you need to prepare a parameter you are going to use in your demo. That’s your local magnetic declination. - You can find it out in degree via the magnetic declination webpage. For example, mine is -2°37’, which is -2.617 degree. - Then transfer it from degree to radians, and there you get the “declinationAngle”. For example, in my case, declinationAngle = -2.617 / (2*π)= -0.0456752665 rad. Three significant figures are enough. So I would shorten it into -0.0456 rad. And this is the parameter you are going to replace the value of “declinationAngle” in the demo code with.

Note

When connect Xadow Compass to Xadow Main Board, you should concern about the connection direction. The connection method is that the unfilled corner of one Xadow module need to connect to the right angle of another module (see four corners of each Xadow module).

  • Download the library file: Digital Compass Library, and install it to your Arduino Library. See How to install Arduino Library to learn the install method.
  • Open the demo by the path:File -> Example -> Digital Compass -> HMC5883L_Example. Replace the value of variable “declinationAngle” with the one you’ve figured out already.

  • Upload the Code. Check the output result by opening the serial monitor.

Resources


Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:

  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.

An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.

Happy hacking