Hello! I'm implementing the magnetometer readings processing. For this purpose the custom sensor driver is used. Here is the code of the sensor raw data processing so as to get uT values: const float kMaxVal = 32768.0; const float kXYRange = 1300; // +-1300uT (x, y axes) const float kZRange = 2500; // +-2500uT (z axes) int16_t l_x, l_y, l_z; //This function takes raw X, Y and Z values from the sensor Magnetometer_getValues(&l_x, &l_y, &l_z); *x = (kXYRange/kMaxVal)*l_x; *y = (kXYRange/kMaxVal)*l_y; *z = (kZRange/kMaxVal)*l_z; The problem is that when sensor is moved, the overall magnetic flux value (B = sqrt(x^2+y^2+z^2)) fluctuates (Graph 1). There are no magnets around the BMM150. How this value can be trimmed? I've tried the compensation code from the original API, but with no success, as the Y value showed the result in hendreds of uT. What can be the reason of such results and where can I find the complete calibration process instructions? In addition, I've done some compensation by myself. Here is is: *x = ((kXYRange/kMaxVal)*l_x + 6.18) * 1.07; *y = ((kXYRange/kMaxVal)*l_y - 33.0) * 1.06; *z = ((kZRange/kMaxVal)*l_z + 9.38) * 1.51; After these modifications the graph of magnetic flux looks like in the pic. "Graph_2" (attached).
... View more