Meaning of "LSB/Unit" and "Unit/LSB"

Genesis Rock picture Genesis Rock · Oct 3, 2013 · Viewed 44.4k times · Source

At the moment I'm playing with the LSM303DLHC accelerometer/magnetometer/thermometer.

This is its datasheet: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00027543.pdf

Everything is working quite well, but I don't know how to interpret the output values. The datasheet (page 9) says something like "1 mg/LSB" (no, it's not milligramm :D) about the linear acceleration sensitivity in my configuration. What the hell should that mean? Same with temperature sensor output change (8 LSB/°C) and magnetic gain setting (1100 LSB/gauss), only the other way around.

For example, what to do with this accelerometer output: 16384? That is my measured gravitational acceleration.

Answer

Genesis Rock picture Genesis Rock · Oct 3, 2013

Now I got the trick. There are several things on this MEMS you have to know, but which are not mentioned in the datasheet:

  1. The accelerometer's output register is just 12 bits and not 16 bits, so you need to right-shift the value by 4 and multiply it with 0,001 G. Furthermore it's little-endian.
  2. The magnetometer's output register is 16 bits, but big-endian. Furthermore the vector order is (X|Z|Y) not (X|Y|Z). To calculate the correct value you need to devide X and Y by 980 gauss⁻¹, while it's 1100 gauss⁻¹ for Z.
  3. The temperature sensor works, but it's not calibrated. So you can use it to measure temperature change, but no absolute temperatures. It's also just 12 bits, but big-endian and you have to devide the output by 8 C⁻¹.

With that Information it's possible to use the LSM303DLHC. But who the hell invented this? "Let's build a new accelerometer, magnetometer and thermometer in one package and screw the user up by mixing word length and endianness up without mentioning it in the datasheet."