For a research project, I am currently trying to read the acceleration data from the BMA280. This chip is used by silabs on there WSTK expansion board. At this moment I'm following a complete procedure to initialize the accelerometer.
The values afterwards are x=+-20mg, y=+-2mg en z=+- -19mg. I expected the values would be x=+-0g, y=+-0g en z=+- -1g when the chip is laying flat on my desk.
I convert the acceleration data in this way.
volatile float factor = 0.488; // 8000/2^14 mg/LSB // X-Axis in 0x02-0x03 LSBx = BMA280_read_register(USART1, BMA280_ACCD_X_LSB); LSBx = LSBx >> 2; MSBx = BMA280_read_register(USART1, BMA280_ACCD_X_MSB); tmpx = (uint16_t)((MSBx << 6) | LSBx); acceleration = (float) tmpx * factor;
Can somebody confirm me If this is correct? Or give me the correct init from the accelerometer?
Thank you in advance
Solved! Go to Solution.
Thanks for your inquiry. Please see the attached "How to perform BMA253 self-test.pdf" and "How to do BMA253 inline calibration.pdf" which can be applied to BMA280 as well.
Due to the noise of intenral ADC, after inline calibration BMA280 x/y/z measurements or outputs will not be exactly at 0g and +1g when it is stationary and flat on your table. Instead, they should be very close to 0g and +1g. For example, if you select BMA280 BW to 125Hz which is 250Hz output data rate, then you should see the x/y/z outputs within +/-5mg with regrad to 0g and +1g.
Thanks for the reply.
I checked both PDF and adjusted my code. When I perform the self test I get values (x=12599LSB, y=13235LSB, z=13589LSB) So the self test passes. The calibartion (fast compensation +-2G) gave me (x=-5LSB, y=1LSB, z=-2LSB). But when the chip is flat on my desk with a refresh rate of 125Hz I get these values:
x: 16,0 mg y: 51,172 mg z: -25,252 mg
x: 15,0 mg y: 53,216 mg z: -21,240 mg
x: 17,0 mg y: 54,116 mg z: -19,240 mg
x: 18,0 mg y: 54,16 mg z: -23,252 mg
x: 20,0 mg y: 50,184 mg z: -20,96 mg
So I think, I do something wrong with the conversion of LSB to g or mg.
volatile uint16_t tmpx = 0, tmpy = 0, tmpz = 0; volatile uint8_t MSBx = 0, LSBx = 0, MSBy = 0, LSBy = 0, MSBz = 0, LSBz = 0; volatile float factor = 0.488; //mg/LSB 8000/2^14 for range of +-4G // X-Axis in 0x02-0x03 LSBx = BMA280_read_register(USART1, BMA280_ACCD_X_LSB); MSBx = BMA280_read_register(USART1, BMA280_ACCD_X_MSB); tmpx = (uint16_t)(((MSBx << | LSBx) >> 2); acceleration = (float) tmpx * factor;
Is this the correct way?
Thx for the previous help!!