There is a real need for an inexpensive, compact, low power, 3-axis magnetometer with a range around 1 Gauss (0.1 mT), which is the approximate scale of Earth's magnetic field. One set of candidates comes from Memsic. We developed a Memsic magnetometer IC for a project. The path was difficult enough that we thought we should share our experience. We still use and recommend the Memsic chips, but with reservations. There are not many good alternatives, and we figured out how to overcome the problems.
Most low-end magnetometers use Anisotropic Magnetoresistive (AMR) elements. These can be constructed using photolithographic methods. Thus is it is commonplace to see three bidirectional axes in one small, inexpensive IC. At a minimum, AMR sensors contain strips of Permalloy, a high permeability nickel-iron alloy, which have been magnetically conditioned such that their resistance changes depending upon their orientation in a magnetic field. One arm is biased in a given magnetic direction; the opposing arm is biased orthogonally. They are configured as Wheatstone bridges and sensed differentially. The measurements are fast. The Memsic device we used can be programmed for a 580 Hz rate.
We generally prefer SPI to IIC. It is faster and simpler, and there are too many IIC non-compliant devices out there. They can hang up the entire bus.
(As an aside, we have seen customers try to use IIC for inter-board communications over 10+ cm wire harnesses. This was for a motor control application. Needless to say, there were problems. Another blog post.)
The timing diagrams in the Memsic data sheet are deceptive. The clock line, for example is not idle-high. We tried that. The ordering of the 18-bit data is completely different.
If you contact Memsic they respond very quickly. They have a set of code examples that they share. This code is not straightforward. It did not work for us out of the box. Nor is it very flexible. 'Just do it this one way', is their solution. And it did not work for us.
The biggest problem we found is that it is easy to drive the Memsic chip into a state of total non-communication. Even when carefully polling status bits, we struggled with this for days. Presumably the internal state machine goes awry.
This problem was so bad that, at first, we suspected a solder problem on our side with the tiny LGA package. LGAs, especially small ones, are a real production challenge. But that was not the problem here.
Our basic strategy now is to carefully time the manual (not automatic) measurement starts, and then read back the data registers in carefully timed sequence. We also sequence the Set / Reset degaussing mechanism. Whenever we tried another approach we experienced total loss of communications.
Once we overcame these dumb communications issues, the problem was basic accuracy. Our DUTs varied widely, and were all grossly inaccurate. Moreover, rotating a device by 180 degrees did not, as one would expect, yield a simpel change of sign. Again, Memsic responded quickly and not-helpfully.
All axes have a significant fixed bias. This cannot be removed through the Set / Reset procedure. (Perhaps they can be removed in the presence of a controlled, known B field, but that goes far beyond the scope of our project.)
There is a work around. Place the sensor facing north, that is, x axis toward magnetic north. Record the value. Rotate 180 degrees. Record the second value. Now subtract one half of the mean from all x measurements. If you do have a stronger, uniform, and known B field, even better. Do this for all three axes, and make the trigonometric correction for the three dimensional angle. We found these resulting differential measurements to be close to nominal.
Komentáře