2
\$\begingroup\$

I am currently working on a hobby project, for which I would need a reliable compass that should work in as wide a range of environments as possible (i.e.: In a field, in a car, on a train, possibly even on an airplane)

I chose the LSM303DLMTR tilt compensated compass (datasheet here)

It was easy to set it up with an Arduino board and then make a calibration (using a predefined set of steps, using a library. The Arduino periodically prints a heading, but now the problem arises that if there is even a small magnetic field around, it will make the heading reading useless.

Even in my room, which shouldn't have any strong magnetic fields around, the compass only printed junk. This is frustrating, since an ordinary compass isn't nearly as bothered by nearby fields or ferromagnetic materials.

Thus, I have two questions:

Is it possible to shield the compass effectively against minor interference (I realize that a strong, local magnetic field will always ruin the compass functionality) and against ferromagnetic materials nearby? (Ideally, I would like to be able to use the compass in a train, which creates magnetic fields through the electric lines.)

Related to this: Can minor perturbations be avoided by using a "smart" calibration, and does this need to be repeated every time a strong field perturbs the compass?

\$\endgroup\$
  • 2
    \$\begingroup\$ As regards train lines, traction power is usually alternating current at a frequency like 16 Hz, so the electricity lines powering the train shouldn't produce a DC magnetic field. If you "average" the magnetic field reading over a second or so, you may get more sensible readings. \$\endgroup\$ – Li-aung Yip Oct 29 '13 at 10:03
  • \$\begingroup\$ Some train lines are 600V DC however, so it depends on where you are. In any case you can't trust the rails themselves to be demagnetised; leading to further difficulty. Magnetic compass correction is famously difficult even on a wooden ship! One thing you can do is investigate the compass response to AC fields (50/60Hz): if its sampling rate aliases with either of those you may see a spurious slowly drifting field, and this can be suppressed by filtering (and/or changing the sample rate to make filtering easier.) \$\endgroup\$ – Brian Drummond Oct 29 '13 at 10:14
  • \$\begingroup\$ Your title question "Digital Compass: Is it possible to shield it effectively" suggests you are asking about shielding transient fields, but you couldn't shield the transients without also shielding the static magnetic field. Later on in the body you mention "smart" calibrations, which I have a feeling is more what you are asking about. Maybe you should change the title of your question to reflect that. \$\endgroup\$ – Bob Oct 29 '13 at 12:16
3
\$\begingroup\$

You dont want to shield a compass, then it wont show you the north at all. What you might want to do is make some low pass filtering to get rid of noise. For example avarage the reading over n samples, then the random noise from environment mostly cancels out. Same effect as frictional dampening in old school compass, electronic compass doesnt have any so add it in code.

Also dont forget that compass never points to true north or even magnetic north.

In aeronavigation 3 correction parameters are used:

  1. Correction for airplane frame, these are calibration values gotten by rotating airplane and comparing compass readings to magnetic north. This parameter is added to reading.

  2. Correction for local magnetic anomalies, due to uneven distribution of metals in earth crust compass reading rarely points straight to magnetic north. There are maps for this where a correction parameter is taken from and added to reading.

  3. Correction for geographic coordinates, magnetic north pole is not at north pole, depending on your coordinates a correction parameter must be added, for example if you were flying right between magnetic north and geographic north the correction parameter would be 180degrees. The parameter is less drastic further away you are from poles.

Sum of these 3 parameters and compass reading is geographic north. So you can see that answering "where is north?" with a compass can be a quite difficult if you want high degree of accuracy. If you dont want to count for all this settle for "north is in that generic direction"

\$\endgroup\$
  • \$\begingroup\$ So, if I understand this correctly, there is no way to prevent the compass of showing a wrong heading when there are ferromagnetic materials nearby? I understand that it never points to true north, but that is not my main concern. My main concern is that it might print out a heading to east, while it is pointing west, for example. \$\endgroup\$ – Mark Anderson Oct 30 '13 at 9:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.