# Conversion from LSB to mg not making sense for accelerometer

I have a BMI088 and am trying to get an accelerometer reading.

The data sheet and specs for Bosch Sensortec are here:

The sensitivity per range is this (its a 16 bit signed integer):

• ± 3 g: 10920 LSB/g
• ± 6 g: 5460 LSB/g
• ± 12 g: 2730 LSB/g
• ± 24 g: 1365 LSB/g

Yet, the formula they give to calculate the force in mg is this:

mg = accel_int16 / 32768 * 1000 * 2^((range register value) +1)

Where the range register has the following values:

• ± 3g = 0x0
• ± 6g = 0x1
• ± 12g = 0x2
• ± 24g = 0x3

If we do the math on that and plug in the highest value (+32768) and highest range register value (0x3), we get a force of 16000mg or 16g, so a range of -16g to +16, not -24g to +24g.

So what is the correct conversion?

If we do simply, accel_int16 LSB / 1365 LSB/g we get a maximum value of 24g for 32768 which is intuitively what one would expect. Going by the same logic of a linear response, we might also say, each value (LSB) represents a LSB/mg, which would be

32768*x = 24000mg

x = 0.7324

In this case we can take a reading, multiply by 0.7324 to get our mg.

What am I doing wrong or not understanding? Why does the data sheet formula not give me the correct range?

The second part to that question, is, I want to have a scale factor to convert from LSB to to meters/second/second, so intuitively one would think it would be:

scale = 0.7324 * 0.001 * ~9.8m/s/s

Again, if we follow the datasheet formula we get

scale = 0.4883 * 0.001 * ~9.8m/s/s

Am I misunderstanding something fundamental here? Or does a 24g accelerometer only measure in a 16g range for some reason?

• Where does it say that the possible values in the register can cover the whole range from -32786 to +32767? It might be smaller than that for some reason. What register value would you get on the 3g range if you subject the device to MORE than 3g, for example? If it just wrapped round from +32767 to -32768 when it was overloaded, that could be rather confusing for the application software. Sep 30, 2018 at 22:58
• @alephzero I assumed that anything greater would read as the max value. If we look at the sensitivity charts, it all makes sense. For instance 1365 LSB/g at 24g means 32768/1365 ~= 24. At +-12g, sensitivity says 2730, which also is about equal to 12 when we do 32768/2730. I think it is up to me to use a range that goes beyond my expected forces to avoid clipping. The trouble is, that math works fine, but the formula in the datasheet doesn't align. Perhaps the datasheet formula intentionally clamps the range ? Sep 30, 2018 at 23:33
• Well, it's easy enough to test it to check the formula. If the accelerometer is just sitting on a table, it should read 1.00g in the downwards direction. Personally, I would be inclined to believe the data sheet formula, rather than "using logic" to decide what it should have been. Oct 1, 2018 at 8:31
• @alephzero Testing indicates that the datasheet is wrong in this case. Thanks for your help :) Oct 2, 2018 at 15:50

I couldn't add a comment (new to the forum) so posting in the answer section. Bosch has since acknowledged this to be an error and updated the datasheet's errata.

They have added a 3/2 factor to the original formula. I am wondering, do we really need to do this way? The LSB$$/$$g sensitivity just needs to be divided by the register value and with that, if we see, all the subsequent sensitivities are half of the previous value.. so wouldn't the following formula be correct?

$${mg = (accel_{int16} * 2^{range\ reg}) / (10920 * 1000)}$$

their " * 1.5 " fix, it seems, is reducing to the above formula. What's up with the number 32768?  • 32768 = 2^15, largest positive number is 32,767 in signed integers. Apr 14, 2021 at 20:31
• thanks @StainlessSteelRat also I should have actually divided the sensitivity in the formula as in the OP's case the units are LSB/g as per the spec and not g/LSB Apr 15, 2021 at 15:32