Why the value of "MAG_GAUSS_PER_LSB" is 666.7

Post Reply
Posts: 1
Joined: Tue Apr 16, 2019 10:56 am

Why the value of "MAG_GAUSS_PER_LSB" is 666.7

Post by maksyuki » Tue Apr 16, 2019 11:02 am

Code: Select all

#define MAG_GAUSS_PER_LSB     666.7f

#define SENSORS_GYRO_FS_CFG       MPU6500_GYRO_FS_2000
    sensorData.mag.x = (float)headingx / MAG_GAUSS_PER_LSB;
    sensorData.mag.y = (float)headingy / MAG_GAUSS_PER_LSB;
    sensorData.mag.z = (float)headingz / MAG_GAUSS_PER_LSB;
I search the datasheet of the AK8963 and find the 16bit ADC sensitivity is 0.15μT/LSB. I think the output equal "ADC value * sensitivity" which equal "headingx / (1/0.15) = headingx / 6.667".


Posts: 1867
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Why the value of "MAG_GAUSS_PER_LSB" is 666.7

Post by tobias » Wed Apr 24, 2019 8:09 am

You might be on to something. I think this code originally comes from somewhere else so can't really answer why it is 666.7. I guess it hasn't caused a problem as it normally is the heading that is interesting.

Post Reply