07-08-2020 07:05 PM - edited 07-09-2020 01:59 PM
Dear community,
I am currently integrating the Bosch BSXlite library into my IMU project, working with the BMI088 and the BMX160.
Since the sensors accelerometer range can be chosen to be 3, 6, 12 or 24g (BMI088) and 2, 4, 8 or 16g (BMX160), resulting in different g per LSB- measurements, I wonder how to set up the range using the BSXlite library (which itself requires the input to be in LSB) to fetch valid output.
I could not find any instructions regarding this in the integration/api documentation.
I did find the bsx_set_accrange(BSX_U8) function in the library's header files, which is only defined for BSX_ACCRANGE_2G, 4G, 8G and 16G, hinting to only be compatible with the BMX160 (though bmi088 links to the bsx library as well).
Am I supposed and if so how, to set up the range of the used sensors within my BSXlite code? (I am aware that with BSXlite, I probably won't have to set the gyroscope's and the magnetometer's range since they are fixed to be 500dps and 16uT/LSB).
Appreciate any help.
Best regards,
George
Solved! Go to Solution.
07-16-2020 11:10 AM
Hi,
If you use the default configuration, the bmi160's API will provide the output in units of LSB.
The default configuration of bmi160 is +/- 2g and resolution = 0.061mg/LSB. (The resolution is determined by the hardware and range, which is the minimum value that the sensor can measure.) In this case, the obtained sensor output can be directly used as bsxlite input. As a result, it is reasonable to use LSB(0.061 mg) as the input unit of bsxlite.
BMI160 has different sensitivity for different range configuration. For example,
Default configuration:
ACC: +/- 2g, output = 1 LSB = 0.061 mg; GYRO: +/-500 dps, the input gyro data unit =1 LSB = 500dps/16384 = 0.0153 dps.
Then,
bmi160_get_sensor_data(&acc_x, &acc_y, &acc_z, &gyr_x, &gyr_y, &gyr_z);
libraryInput_ts.acc.data.x = acc_x; libraryInput_ts.acc.data.y = acc_y; libraryInput_ts.acc.data.z = acc_z;
libraryInput_ts.gyro.data.x = gyr_x;libraryInput_ts.gyro.data.y = gyr_y;libraryInput_ts.gyro.data.z = gyr_z;
Other configurations:
ACC: +/- 4g, output = 1 LSB = 0.12 mg; GYRO: +/-1000 dps, the input gyro data unit =1 LSB = 1000dps/16384 = 0.03 dps.
bmi160_get_sensor_data(&acc_x, &acc_y, &acc_z, &gyr_x, &gyr_y, &gyr_z);
libraryInput_ts.acc.data.x = 2*acc_x; libraryInput_ts.acc.data.y = 2*acc_y; libraryInput_ts.acc.data.z = 2*acc_z;
libraryInput_ts.gyro.data.x = 2*gyr_x;libraryInput_ts.gyro.data.y = 2*gyr_y;libraryInput_ts.gyro.data.z = 2*gyr_z;
Note that the user has to ensure that the input units are correct, or bsxlite will not give the correct outputs.
07-16-2020 01:29 PM - edited 07-16-2020 05:22 PM
Thanks a lot for the detailed answer and for making this clear.
As far as I understand now, the configuration string I asked about here is used to tell the bsxLite API the sensor's default settings.
The user can than decide to :
1. Set up the sensor itself with its default settings for accel&gyro-range, fetch its data and feed it to the bsxLite API as it is.
or
2. Use whatever range he wants, fetch the sensor's data and convert it to the sensor's default LSB/dps or LSB/mg range before feeding it to the bsxLite API.
I still wonder how to find the default values for the magnometer (bmm150) are. According to the Datasheet the resolution is 0.3 microTesla.
Bmm150's api returns 1lsb/microTesla. According to this user this is not a valid input, as he used the "raw" api data, which is 1lsb/(1/16) microTesla, which again is different from the sensors resolution.
Cheers!