Re: BMI160 converting data with resolution
Ok, there is a small error in the formula of @shellywang . In this line "Example: Range = +/-8G, then sensitivity = (2^15)/8 * 9.8 (LSB/m/s^2)" he accidentally put the 9.8
Let me give a more clear and detailed approach.
In order to convert from LSB to m/s^2 or degrees per second you just need to apply the direct rule of 3 (elementary maths).
Let's take the example of the accelerometer. The datasheet provides you the information of LSB/g for the ranges 2g , 4g , 8g and 16g. Let's assume that you have set your sensor to measure until 8g range. Looking at the datasheet (pg 08 you can see that for 8g range the sensitivity is 4096 LSB/g. Sensitivity is the number of LSB per g where 1g = 9.81m/s^2
Following what @shellywang said sensitivity = (2^15)/range = (2^15) /8 = 4096 -> you see? This is exactly what the datasheet sais for the 8g range
Ok, now you want to convert LSBs to m/s^2. You know that 4096 LSBs are equal to 1g = 9.81m/s^2 (when you have set 8g range. If you set 2g range then 16384 LSBs are 1g). The only thing that you have to apply is the direct rule of three. Let's denote X the returning value from your sensor in LSB and Y the corresponding value in m/s^2 then the formula in order to find Y is:
Y = (9.81X) / 4096 or Y = (9.81X) / sensitivity or Y = (8*9.81*X) / (2^15)
Hope this helps