I would like to daisy chain multiple BNO080s. I used the example1_Basics from the SparkFun_ICM-20948_ArduinoLibrary-master and added a Processing program to watch the results using one BNO080.
Now I want to move on to having more than one of the BNO080s daisy chained together. I don’t expect any problem modifying the Processing program to show the separate results. But, I’m starting from scratch when it comes to the daisy chaining. I looked through the IMU forum and did not recognize any Qwiic examples. The only thing I have seen on coding for daisy chaining is the topic titled “Daisy Chaining Quiic Twists - Dev-15083.” Are Qwiic sensors similar enough that the Twist example is all I should need? If so, I’ll dig deeper into it and try to pull out the relevant parts before asking more questions. If not, can someone please point me to a more relevant example (or the fundamental guide that will get me started)? I suppose a fundamental question is do I have to learn I2C (say from https://www.i2c-bus.org/i2c-primer/) and program this up from scratch, or is there existing code I could tag along and learn from?
Hi SlopeSurfer,
You can chain two of these sensors together on a single I2C bus by adjusting the “ADR” (or Address) jumper on the back of the board. The board ships with it open and the address defaults to 0x4B and if you close the jumper, it will switch the I2C address to 0x4A. If you want to use more than two of these over I2C, you will need a MUX like the [SparkFun Qwiic Mux Breakout. That will allow you to have up to 8 devices with identical addresses on a single I2C bus. I would recommend reading through the [Hookup Guide for that breakout to get a general idea of how to use it. The example in that guide is for a different accelerometer but you can apply the same theory used there to use it with a BNO080 breakout.
Another option to use multiple BNO080 Breakouts with a single microcontroller is to use [SPI. This will allow you to have all of the sensors sharing the communication pins for SPI (MISO, MOSI and SCK) and then you can tie each BNO080’s CS (Chip Select) pin to an available I/O pin on your microcontroller to pick which breakout you want to talk to. We do have a few [SPI Examples in the BNO080 Arduino Library if you want to try using SPI instead of I2C. Just be aware that you will need to solder to the BNO080 as you cannot use the Qwiic connectors for SPI communication.
I hope this helps you get started using multiple BNO080 Breakouts with a single controller. Let us know if you have any other questions or issues and we would be happy to help as much as we can.](SparkFun_BNO080_Arduino_Library/examples/SPI at main · sparkfun/SparkFun_BNO080_Arduino_Library · GitHub)](Serial Peripheral Interface (SPI) - SparkFun Learn)](Qwiic MUX Hookup Guide - SparkFun Learn)](https://www.sparkfun.com/products/14685)
TS-Mark, Thank you for the multiple paths toward success. There is a lot here for me to digest. I’ll either report back with success or more specific questions.
First, I should point out that I was incorrect about the breakout boards I am using. They are ICM_20948s, not BNO080. I don’t think that this made any difference. I purchased a Sparkfun Qwiic Mux Breakout - 8 Channel (TCA9548A) (BOB-14685) and used example code from the hookup guide that you pointed me to.
When I saw the statements
enableMuxPort(i);
accel.init();
disableMuxPort(i);
My first thought was that enableMuxPort(i) was setting up some variables that accel.init() would use. And that I would need to find them and find the equivalent ones in the functions associated with the ICM_20948, in the library (header file ICM_20948.h). When that route came up unsuccessful, it occurred to me that the enableMuxPort(i) command might be directing any i2c calls to the i-th port. So, it just became a matter of surrounding any IMU communication related code by the enable, disable pair for the port that the IMU is connected to. I believe this was a case of the answer being so simple and obvious that I could not find out anything about it. I write this out in case any other newcomers also can’t see the forest through the trees.
Thank-You
Thanks for sharing your insights here! The MUX is a bit confusing if you’ve never used one before but you are exactly correct, you’re just setting up each channel on it and then can communicate with a specific channel without needing to worry too much about I2C addresses (unless you’re using multiple MUXes or multiple I2C devices on the same channel).
Let us know if you run into any other issues with these or other SparkFun products you are using and we would be happy to help!
Along this same path, I connected sensors to each of the eight MUX ports and then daisy-chained second sensors (with their addresses changed to their second address option) to the first four of the MUX ports. That would give me the 12 IMUs that I want for this project. I used a Redboard for the microcontroller. If I tried to have more than nine sensors, the compiler warned that I was running out of memory and that the results would be unstable. And indeed, that was the case. So, I bought a Qwiic shield that has four ports and put it on an Arduino Mega. It occurred to me that I don’t know how to separately communicate with the ports. I thought that maybe it would work like the MUX. But, the code I had used on the Redboard just reported back that it could not find MUX port 0. This was not too surprising since the ports are not numbered on the shield. Then I thought that perhaps each of the ports on the Qwiic shield acts like the one port on the Redboard. So, I could just hook up the MUX to one of the ports and run the same code I ran on the Redboard. That did not work either.
I have been through the Qwiic shield hookup guide, searched the Forums and the rest of the net. I suspect this is another case of the answer being so simple that no one mentions it. I assume I could get a Qwiic connector breakout board, connect the appropriate lines to my Mega, and have it behave like a super charged Redboard. But, I should learn how to use the Qwiic shield that I have. Can you point me to any relevant code examples that use the four-connector Qwiic shield?