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

BNO055 Quaternion returns None
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BNO055 Quaternion returns None

by RossU on Fri Sep 18, 2020 2:43 pm

I'm trying to use the BNO055 to provide orientation so I can correct the output of an array of lis3mdl magnetometers. My issue is that a lot of the time bno055.quaternion returns [None, None, None, None], which means I don't have the data to do the rotation correction. (I get lots of Nones even running the simple test example). I've tried the simple fix of asking multiple times until I get something that isn't None, but this is commonly taking more than 100 requests. Is there a way to get it to return useful data more frequently.

I set things up with
self._absOr = adafruit_bno055.BNO055_I2C(self._i2c)
self._absOr.mode = adafruit_bno055.IMUPLUS_MODE
and then read sometime later with
opBuf = self._absOr.quaternion
but as I say, even the simple test returns a lot of Nones

Posts: 15
Joined: Tue Jun 21, 2016 2:28 pm

Re: BNO055 Quaternion returns None

by siddacious on Tue Sep 22, 2020 5:00 pm

The quaternion property is returning Nones because it is not enabled in the IMUPLUS_MODE.

If you take a look at the documentation for the mode property, it has a table of what is enabled in each mode:

You have a few options, but the default NDOF_MODE will work

Posts: 337
Joined: Fri Apr 21, 2017 3:09 pm

Re: BNO055 Quaternion returns None

by RossU on Wed Sep 23, 2020 8:29 am

Okay. I saw the system wouldn’t return absolute position, but the documentation I looked at suggested it would do relative position, which would have been good enough. Also, I think the NDOF mode is supposed to be relatively slow. When I tried it previously, I had to ask on average 7 times before I got a non None reply. Still, if that is what is required, I can work with that.

Posts: 15
Joined: Tue Jun 21, 2016 2:28 pm

Re: BNO055 Quaternion returns None

by gammaburst on Wed Sep 23, 2020 9:27 am

Hi RossU, you are correct, the BNO055 does provide relative quaternion in IMUPLUS mode.
Here's a working sketch for Arduino IDE. It's not CircuitPython, but maybe it will help you.
Notice that I use an additional output pin to reset the BNO055.
On an Arduino Uno it outputs 100 measurements per second in either IMUPLUS or NDOF mode.

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_BNO055.h>

#define BNO_RST     11      // pin number of BNO055 RST
#define BAUDRATE    115200  // serial port baud rate
#define PERIOD_MS   10      // time between measurements, milliseconds

Adafruit_BNO055 bno = Adafruit_BNO055(1);
unsigned long tprev;

void setup(void)

  Wire.setClock(400000L);           // I2C speed

  pinMode(BNO_RST, OUTPUT);         // assert BNO RST
  pinMode(BNO_RST, INPUT_PULLUP);   // deassert BNO RST
  delay(800);                       // allow time for BNO to boot
  delay(10);                        // allow time for BNO to switch modes

  tprev = millis();

void loop(void)
  imu::Quaternion q = bno.getQuat();
  Serial.print("Quaternion: ");
  Serial.print(q.w(), 4);  Serial.print(" ");
  Serial.print(q.x(), 4);  Serial.print(" ");
  Serial.print(q.y(), 4);  Serial.print(" ");
  Serial.print(q.z(), 4);  Serial.println("");

  while (millis() - tprev < PERIOD_MS);  // wait until next measurement
  tprev += PERIOD_MS;

Posts: 489
Joined: Thu Dec 31, 2015 12:06 pm

Please be positive and constructive with your questions and comments.