I am currently using the bmm150 (directly from the BMX160) to measure the magnetic field of a very small NdFeB magnet (250 micron size).
I use the Bosh API to set correctly every parameter (bmx160.c), and therefore use the compensated values for x, y and z, which are returned in int16.
While reading those values, I correctly find that when it overflows, the value is at 32768 for all three axis.
However, I don't understand the range of the magnetometer. Indeed, if I use the fact that LSB = 1/16 uT (as it is said here), and because the x and y axis are coded on 13 bits, then I should have a range of +/- 255.9375 uT (From -4905 to +4095, as -4096 is used to define a saturated state). When I measure the earth's magnetic field, convert binary into uT (by dividing by 16), calibrate the data against Soft Iron and Hard Iron effects, the value I obtain is 10 times lower than the actual earth's magnetic field.
Am I missing something obvious?
The other possible approach is the following: as the Datasheet gives +/-1300 uT range for x and y axis, and as the saturated value of x and y axis is -4096, does it mean that 4095 is associated to +1300uT, and -4095 to -1300 uT? That means that LSB = 0.32 uT, not 1/16 uT...
Following the same thought, for the z axis, the binary value for +2500 uT is 16383 and -2500uT is -16383?
So basically, my question is: how to get from binary to uT value?
Thank you for your answer,
Solved! Go to Solution.
Thanks for your inquiry.
In order to get BMM150 x/y/z values in the unit of uT, you need to use the formula and temperature compensation parameters in the NVM of each BMM150 chip to work together with the signed integers from BMM150 x/y/z/Hall resistance data registers. Please see the attached "bmm150-step-by-step-temperature-compensation-sample.pdf" for more information. This formula is also included in the BMM150 API source code on the Github at https://github.com/BoschSensortec/BMM150-Sensor-API.