Magnetic interference between the motor and the compass


We ran into a major issue today with our HMC6352 compass which had worked fine up til now. The problem arises when we move the servo motor that makes the pump rotate. It changes the magnetic field (because of the coil in the motor that drives the pump) which results in the compass losing direction. If there is too much exposure, the compass is stuck into this bad state even when the motor is away, until it is recalibrated.

The HMC6352 datasheet gives some insight into that issue. There are three ways in which to reduce interferences. First there’s the calibration mode, which we were already using to adjust the compass. The problem with it is that is presupposes a stable magnetic field which isn’t our case because the pump moves along 180 degrees to navigate.

Second is what the datasheet refers to as the set/reset function. This one is a bit more obscure but basically I believe that over time, when in the presence of a magnetic field, the sensor accumulates static and needs to be “reset”. The way to call the reset function is not clear at all but by digging in the datasheet I found a mention on p. 8 about the “update bridge offsets” message which reads “Update Bridge Offsets (S/R Now)”, so I guess the message calls the reset function. I have tried it and didn’t notice any difference but I need to do more investigation.

Finally, on p. 13 there are informations about the amplifier filter which basically controls the sensitivity of the sensor. By adding a resistor between pins CA1 and CA2 you can reduce the gain and thus the sensitivity:

An optional gain reducing resistor (Rext) could also place across the feedback loop of the amplifier stages. With the amplifier set with the internal 1200 k-ohm feedback for ±750 milli-gauss maximum magnetic field flux density, a second 1200k-ohm external resistor would halve the gain and permit ±1.5 gauss capability if desired. Gain can be reduced for up to ±6 gauss capability for magnetometry-only applications or compassing with significant magnetic stray fields nearby.

We did a test with a 1200kΩ resistor but we didn’t notice a major difference. We yet have to try with a bigger resistor (the datasheet is not clear on the maximum resistor you can use but it suggests you can get up to a “±6 gauss capability” so by doing a simple calculation we esimate the maximum resistor to reach that gain to 8700kΩ).

Another idea we tried was to enclose the motor in a magnetic shield made of aluminium foil, but even with 1 inch of foil it’s still doing major interferences (although it’s a little bit better). We could try using a material with a higher electromagnetic permeability such as mu metal which is way more permeable than aluminium.

Leave a Reply

Your email address will not be published. Required fields are marked *