Michael just shared a new tutorial: "PiicoDev Magnetometer QMC6310 - Guide for Raspberry Pi Pico"
Let’s get started with the PiicoDev® Magnetometer. In this guide, we’ll connect the Magnetometer to our Raspberry Pi Pico, get it working as a compass, and read the magnetic field strength of a nearby magnet. Finally, we’ll remix the code to crea…
Read more
There appears to be a logic error in the calibration. Calibration uses “raw” readings
d = self.read(raw=True)
But those readings always have offsets subtracted. That means the only way to get a stable calibration is to delete the calibration.cal file (so offsets start at zero) and then run a calibration only once. Any time you repeat a calibration, it gets XYZ values that are distorted by the previous calibration.
This could be easily fixed if the calibration zeros the offset values before it starts its readings.
Hi Philip,
Great catch, it looks like that was fixed with the revision into the MMC5603: CE-PiicoDev-MMC5603-MicroPython-Module/PiicoDev_MMC5603.py at main · CoreElectronics/CE-PiicoDev-MMC5603-MicroPython-Module · GitHub
I’ll push a commit fixing the error, in the guide I recall instructions to delete the file if a new calibration was to be performed, but from a UX perspective it definitely makes sense to not have to prod around in the files.
Liam