I2C Compass

From Openmoko

Jump to: navigation, search


Example photos

The power is taken from the aux switch which provies IO_3V3. See details about power problems on I2C. Keep in mind that the power regulator is also an i2c device. On the console you see example outputs for the HMC5843 taken by a small program which accesses the HMC via /dev/i2c-0


I intend to will build a I2C Compass module that fits into the cavity upwards the sim card holder and right of the battery.

In progress: This article or section documents one or more features whose implementation are in progress.

Further announcements and updates can be found on the discussion page.
Don't miss out on it, by now there's actually almost more info there than there is here. Until I can get to overhaul this page, the discussion page should be considered the main info counter on this.


While the GPS does provide heading information, it computes said by drawing a line between the current and last position generated. Thus it is obvious that the heading generated will:

  • a) Fall behind increasingly with tightness of turn
  • b) Be increasingly jittery and inaccurate with decreasing forward speed, as the GPS-inherent jitter will be more and more pronounced.

Therefore it is desirable to have a device installed which generates heading directly from the earth magnetic field instead of by comparison of position.


Unlike the GPS, the magnetic compass module is affected by magnetic variation. Also the module will be next to useless pending implementation of its software.


The module will most likely consist of a HMC6352 or preferably the 3-axis HMC5843 module on a tiny PCB. The HMC6352 in principle does not need any additional periphery to function. If the nearby radio circuits should turn out to interfere with the compass function, the addition of two resistors and two capacitors may prove necessary, which should have ample room in the space available. The HMC5843 needs a little more periphery but it should still be manageable in the space available Connections will be made by soldering wires to the test points on top of the main FR PCB.


  • It is possible if unlikely that the compass module could itself throw interference into the GPS module. In this case, a decoupling capacitor in the power circuit of the compass module may be necessary. The setup in the photo seems not to disturb GPS reception
  • It is possible that the shielding of the nearby GPS and GSM modules renders the magnetic field unusable to a HMC6352, or that the HMC6352, even decoupled, emits interference that render either the GPS or the GSM unusable if mounted in that position, either of which would lead to the project having to be given up since there is no other place inside the casing where the chip could be mounted.

Request for Contributions

I would appreciate contributions in the form of software, especially patches to frontends and gpsd to have them make use of the module. I intend to try and write a module myself, but I don't make any promises yet. See first and next paragraph!


Feasibility assessment is complete. Hardware development is under way.

Next Step(s)

In that order

  • Find out about how the i2c bus can be made use of in linux
  • Find out if a kernel module exists for this chip I've checked and came up blank.
  • Order one or more ICs for testing purposes
  • Etch a test board
  • If none exists, get started on the kernel module


The module is (obviously) not available for purchase yet.

Whether or not I proceed to production state with this project depends largely on expression of interest by the community.


Please note that these are preliminary figures which may well go either up or down. I will try to find volume discount prices on ICs and post more accurate price/order count relations asap.

  • The end price for the complete module will probably be in the range of 40-60 USD exc S/H.
  • Bare PCBs will range in the area of 1.50 to 2.00 USD + S/H.
  • DIY-Kits with IC and PCB will range between 30 and 50 USD depending on order count.

Minimum Order Count

Preliminary minimum order counts are in the range of 40 PCBs. Ordering less PCBs is uneconomical.


Non-binding pre-order is open effective immediately in the discussion thread of this page.

Links and Resources

Personal tools