I’d be delighted if someone could show me what I’m doing (or understanding) incorrectly, but I fear this device isn’t working properly? After getting dodgy reading results I decided to do a sanity check on the measured field magnitude. If the sensor is kept at a fixed point in space and rotated in 3D, the reported field magnitude should be constant. Yet I see a range of values from 131% down to 76% of the expected local field strength (as looked up with WMM World Magnetic Model) as I rotate the sensor. That implies really large gain differences between axis, the auto-zero SET/RESET process does not really auto-zero, and/or some other issue?
I’m following the instructions in the datasheet using RESET and SET pulses to find the zero-field readings for each axis (which MEMSIC strangely calls offset) and reading value.
I’ve posted a detailed discussion of the problem, the test program, and detailed measurement outputs on github: https://github.com/DRNadler/MMC5983MA_C … /tree/main
Much obliged if anyone can see what I’m doing wrong.
Thanks!
Best Regards, Dave
PS: I’m using a SparkFun Micro Magnetometer - MMC5983MA (Qwiic) SEN-19921
I don’t have an example of that magnetometer to test, but the behavior you describe is perfectly typical of uncalibrated magnetometers. They have large zero field offsets, and significant gain variations between the three axes.
It is relatively straightforward to correct the problem, by simply collecting a few hundred data points while orienting the sensor in all possible directions. It should be held far from current carrying wires, iron objects or magnets. Fitting the resulting data to an ellipsoid in 3D allows calculation of the 9 correction factors (a 3x3 symmetric gain matrix and 3 offsets).
Excellent overview and tutorial at https://thecavepearlproject.org/2015/05 … r-arduino/
Example of an extreme but successful correction can be found at https://forum.pololu.com/t/correcting-t … eter/14315
A Python version of the ellipsoid fit program Magneto (written in C) can be found here: https://github.com/jremington/ICM_20948-AHRS
Hi @jremington - While it is true many (but not all) magnetometers have large zero offsets, the MMC5983MA has SET/RESET operations (really should be called SET/REVERSE_SET) which degauss and swap the sense orientation of the device. These can be used to find the zero point and (mostly) eliminate offset. For a discussion of how this is supposed to work for the MMC5983MA, see the following video segment, which explains the operation I’m using and shows it working:
https://www.youtube.com/watch?v=HEKQfgcHaXQ&t=995s
Unfortunately, this is not working on the MMC5983MA I just purchased from Sparkfun - it exhibits a fairly large offset on each axis even using the datasheet-specified zeroing procedure.
I’d be grateful if anyone can point out my misunderstanding and/or misuse of the part - or maybe I got a bad one from SparkFun?
Thanks,
Best Regards, Dave
I suggest to go through the calibration procedure I linked, collecting the raw data, applying the corrections to them, and see how well it works.
I very strongly doubt that the built in Set/Reset option can ever be as effective as the methodical, straightforward and mathematically correct calibration approach. Some time ago I experimented with one sensor that had such an option, but that failed miserably. I suppose it is better than nothing, though.
Update: Previously, testing showed the SparkFun sensor board has very large offsets in each axis. I purchased a MEMSIC evaluation board for this part which works properly. This part has a very low maximum solder temperature (please see the solder profile on page 19 here): https://www.memsic.com/Public/Uploads/u … etRevA.pdf
I fear the SparkFun board may have been soldered too hot and damaged the sensor.
Can someone from SparkFun contact me?
Thanks!
Best Regards, Dave
PS: My testing detailed report and code are here: https://github.com/DRNadler/MMC5983MA_C … /tree/main