BNO085 or BNO080 IMU

Hello,

Here is my edited version fo Autosteer_USB_4.3.10.ino to use BNO08x with AOG.
It’s based on previous code posted, but with some improvement in the .ino and in the Sparkfun Library:

  • I add in the library the possibility to plot the current calibration configuration
  • When we enable a BNO08x report, the BNO08x respond with a report to confirm the correct activation of the report: I add functions to retrieve this report and check if the report is correctly enable

The code is available in the following zip (I would see later to put it on GitHub): https://1drv.ms/u/s!At0hnqbQtv42pVtYpDwNU0x2fiqq?e=oexJXw
All edited line are identified with a comment starting by “Edited by Math”, so you can easily found the edited lines.

The code let you choose if you want to use BNO08x instead of MMA, or instead BNO055 or instead of both (so you can easily switch from one module to the orther if you want to make comparativ test). So at the begining of code you have a config zone with:

  • BNO08x_ADRESS: adresse of the BNO, 0x4A for Adafruit BNO085 board, 0x4B for Sparkfun BNO080 board
  • USE_BNO08X_ROLL: set to 1, it will force the .INO to use the BNO08x for roll instead of MMA/DOGS2 (regardless of the Inclinometer you have choose in AOG module configuration page)
  • USE_BNO08X_HEADING: set to 1, it will force the .INO to use the BNO08x for heading instead of BNO055 (regardless if BNO is selected or not in AOG module configuration page)
  • REPORT_INTERVAL: if you want to change report interval of the Rotation Vector report, for advanced users
  • ENABLE_GYRO_CAL: set to 1 if you want to enable the background gyroscope calibration. By default background calibration is enable only for magnetometer and accelerometer. If you set this parameter to 1, during the setup, the Arduino will check the BNO08x background calibration enable and print it to the serial port, so with a serial consol you can check if the calibration are correctly enable

Even if you choose to use BNO08x for roll, in the AOG module configuation page you can still choose the inclinometer axis: the MMA axis selection, will change the BNO08x axis use for roll. If you need to inverse roll value for BNO08x, you just have to activate “invert roll” in AOG module configuration page.

The code is made so that, if we want to add BNO08x as an official alternativ of MMA/BNO055, I can be easily edited to treat BNO08x as additionnal option (we just have to define the corrsponding value for aogSettings.BNOInstalled and aogSettings.InclinometerInstalled).

Tested in my test bench it’s work. I will test it in one week on the tractor and I hop it will solve the difficulty I encounter with MMA: Perfect straight line without MMA, slight oscillation with MMA

Math

2 Likes