Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BNO055 Sensor Suddenly Displays All Zeros

    BNO055 Sensor Suddenly Displays All Zeros

    Jake_CSU
    Occasional Visitor

    Hello,

    I am using two BNO055 sensors, and I just want to get the raw data from the accelerometer and gyroscope for my project. Randomly, one or both of the senors will suddenly start to display all zeros (see image below).

    Jake_CSU_0-1668533446473.png

    I am assuming this is occuring because the device is put into suspension mode, but I do not know what would cause this. My code is below for reference.

    #include <Wire.h>
    #include <Adafruit_Sensor.h>
    #include <Adafruit_BNO055.h>
    #include <utility/imumaths.h>
    #include <EEPROM.h>

    Adafruit_BNO055 bnoA = Adafruit_BNO055(-1, BNO055_ADDRESS_A);
    Adafruit_BNO055 bnoB = Adafruit_BNO055(-1, BNO055_ADDRESS_B);
    #define BNO055_SAMPLERATE_DELAY_MS (100)


    /**************************************************************************/
    /* Non-Fusion
    * Configuration mode = CONFIG (default)
    * Accel and gyro = ACCGYRO
    * Initialize and Calibrate IMU */
    /**************************************************************************/

    void setup(void)
    {
    Serial.begin(115200);

    bnoA.begin(OPERATION_MODE_ACCGYRO);
    bnoA.setExtCrystalUse(true);
    bnoA.setRanges();

    bnoB.begin(OPERATION_MODE_ACCGYRO);
    bnoB.setExtCrystalUse(true);
    bnoB.setRanges();

    delay(500);
    }

    void loop(void)
    {
    //Functions to retrieve and send serial data

    getAcc();
    getGyro();

    delay(BNO055_SAMPLERATE_DELAY_MS);
    }

    void getAcc() {
    double xA = -1000, yA = -1000 , zA = -1000 , xB = -1000 , yB = -1000 , zB = -1000; //dumb values, easy to spot problem

    imu::Vector<3> accA = bnoA.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);
    xA = accA.x();
    yA = accA.y();
    zA = accA.z();

    imu::Vector<3> accB = bnoB.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);
    xB = accB.x();
    yB = accB.y();
    zB = accB.z();

    Serial.print("Acc 1:");
    Serial.print(" | x= ");
    Serial.print(xA);
    Serial.print(" | y= ");
    Serial.print(yA);
    Serial.print(" | z= ");
    Serial.print(zA);

    Serial.print(" | Acc 2:");
    Serial.print(" | x= ");
    Serial.print(xB);
    Serial.print(" | y= ");
    Serial.print(yB);
    Serial.print(" | z= ");
    Serial.print(zB);

    }

    void getGyro() {
    double xA = -1000, yA = -1000 , zA = -1000 , xB = -1000 , yB = -1000 , zB = -1000;

    imu::Vector<3> gyroA = bnoA.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);
    xA = gyroA.x();
    yA = gyroA.y();
    zA = gyroA.z();

    imu::Vector<3> gyroB = bnoB.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);
    xB = gyroB.x();
    yB = gyroB.y();
    zB = gyroB.z();

    Serial.print(" | Gyro 1:");
    Serial.print(" | x= ");
    Serial.print(xA);
    Serial.print(" | y= ");
    Serial.print(yA);
    Serial.print(" | z= ");
    Serial.print(zA);

    Serial.print(" | Gyro 2:");
    Serial.print(" | x= ");
    Serial.print(xB);
    Serial.print(" | y= ");
    Serial.print(yB);
    Serial.print(" | z= ");
    Serial.println(zB);
    }

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Dear user, unfortunately this product is no longer available for new designs. Please contact one of our official distributors or sales representatives for alternative products. Thank you!

    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