I have a QMC5883L magnetometer, and a pretty basic sketch which just prints the values from X, Y and Z axis to the serial monitor.
I want to use it in an application to detect changes in the magnetic field, and the sensor will be in a fixed position. However, it seems that when I start the Arduino, the values from the sensor are all over the place (looking at it in the serial plotter all 3 axis are going from 1 extreme to the other and back). If I move the sensor around a bit, the values calm down and become more steady, and usable to detect metal objects approaching the sensor.
Since the sensor will be installed in a fixed position, I can't move it around to calibrate it every time the Arduino restarts. Can I calibrate it programatically somehow? Note that I don't really need to know which way it is oriented, I simply want to detect when the magnetic field changes (i.e. when a metal object approaches/leaves the sensor).