BNO055 losing orientation data after some time

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

BNO055 losing orientation data after some time

Post by elk_turing »

Hello all,

I have a BNO055 that I use for retrieving compass headings using the Adafruit Github project.
This compass is mounted on a robot body that also includes three motors for moving the robot.

I am able to calibrate and get accurate compass readings using OPERATION_MODE_NDOF:

Code: Select all

  sensors_event_t orientationData;
  this->bno.getEvent(&orientationData, Adafruit_BNO055::VECTOR_EULER);

  int trueNorth = orientationData.orientation.x + this->magnetic_declination;
  if (trueNorth >= 360) {
    trueNorth %= 360;  
  }
  return trueNorth; 
This code works well but after some time, the compass readings go to a constant '0' value and does not change. The only way I can get out of this is by restarting and starting a new calibration.

Any ideas what might be causing the compass to lose compass readings after some time? Can I have a faulty component?

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: BNO055 losing orientation data after some time

Post by sj_remington »

Read out the calibration status of the BNO055, as it frequently changes. If uncalibrated, the orientation results are usually meaningless.

Motor activity, changes in current flow in wires near the sensor, or positioning of magnetized or iron containing objects all introduce distortions into the local magnetic field.

https://learn.adafruit.com/adafruit-bno ... alibration

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

sj_remington wrote: Mon Sep 19, 2022 10:40 am Read out the calibration status of the BNO055, as it frequently changes. If uncalibrated, the orientation results are usually meaningless.

Motor activity, changes in current flow in wires near the sensor, or positioning of magnetized or iron containing objects all introduce distortions into the local magnetic field.

https://learn.adafruit.com/adafruit-bno ... alibration
Thanks for the helpful link and info!

I have been reading out the calibration statuses for system, gyro, mag and accel. Typically, I can initially fully calibrate the system (system = gyro = mag = 3) but the system loses this calibration status pretty quickly. Even with system less than 3, I am able to get relatively good readings for compass heading.

I am also storing the calibration values (hard/soft iron etc) once calibrated.
Therefore, I am thinking that I can get the system back into calibration if I reload (setsensoroffsets(...)) the calibration values whenever system becomes uncalibrated. Do you think this will work?

User avatar
gammaburst
 
Posts: 1014
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 losing orientation data after some time

Post by gammaburst »

When the compass readings go to a constant '0' value, do the pitch and roll angles continue working or do they also go to zero? If everything goes to zero, that suggests the BNO055 is no longer communicating properly or has somehow jumped into CONFIG mode.

If all the values go to zero, and if you have some spare parts, try temporarily connecting a resistor (about 2K to 3K ohms) from signal SCL to the BNO's power input pin. See if that helps.

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: BNO055 losing orientation data after some time

Post by sj_remington »

Do you think this will work?
Yes, for a while. You can't turn off the automatic calibration, so it may overwrite the calibration offsets at some point.

The calibration on the BNO055 is poorly documented, very primitive and does not work well. That is one of the most serious failings of this particular sensor.

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

gammaburst wrote: Tue Sep 20, 2022 1:31 pm When the compass readings go to a constant '0' value, do the pitch and roll angles continue working or do they also go to zero? If everything goes to zero, that suggests the BNO055 is no longer communicating properly or has somehow jumped into CONFIG mode.

If all the values go to zero, and if you have some spare parts, try temporarily connecting a resistor (about 2K to 3K ohms) from signal SCL to the BNO's power input pin. See if that helps.
Good idea, I have not recorded the pitch and roll angles but I will print these values out when testing to see what happens. I am guessing the resistor should help smooth out any current surges?

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

sj_remington wrote: Tue Sep 20, 2022 3:35 pm
Do you think this will work?
Yes, for a while. You can't turn off the automatic calibration, so it may overwrite the calibration offsets at some point.

The calibration on the BNO055 is poorly documented, very primitive and does not work well. That is one of the most serious failings of this particular sensor.
Thanks for the insight, yeah I found the BNO055 documentation very lacking, do you recommend any other sensors? I just need compass readings so any magnetometer can probably work as well, I use this for navigation on a robot that is primarily outdoors.

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

elk_turing wrote: Wed Sep 21, 2022 1:28 pm
gammaburst wrote: Tue Sep 20, 2022 1:31 pm When the compass readings go to a constant '0' value, do the pitch and roll angles continue working or do they also go to zero? If everything goes to zero, that suggests the BNO055 is no longer communicating properly or has somehow jumped into CONFIG mode.

If all the values go to zero, and if you have some spare parts, try temporarily connecting a resistor (about 2K to 3K ohms) from signal SCL to the BNO's power input pin. See if that helps.
Good idea, I have not recorded the pitch and roll angles but I will print these values out when testing to see what happens. I am guessing the resistor should help smooth out any current surges?
Testing this out, and got the following values:

Code: Select all

orientation.x: -0.06
orientation.y: -0.06
orientation.z: -0.06
orientation.pitch: -0.06
orientation.roll: -0.06
orientation.heading: -0.06

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: BNO055 losing orientation data after some time

Post by sj_remington »

For a compass, tilt compensation is very important. For that you need an accelerometer and magnetometer.

Just about any modern 9DOF sensor, or 6DOF acc/mag combo will work better than the BNO055, as you have complete control over the absolutely critical step of sensor calibration.

For the most complete overview of calibration, see this tutorial: https://thecavepearlproject.org/2015/05 ... r-arduino/

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

sj_remington wrote: Wed Sep 21, 2022 5:40 pm For a compass, tilt compensation is very important. For that you need an accelerometer and magnetometer.

Just about any modern 9DOF sensor, or 6DOF acc/mag combo will work better than the BNO055, as you have complete control over the absolutely critical step of sensor calibration.

For the most complete overview of calibration, see this tutorial: https://thecavepearlproject.org/2015/05 ... r-arduino/
Thanks for the link, any modern 9DOF or 6DOF sensor you recommend?

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: BNO055 losing orientation data after some time

Post by sj_remington »

I'm happy with the LSM9DS1, which has much better performance than the BNO055.

Both AHRS and tilt-compensated compass code are available at https://github.com/jremington/LSM9DS1-AHRS

User avatar
gammaburst
 
Posts: 1014
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 losing orientation data after some time

Post by gammaburst »

Hi elk_turing,
Your -0.06 readings (all data bytes 0xFF) suggest an I2C problem.

Did you try my resistor suggestion? No, it doesn't smooth anything. It helps to overcome an I2C timing violation caused by a design error in the BNO055/BNO085's I2C controller. The timing violation causes intermittent unstable I2C transfers, just like you described in your first message. If you don't have a resistor, try this simple touch test: viewtopic.php?p=889280#p889280

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

gammaburst wrote: Fri Sep 23, 2022 5:48 pm Hi elk_turing,
Your -0.06 readings (all data bytes 0xFF) suggest an I2C problem.

Did you try my resistor suggestion? No, it doesn't smooth anything. It helps to overcome an I2C timing violation caused by a design error in the BNO055/BNO085's I2C controller. The timing violation causes intermittent unstable I2C transfers, just like you described in your first message. If you don't have a resistor, try this simple touch test: viewtopic.php?p=889280#p889280
Hey Gamma, sorry forgot to update this, yes I tried a 3K resistor from power input (Vcc) to SCL and got the same results. Do you think I should also do this for Vcc to SDA?

Thanks for the link!

Edit:

Read more into your provided link, thank you for the insight! You give great explanations, you mentioned pull-up resistor from Vcc to SDA in that link. Is this what I should have done instead of from VCC to SCL?

User avatar
gammaburst
 
Posts: 1014
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 losing orientation data after some time

Post by gammaburst »

Oops, sorry for the mistake!
Adding a resistor from Vcc to SCL increases the timing problem - don't do that.
Adding a resistor from Vcc to SDA reduces the timing problem - try doing that.

I wish I could somehow go back and add a comment/correction to my erroneous message.

User avatar
elk_turing
 
Posts: 9
Joined: Mon Sep 19, 2022 10:10 am

Re: BNO055 losing orientation data after some time

Post by elk_turing »

gammaburst wrote: Sat Sep 24, 2022 12:43 pm Oops, sorry for the mistake!
Adding a resistor from Vcc to SCL increases the timing problem - don't do that.
Adding a resistor from Vcc to SDA reduces the timing problem - try doing that.

I wish I could somehow go back and add a comment/correction to my erroneous message.
No worries, I made the switch to SDA and so far, from my initial testing, it is working much better. Going to test more later this evening.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”