Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

BNO055 freeze after few seconds
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BNO055 freeze after few seconds

by atlasvencent on Sun Oct 29, 2017 2:18 pm

Hi, I bought a few new BNO055 from adafruit recently and soldered it to feather M0 board. I wired it exactly the way described in the toturial, and I used the sensorapi example from the adafruit library.. The sensor works fine in the beginning. But more often than not, the sensor would stop responding after a few seconds, and the there would be no data sent to the serial monitor anymore. This happens all the time no matter which example I use. Is there any way to fix this?


Here's the code from sensor api:

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
   which provides a common 'type' for sensor data and some helper functions.
s
   To use this driver you will also need to download the Adafruit_Sensor
   library and include it in your libraries folder.

   You should also assign a unique ID to this sensor for use with
   the Adafruit Sensor API so that you can identify this particular
   sensor in any data logs, etc.  To assign a unique ID, simply
   provide an appropriate value in the constructor below (12345
   is used by default in this example).

   Connections
   ===========
   Connect SCL to analog 5
   Connect SDA to analog 4
   Connect VDD to 3-5V DC
   Connect GROUND to common ground

   History
   =======
   2015/MAR/03  - First release (KTOWN)
   2015/AUG/27  - Added calibration and system status helpers
*/

/* Set the delay between fresh samples */
#define BNO055_SAMPLERATE_DELAY_MS (100)

Adafruit_BNO055 bno = Adafruit_BNO055(55);

/**************************************************************************/
/*
    Displays some basic information on this sensor from the unified
    sensor API sensor_t type (see Adafruit_Sensor for more information)
*/
/**************************************************************************/
void displaySensorDetails(void)
{
  sensor_t sensor;
  bno.getSensor(&sensor);
  Serial.println("------------------------------------");
  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" xxx");
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" xxx");
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" xxx");
  Serial.println("------------------------------------");
  Serial.println("");
  delay(500);
}

/**************************************************************************/
/*
    Display some basic info about the sensor status
*/
/**************************************************************************/
void displaySensorStatus(void)
{
  /* Get the system status values (mostly for debugging purposes) */
  uint8_t system_status, self_test_results, system_error;
  system_status = self_test_results = system_error = 0;
  bno.getSystemStatus(&system_status, &self_test_results, &system_error);

  /* Display the results in the Serial Monitor */
  Serial.println("");
  Serial.print("System Status: 0x");
  Serial.println(system_status, HEX);
  Serial.print("Self Test:     0x");
  Serial.println(self_test_results, HEX);
  Serial.print("System Error:  0x");
  Serial.println(system_error, HEX);
  Serial.println("");
  delay(500);
}

/**************************************************************************/
/*
    Display sensor calibration status
*/
/**************************************************************************/
void displayCalStatus(void)
{
  /* Get the four calibration values (0..3) */
  /* Any sensor data reporting 0 should be ignored, */
  /* 3 means 'fully calibrated" */
  uint8_t system, gyro, accel, mag;
  system = gyro = accel = mag = 0;
  bno.getCalibration(&system, &gyro, &accel, &mag);

  /* The data should be ignored until the system calibration is > 0 */
  Serial.print("\t");
  if (!system)
  {
    Serial.print("! ");
  }

  /* Display the individual values */
  Serial.print("Sys:");
  Serial.print(system, DEC);
  Serial.print(" G:");
  Serial.print(gyro, DEC);
  Serial.print(" A:");
  Serial.print(accel, DEC);
  Serial.print(" M:");
  Serial.print(mag, DEC);
}

/**************************************************************************/
/*
    Arduino setup function (automatically called at startup)
*/
/**************************************************************************/
void setup(void)
{
  Serial.begin(9600);
  Serial.println("Orientation Sensor Test"); Serial.println("");

  /* Initialise the sensor */
  if(!bno.begin())
  {
    /* There was a problem detecting the BNO055 ... check your connections */
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
    while(1);
  }

  delay(1000);

  /* Display some basic information on this sensor */
  displaySensorDetails();

  /* Optional: Display current status */
  displaySensorStatus();

  bno.setExtCrystalUse(true);
}

/**************************************************************************/
/*
    Arduino loop function, called once 'setup' is complete (your own code
    should go here)
*/
/**************************************************************************/
void loop(void)
{
  /* Get a new sensor event */
  sensors_event_t event;
  bno.getEvent(&event);

  /* Display the floating point data */
  Serial.print("X: ");
  Serial.print(event.orientation.x, 4);
  Serial.print("\tY: ");
  Serial.print(event.orientation.y, 4);
  Serial.print("\tZ: ");
  Serial.print(event.orientation.z, 4);

  /* Optional: Display calibration status */
  displayCalStatus();

  /* Optional: Display sensor status (debug only) */
  //displaySensorStatus();

  /* New line for the next sample */
  Serial.println("");

  /* Wait the specified delay before requesting nex data */
  delay(BNO055_SAMPLERATE_DELAY_MS);
}

atlasvencent
 
Posts: 1
Joined: Thu Oct 05, 2017 9:15 pm

Re: BNO055 freeze after few seconds

by duckman01 on Mon Oct 30, 2017 4:42 pm

atlasvencent, the only suggestion l can give, which fixed the same problem is in the cabling from the I2C comm's IMU to Arduino board.
Even with short pinned cables l had the IMU lock up.
I now have up to 8M of cat 5 cable and have not had any further Lock Up.
Blue/Blue white = 5 or 3V +
Orange = SDA
Brown white = SDL
Orange white + Brown = not connected/cut off short at IMU end, connect other end as below
all others = 5 or 3V -

duckman01
 
Posts: 107
Joined: Thu Jun 02, 2016 6:34 pm

Re: BNO055 freeze after few seconds

by gammaburst on Wed Nov 01, 2017 2:30 am

My BNO055 was very intermittent when connected to a Feather M0 WiFi. I fixed it by simply adding unequal I2C pullup resistors: 2.2K on SDA, and 4.7K on SCL. (It helps overcome an unfortunate tight timing situation caused by the BNO055.) Maybe that will work for you too.

gammaburst
 
Posts: 492
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 freeze after few seconds

by bretthoward on Sat Jan 20, 2018 6:41 pm

I'm having a similar issue where it runs for quite a while (like 20+ minutes) and then all the sudden poof it crashes the whole thing and with a few print statements I've narrowed the problem down to the area where I read from the BNO055. In checking my pullups I'm at about 2400 ohms on SCL and SDA without extra pullup resistors because on the I2C bus I have a Alpha numeric display, An APDS9960 optical sensor breakout, and a BMP280 Barometric pressure sensor on the bus with it... I've even added the compTimer logic in there to slow down how often I read from it which seems to make things more stable but not rock solid like I need...

Code: Select all | TOGGLE FULL SIZE
cout << "About to check heel " << millis() << endl;
  //Determine if we're over heeling
  if(millis() > compTimer + 100) {
    bno.getEvent(&compEvent);
    curHeelAngle = abs(compEvent.orientation.y);
    compTimer = millis();
  }
  cout << "Got the event from the compass" << endl;

bretthoward
 
Posts: 37
Joined: Thu Dec 21, 2017 8:47 pm

Please be positive and constructive with your questions and comments.