04-13-2021 12:01 PM
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).
04-13-2021 05:32 PM
Hi,
Thanks for your inquiry.
In order to obtain magnetic field measurements in the unit of uT from BMM150 raw data signed integers, please refer to BMM150 API source code at https://github.com/BoschSensortec/BMM150-Sensor-API. Please also see the attached "bmm150-step-by-step-temperature-compensation-sample.pdf" for more information.
Thanks.