I am using hmc5883L on an autonomus robot. It shall remain in a 1 meter squared area. I have recently discovered that its reading changes up to 20 degrees on different positions even when it is facing the same direction (values are consistent within a given point though).

I believe there should be a magnetic field distribution in my room (a slight tilt might also exist for that matter). I am about to take this as a huge error percentage, however I really prefer not to. So I thought I may check if my phones (iphone) "compass" application will diverge 20 degrees as well. It didn't even diverge 1 degree.

So my question is, how is this even possible if such a magnetic distribution exists? Does phones use a different method to tell the position of north? Is there anything I could do to make my readings more consistent with changing positions?

  • \$\begingroup\$ Composs aren't 2d things. You seems to forget that there is a third axis. You should compute your X,Y values with the Z axis. My guess is that in order to provide a real 2d value, you'll need a gyroscope. As I understand the compass give you the "coordinate" of the magnetic field. But if you want to project it in 2d, you'll have to make a projection of the 3 vectors on the perpendicular vector from ground. \$\endgroup\$ – Loïc Faure-Lacroix May 12 '16 at 19:09
  • \$\begingroup\$ I preferred not to use gyroscope I had too much noise. I considered applying a kmer filter but I was afraid that the errors would accumulate on long run (I will be using it about 10-15 minutes straight). If I cannot find a way around, I will consider that again. \$\endgroup\$ – ozgeneral May 12 '16 at 19:12
  • \$\begingroup\$ And could you elaborate about the third axis? How could z axis affect the measurement of x and y up to 20 degrees, and how can I compensate for it? (I just checked and z value indeed changes a lot, although compass face approximately upwards(so z should be same as well) ) \$\endgroup\$ – ozgeneral May 12 '16 at 19:14
  • \$\begingroup\$ Well, I believe it could be possible to achieve that without a gyroscope. If the device can be placed in a way that it can move freely, you could apply some kind of weight that will force it to be perpendicular. \$\endgroup\$ – Loïc Faure-Lacroix May 12 '16 at 19:15
  • \$\begingroup\$ Do you think it will have significant effect to make sure it is absolutely perpendicular? At the moment it is probably tilted about 1 maybe 2 degrees at most. \$\endgroup\$ – ozgeneral May 12 '16 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.