magnetometer interference help ?

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I've built an autonomous robot for a competition in June, but I'm having trouble with my magnetometer.

The bot is very simple; an uP brain, a GPS, a magnetometer, an xBee for wireless monitoring, all contained in a Tupperware box on top of an RC car.

All was going well, the control board worked on the bench (a wire wrap prototype. I've now had a PCB made), and I have the software running with a simple PID loop controlling the steering servo with inputs from the GPS and magnetometer, controlling the car to GPS waypoints.

However, this weekend, I strapped it all to the RC car for the first time, and now it doesn't work at all ... :-(

The problem is the magnetometer. I'm just getting garbage from it, now it's on the car.

I kind of expected some interference, but I thought it would bearable. I don't need it to me too accurate. There is a big brushless motor within 20cm of it, plus a steering servo, plus all manner of batteries and wires. But it just says it's pointing the same way, irrelevant of its rotational position. I suspect it's just swamped from all the magnet on the car ?

Has anyone done this before ? Anyone got any advice ? I'm not sure I can "shield" the magnetic interference from the motor, as it will block the earths magnetic signal too, that I actually want ?

Should I move it much further away ? Perhaps on a mast above the car ? Will that help ? I imagine it wont, the magnet in the motor even at 40-60 cm is probably stronger than the earths magnetic field ? Should I use a different type of magnetometer ?

(PS, I know I can use the GPS for a heading vector, but not when stationary. I need to know which way I'm pointing at slow speeds so I can point in the right direction and speed up, at speed the GPS vector is potentially more reliable than the magnetometer ...)

Thanks in advance for any advice ...

Jon.

Jon Russell

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Head on over to rcgroups.com and diydrones.com. They use magnetometers on electric aircraft (UAVs) all the time, so they should be well versed in dealing with the effects of interference.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BigJon,

You do not state what type of magnetometer you are using, or what function it serves. It seems you are using it as a compass, but I'm not sure from your description.

In any event, yes, the DC motor's magnetic field will likely completely overpower the magnetometer. Not to mention the potential for numerous other magnetic fields generated by high currents in your bot's electronics. The Earth's magnetic field is quite weak compared to most man-generated mag fields.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, Thanks for the responses. The chip I'm using is a LSM303DLHC 3D accelerometer and 3D magnetometer module. Specifically I'm using the Pololu breakout board : http://www.pololu.com/catalog/pr...

Does that mean I *cant* use a magnetometer with motor based bot. Or is there a magic solution ? :-)

The various threads on DIYdrones talk about moving the magnetometer away from the power cables and motors, so it must work in some configuration. quadcopters have 4 high powered motors and 4 power cables and it works there. I only have 1 !?. I will try this week to move the sensor as far away from the motor as possible on a wooden "arm" gaffer taped to the chassis. If that improves things, maybe I can rig it up more permanently.

Thanks.

Jon Russell

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BigJon,

I have experience with traditional magnetometers and metal detectors, but not the IC types. But I can offer the following based on my knowledge of the topic:

1. Yes, distance cannot hurt and will often help. The real question is whether you can get enough distance between the sensor and the interference sources in your application.

2. Magnetic shielding is a very difficult art form to master. Often forgotten is the fundamental empirical fact of physics that there is no known magnetic "insulator" - a magnetic field passes thru every material presently known to man. That's absolutely true for a "DC" (steady) magnetic field, like that of the Earth's terrestrial mag field, but not entirely true for an "AC" (fluctuating) magnetic field as is produced by many electromagnetic devices. AC mag fields can be "insulated" (shielded) to various degrees with various techniques.

3. If the distance remedy does not help you, I would try shielding the sensor itself. Perhaps a combination of shielding and distance may solve your problem.

There are two types of shields - electric and magnetic. The electric type is the easiest to implement. Simply wrap the sensor in some sort of foil (aluminum, copper, etc) and connect this sheild to your DC Common of the bot's power supply. (Copper is better in this regard in that you can solder the connection to the shield for high reliability and resistance to motion issues.)

Magnetic shielding is more difficult because you have to use specific materials and adhere to certain geometric restraints. However, I think it's worth a try in this case. You have to get some "mu metal" foil, then wrap the sensor in it. You might also be able to use some sort of a mu metal preform, like a tube or a channel. You'll have to look on-line for these items. Often, manufacturer's will offer "Engineering Kits" for a modest price. These contain small samples of various foils, tapes and the like. You won't need much, and you will have to experiment to find an optimum arrangement, so such a kit is your best bet to get started.

The mu metal shield will block (to some degree) the changing ("AC") magnetic field from the interfering sources, but pass (to a larger degree) the steady ("DC") mag field of the Earth. (Which, by the way, becomes a varying magnetic field, as you move the magnetometer thru it by virtue of your bot's motion.)

The conductive aluminum or copper field will block interfering electric fields (noise) also produced by your circuitry and which may be interfering with the internal circuitry of the magnetometer.

Sometimes the mu-metal shield is conductive enough that it will also serve as an electric shield, but often you will need both types of shields to get an effective solution.

Good Luck!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's really helpful ! Thanks.

Jon Russell

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Big Jon,

Another thing you might try to evaluate the problem...

Completely isolate the magnetometer from the bot electronics and see if it operates any differenty. In other words, separate power supply, separate driving/reading circuitry, etc. Then place the magnetometer at different locations around the bot as it is operating (perhaps in a restraining test stand so the bot remains stationary which its motros are running). See if you get (more) useable readings in this configuration. If you get improvement, you'll know you have interenece issues besides magnetic coupling alone to deal with.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another option to consider would be adding a gyroscope to the Bot.

Unlike a compass it doesn't tell you your heading, it does tell you your angular rate of turning. If you start out pointing North, and the gyro says you are turning +10 degrees / Sec, then in 3 seconds you are now heading 30 degrees, (NNE).

The good thing about a gyro is that it isn't effected by the motor's magnetic interference.

The down side is that the system using the gyro has to be initialized to its initial heading if one wants to know the true heading, not just a heading relative to the starting heading.
The output signal tends to drift over time. Expensive ones on commercial jets drift very little, and cost very much.
Inexpensive ones tend to drift more, and hence need to be recalibrated more often. If one has a GPS and is moving in a straight line for a reasonable period of time then the GPS heading can be used to recal the gyro's heading.

In theory one could (double) integrate the signal from a small MEMS accelerometer and determine heading. In practice the noise quickly trashes the data. Using the cheap MEMS accelerometers from Spark Fun won't get one very far.

That said, this and some other more expensive MEMS gyros would be worth looking at.

The tough part of this is that a MEMS gyro like the above is designed to be used in a car's navigation system. Cars tend to travel down roads which usually have some straight stretches where one can have several GPS heading readings in a row that are stable, and can be used to reset the gyro heading.

A small Bot tends to make lots of small quick turns, frequently, and is rarely heading for a lengthy distance in one straight line, (at least compared to a car).

Last comment, you might want to have two separate power supplies, one for the motors and one for the uC and electronics. Tie the grounds together at one point. Heavily filter the uC power rail.

Good luck with your project.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yet another thing to look at are hard and soft iron compensation. The magnetic field may be distorted to the point that it reads the same direction, but it can be possible to "calibrate it out" if it is consistent. Hard-iron represents an offset and is fairly simple, soft-iron is distortion and more difficult to deal with. This calibration needs to be done in-place to take into account the full system.

Martin Jay McKee

As with most things in engineering, the answer is an unabashed, "It depends."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The motor should not be leaking much flux unless it is being overdriven, so try dropping the peak current. You could surround everything but the sensor with transformer silicon steel, but that is likely to be heavy and will still disrupt the Earth's field to some extent.

One thing to try is a linear concentrator, two long narrow strips of mu metal that lap over the Hall probe and extend in either direction. That will make it 100x more sensitive in the long direction, ideally making that at a right angle to the major local magnetic field.

mu metal
===================
                --- Hall sensor
                ====================
                 mu metal
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The earth's magnetic field is indeed quite small.

One thing that you might try is a compass - to see if it is in fact magnetic interference. If a compass won't work correctly, your magnetometer won't work correctly. If the compass works OK, you have other issues.

If it is magnetic:
Moving things helps since the fields fall off as the square of distance. Shielding can work, but you have to shield the source. Basically, you are providing an easier path for the magnetic field from the source, which will lessen it's effect at a distance. (That's why they use terms like concentrators -- the magnetic field is concentrated in the metal. ) The shields will do the same thing to the earth's field, but with careful positioning, it probably will be OK.

Best of luck,

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a hard iron solver library here: http://krazatchu.ca/2012/02/27/6...

Interestingly, while working on the library I discovered my computer speakers washed out the compass within an 80cm radius.

You might find the 3D scatter plot is quite useful in visualizing the problem, there is a video at the bottom of the post.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck-Rowst wrote:
2. Magnetic shielding is a very difficult art form to master.
[true]

Chuck-Rowst wrote:
Often forgotten is the fundamental empirical fact of physics that there is no known magnetic "insulator" - a magnetic field passes thru every material presently known to man. That's absolutely true for a "DC" (steady) magnetic field,
[not necessarily true from what has been suggested to me. Look up the Wikipedia entry for Mu-metal and decide for yourself. I am not the expert.]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the problem is that high permeability leads to saturation. One can often deal with saturation, if that is brought into the mix.