Honeywell HMC6352 Compass reporting limited heading.

I've been using a Honeywell HMC6352 digital compass module with an Arduino Uno to get heading data for a project, and it's been working well. I have recently started to try to move the project off of breadboards though, and have run into something unexpected; the module has started to only report between roughly 110 and 240 degrees.

I'm pretty sure that the issue is not loose connections; I've encountered those, and usually a loose VCC or Ground results in consistent readings of 0.0, while a loose SDL or SDA results in no output at all.

I've come up with a couple of things that may be the culprit, but am not sure which is the most likely or if this is a common issue that is caused by something else. Any ideas?

  • Short between the SDL and SDA wires; they're plugged into the A4/A5 (20/21) pins, which are pretty close together.

  • Electromagnetic interference; I've strapped the compass module directly to the Arduino's case in order to keep it parallel to the ground. Could the board be interfering with the detection of the earth's magnetic field?

Thanks, I appreciate any advice.

The positioning of a compass chip so that it is able to still recognize the correct heading is not an easy task. The earth's magnetic field isn't very strong so a bit of iron near the chip may influence the reading extraordinarily. What's the Arduino's case made off?

Aluminum, which I don’t think would make a big difference; the screws used aren’t magnetic, either. How close would something have to be? It’s probably not within millimeters of anything magnetic, but there are circuit elements within a few centimeters; resistors, diodes, capacitors, a motor, battery, transistor.

Thanks for the help.

I'm not an expert in this area but if aluminium has some current running through it, it get magnetic.

Can you make a picture of this setup and post it? It's hard to imagine how you mounted the chip.

Sure, here’s a picture of the general setup:

The compass is the blob of electrical tape on the bottom, with the actual chip up against the aluminum. I was thinking that it might be close enough to the voltage wires and actual processor that they could cause interference, but I’m not sure.

Even if the aluminium case is not directly influencing the compass, it does at least shield the earth magnetic field from the sensor. Move the sensor away from the case or use a plastic case that will probably make your readings much more appropriate.

Sounds like a good idea; I'll try mounting it on a small block of plywood or something to keep it flat.

Thanks for the help.

Edit: If anybody else has this issue, mounting the compass to the top of the case with the chip facing up fixed it. Either the aluminum was causing a short, or the chip didn't like being pressed right against it, or something like that. It looks like with compass chips, location is everything.