IMU Adafruit BNO055 library for Simulink

Hi,

Is there someone who has adapted the Adafruit BNO055 library for Simulink?

Thank you in advance,
Pm

Anyone?

What is the best choice:

  • create a S-function in simulink based on the C library.
  • run the IMU recording from arduino IDE and just read received data on the SPI bus in Simulink

Thank you in advance,
Pm

Hi,

Finally I have managed the first method but I am not able to reach 100 Hz!

If someone is interested:
1/ Create a folder (change your Matlab current directory) and copy the following libraries into the folder:
Wire.h
BNO055.h
BNO055.c
Wire.cpp
twi.h
twi.c
NAxisMotion.h
NAxisMotion.cpp

2/ Create a Simulink file, add a S-function builder, open it and set the parameters as it follows:






3/ Buil it and return to your folder directory
4/ Change XXXXXXX_wrapper.c to XXXXXXX_wrapper.cpp
5/ Open XXXXXXX_wrapper.cpp and add 'extern "C" ' before each function (i.e. before each 'void')
6/ In Simulink chose External mode and in configuration parameters set Arduino board in Hardware implementation.


7/ Run and enjoy :slight_smile:

But the problem is the following, when I try to set the sample rate to 100 Hz (0.01s) either in initialization parameter in the S-function builder (sample mode 0.01) either in simulink solver configuration parameters; the IMU output data stay locked after around 2-3 seconds :confused:

I would appreciate some help.
Thank you,
Pm

Anyone ?

Thanks,
Pm

Hello,

I came across your post while attempting to solve the same problem you were having. Thank you very much for posting such a great rundown of how you overcame! I unfortunately wasn't as skilled, and sent a plea to Mathworks, which they responded to. Turns out just this summer (I think) the created a toolbox which includes a .slx file for the BNO055! You might be aware of this already, but thought I would drop a line just in case. The toolbox is called "Arduino_Engineering_Kit_Hardware". Cheers!