Magnetometer housings HMC5883L

I'm in the design phase of a robotics project. I have pretty much done my prof of concept on a different platform and am building a new body with better motors and a bit more functionality. I was never able to get good results with my digital compass. I am positive it was because of the close proximity to the motors. The body was small enough that I couldn't get more than 5 or 6 inches away. This new body is an old 2.5 gallon popcorn tin like you see all over at Christmas, and a smaller tin above that as a "head". Both sections will have their own processors, the body controlling movement and collision avoidance, and the head will have environmental sensors, a display, GPS and compass.

he question is, how much does metal, like tin, effect a digital compass? Can it be inside? Is outside and mounted an inch above ok? What restrictions are there for use without too much accuracy lost? This will eventually be used with the GPS to figure headings to a waypoint so it does need to be more accurste than not.
Thanks

Is it really tin, or is it steel?

The compass must be calibrated in place. The best procedure is described here. Simpler, but less accurate here.

If there is too much magnetic or iron-containing material nearby, it may not be possible to calibrate, in which case your only option is to put the compass up on a pole (and calibrate there).

Thank you both. I have a feeling it is steel but will hunt down a magnet to be sure. Not the best.

I have been thinking of a contingency plan for some kind of "mast". Just not sure how to incorporate it yet. If I come up with a good idea that fits the design I'll go with it even if not strictly needed. The compass is tiny so it wouldn't have to be much in the way of bulk or support.

Joe

So you calibrate the magnetometers and then move them, the calibration is off.

I mounted two magnetometers 180 degrees out of phase with each other. I found that the sum of the mag readings, negated field disturbances of nearby objects. What I get is a constantly calibrating magnetometer.

YUP. It is steel... >:(

as long as they are moved but stay in the same relation to the frame it "should" be ok. That's the point of calibration. Like a compass on a car. The calibration normalizes it regarding the frame of the car. I guess I'll be finding out for sure though.

Another question. Once calibrated, does the compass keep it or does it need to be done every time power is cut?

Once calibrated it should be OK unless the environment changes.

After calibration, you will have six to nine calibration constants that must be put into your code to correct the raw readings, and those constants will of course survive power cycling.

...or, during calibration, you could write the corrections to EEPROM

Once again, thanks.

JoeWillson:
YUP. It is steel... >:(

Metallic tin is as soft as cheese and never used to make "tins". It is used to plate the inside of steel tins
to prevent corrosion. Tin-can is short for tinned-can, in fact. Other coatings are used these days too,
such as plastic.