3
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – alephzero Sep 30 '18 at 22:58
  • $\begingroup$ @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 ? $\endgroup$ – Franz Kromer Sep 30 '18 at 23:33
  • 1
    $\begingroup$ 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. $\endgroup$ – alephzero Oct 1 '18 at 8:31
  • $\begingroup$ @alephzero Testing indicates that the datasheet is wrong in this case. Thanks for your help :) $\endgroup$ – Franz Kromer Oct 2 '18 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.