Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BNO055 Linear Acceleration

    BNO055 Linear Acceleration

    smhap
    Member

    Hi, 

    I'm trying to read the linear acceleration register in NDOF fusion mode. From my understanding, the x, y, z values when the sensor is at rest should be 0 or at least close to 0. After I read the MSB, I shift it by 8 and OR it with the LSB. After this, I noticed something weird. While most readings are +/- 0.0x, there are times when I see +/- 2.5 on one of the three axes randomly without any movement. I'm not sure why this is happening. 

    Also, I'm using it in default accelerometer config, so I'm guessing its +/- 4G. 

    What might be causing that +/- 2.5?

    4 REPLIES 4

    Vincent
    Community Moderator
    Community Moderator

    Can you tell me which mode are you using for linear acc output and the unit of this +/- 2.5 change. ?  Is it NDoF mode or IMU mode for working mode and 2.5 LSB jumper?  

    The default setting of accel is 4G. 

    You combined the LSB and MSB, so it is difficult to identify the issue you mentioned.  Linear Acc will still have offset, noise inside after calculation by fusion algorithm.   Maybe see the plotting by whole 16 bit is more helpful to understanding this issue.

    Not sure what you mean. I'm using NDOF fusion mode. 

    The linear accerelation that I read from the registers, I store it and divide it by 100.0. Here's my function. 

    void bno055GetLinearAcc(acc_data *data) {
        int16_t x, y, z;
    
        x = bno055GetData(BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR , BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR);
        y = bno055GetData(BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR , BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR);
        z = bno055GetData(BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR , BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR);
    
        data->x = ((double)x)/100.0;
        data->y = ((double)y)/100.0;
        data->z = ((double)z)/100.0;
    }

    Here's what getData looks like: 

    int16_t bno055GetData(uint8_t msb_reg, uint8_t lsb_reg) {
        uint8_t msb = bno055ReadReg(msb_reg);
        delay_ms(50);
        uint8_t lsb = bno055ReadReg(lsb_reg);
        delay_ms(50);
        return (((int16_t)msb << 😎 | (int16_t)lsb);
    }

    and this is the structure I'm using to store it:

    typedef struct {
        double x;
        double y;
        double z;
    } acc_data;

    What could I be doing wrong? Or is it just noise? 

    Here are some readings of linear acceleration. You can see 2-3 instances of +/- 2.5:

    x	y       z
    0.12	0.01	0.05
    0.11	0.02	0.02
    0.13	0	0.07
    0.12	0.01	0.05
    0.14	0.01	0.06
    0.13	0.02	0.06
    0.13	0.02	0.06
    0.13	0.02	0.05
    0.13	0	0.05
    0.12	0.01	0.07
    0.13	0.02	0.05
    0.11	0	0.06
    0.12	0.01	0.04
    0.13	0	0.08
    0.12	0.02	0.07
    0.14	0.03	0.05
    0.12	0.02	0.07
    0.12	0.01	0.06
    0.09	-2.56	0.07
    0.07	0.01	0.05
    0.08	0	0.06
    0.08	0.02	0.07
    0.09	0	0.07
    0.12	0.02	-2.41
    0.06	0	0.08
    0.07	0.01	0.07
    0.07	0	0.06
    0.05	0.02	0.06
    0.05	0	0.07
    0.03	0.02	0.07
    0.11	0.01	0.05
    0.11	0	0.07
    0.13	0.06	2.44
    0.08	0	0.07
    0.1	0	0.04
    0.07	0	0.06
    0.04	0	0.05
    0.06	0	0.03
    0.07	0	0.04

     

     

    Took some readings again and this time it was far worse. 

    x	y	z
    0.09	0.07	0.11
    -2.49	-2.54	0.11
    -0.22	0.09	0.01
    0.06	-2.55	0.09
    0.13	0.01	0.09
    -2.55	0.01	0.02
    0	0.08	0.11
    -0.04	-2.49	0.09
    -0.02	0	0.12
    -0.06	0	2.08
    0.2	0.02	0.1
    2.51	0	0.1
    2.48	2.52	0.1
    2.37	2.42	0.08
    0.13	2.46	0.17
    0.12	-2.53	0.08
    -0.06	2.52	0.09
    2.53	0	0.12
    0.11	2.53	0.12
    -0.08	-2.53	0.11
    -0.02	2.55	0.11
    -2.32	-2.56	0.09
    -2.56	2.53	0.12
    -2.49	0.08	-2.47
    -0.09	2.52	0.12
    2.5	-2.51	0.11
    0.18	0.05	0.08
    -2.48	-2.56	0.08
    -0.25	2.51	0.12
    0.06	-2.49	0.08
    0	-2.43	0.1
    0.02	0.03	0.08
    2.55	0.02	0.1
    -0.07	-2.54	-2.42
    -2.42	-2.32	0.1
    -0.03	-2.51	0.09
    0	-2.54	0.1
    -2.54	0.04	0.12
    2.5	-0.01	0.1
    2.55	0.02	0.08
    0.02	-2.56	0.11
    0	2.41	0.06
    0.07	-0.02	0.11
    0.03	-0.03	0.1
    -2.52	-2.54	0.13
    0	2.54	0.07
    -2.56	0	0.04
    0.01	0.02	0.09
    -2.56	2.5	0.1
    2.37	-2.44	0.11

    Please help me!

    Vincent
    Community Moderator
    Community Moderator

    I saw your funciton to read out sensor data, but you put 50ms delay between reading MSB and LSB. 

    This is not correct.

    Since our internal ODR is 100Hz, then you are not geting corresponding LSB with MSB. 

    Here we suggest to use burst read to read out all data register then you got the correct MSB with LSB value. 

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist