View source for Talk:I2C Compass

From Openmoko

Jump to: navigation, search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Administrators.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page:

Return to Talk:I2C Compass.

Personal tools


Pre-orders of anything are non-binding so far and are to evaluate interest by the community. Please sign your name in the appropriate section.

PCB only


Ready-made module

Kagee 02:28, 27 July 2009 (UTC)


As I proceed through the project, updates on my progress will show up here

Userspace vs kernel module

Initial research in Linux I2C implementation (yes, believe it or not, I dived into this head-first without any prior knowledge of how linux i2c worked) revealed that besides direct kernel-space adressing, I2C devices can also be adressed from userspace via the device file system by means of the i2c-dev module. Since it will apparently be quite easy to actually bake together the contraption once I uncover a source of parts (which I haven't really looked into much so far), be ready to access the module from userspace for the time being, because actually writing a dedicated kernel module for the chip will definitely be the trickier part of the project. --Drdeath 00:14, 26 July 2009 (UTC)

HMC6352 vs HMC5843

The 6352 has the simpler peripheral circuitry, which means less space consumption, but is considerably bigger itself. The 5843 is smaller on its own, but has the disadvantage of needing a rather big capacitor in the periphery, which will be as big as the chip itself. The real advantage of the 5843 is that is is 3-axis, meaning that the device will not need to be held horizontal for accurate measurements. Currently I am leaning heavily towards the 5843. initial experiments will have to show how we can pull off stuffing the (in comparison) monstrous capacitor into the space available and still have enough room for wiring and chip plus all the other little gadgets and gizmos that are needed to make the whole contraption work.--Drdeath 00:32, 26 July 2009 (UTC)

Major Drawback on the HMC5843

While the 6352 is capable of returning measurements in angular degrees, the 5843 squaks nothing more than raw measurements in three dimensions. It appears I have let myself be misled by the assumption that the distinction between modules called "magnetic sensors" and modules called "digital compass" by Honeywell would be in the "compasses" having this built-in processing capability. Well, I was wrong, and don't ask me how the 5843 merits the presumptious title of "compass" since basicly it is no more than a glorified three-dimensional magnetometer. Actually it is more of a magnetic gyroscope than a compass. The major drawback in this is that I've never done any three-dimensional vector mathematics before, and it will remain to be seen wether or not I can manage to figure out how to create a magnetic heading from those three vectors passed by the chip. If I can pull it off, so far so good, if not, it is back to square one with the preliminary design considerations, and either biting the two-axis bullet or consider different chips. Which of course may or may not be equally wholesale.--Drdeath 04:41, 27 July 2009 (UTC)

Minor Update
It would maybe be possible to use the HMC6343, a highly integrated complete digital compass solution. Downside is that it is a real tight fit in the space available, and that - hold on to your skivvies - the price is roughly five times that of a 5843, or four times that of the vaunted 6352. Upside is it is really a cream-of-the-crop module that would turn the FR into a first-rate digital compass - but who needs that?
Update on the Problem mentioned above
Diagram of 3-dimensional magnetometer heading calculation

After turning the problem over in my mind as well as conferring with several people more math-savy than yours truely, I can (quite literally) draw the following picture:

By multiplying the unit vectors with their respective scalars received from the sensor and vector adding them, we can generate a vector that points along the magnetic field lines. We then proceed by calculating that vector's angle with the y unit vector's orthogonal plane. It is intuitively clear that this plane is again orthogonal to the surface of the earth, as long as the sensor is not tilted sideways. For that simple reason, the angle of the magnetic vector towards the X-Z plane is the angle of deflection from north.

Note how the rotation of the coordinato system around the y-axis, or the up-down tilt of the device leaves the angle intact. That is why this method is infinitely superior to the alternative, projecting the angle into the y-z plane. This method would not be tilt-independent, because with increasing tilt, the magnetic sum vector is increasingly affected by the z scalar, which would, when projected into the y-z plane, cause the angle to open up.

That of course leaves sideways tilt to be considered. To determine this, the accelerometers might render good service. Also this does not even adress the problem of calibration. Concerning that, I happen to have a few ideas up my sleve, but those are still too half-baked to be expressed just yet. --Drdeath 23:49, 27 July 2009 (UTC)

Pricing Update

Supply of the HMC5843 is secured, has them, and surprise! they are waaay cheaper than expected. Expect cost for the module and diy kit to be on the low end of the initial prediction, or maybe even a bit below!--Drdeath 01:30, 26 July 2009 (UTC)

Distribution Hubs to lower prices for everybody

One last idea before I turn in (it is past four am here): If enough pre-orders can be scraped together, we can all save money by having people in different countries handle the procurement/distribution of modules and PCBs for their area, thus eliminating the customs fees that would otherwise apply twice (once on me importing the modules into Germany, once more on you importing it to your country). Did I neglect to mention I'm gonna put PCB files and all public domain? Sloppy me. --Drdeath 02:20, 26 July 2009 (UTC)

PS: Even if I have the PCBs made (which is not the best idea since I am subject to VAT) a handfull of PCBs for a few Euros sent in a single package to a single adress are more likely to pass by the customs bloodhounds unnoticed than a constant stream of modules at 40+USD (or more likely 30+ taking into account the more recent developments but I'm not making promises).