Connect different imu at different I2C bus

Hi, I would like to read data coming from 2 IMU. Till today, I used only one imu BNO055 Adafruit connected to my portenta h7 SDA and SCL. I would like to understand if I can use the breakout board to have the extension of the I2C and have access to every bus (I2C0,I2C1 and I2C2). I am confused on the way in which I can link, associate the different addresses of different IMUs
I know that the default address of bno055 is 0x28. But how can I continue to give another address to other IMU?

A quick skim through the Adafruit docs suggests that you can change to the alternate I2C address (0x29), but only if you have the STEMMA variant of the board.

Otherwise you can use an I2C multiplexer like this one:

In order to "switch" between IMU's you need to tell the multiplexer which of the 8 I2C busses you want to use.

Honestly this multiplexere could be my solution. I saw it and I think it is useful so thank You. But, if you know portenta breakout, you just know that it has 3 bus interface for I2C protocol. is there no way to use directly them?

An ESP32 has 2 I2C buses and to use both of them the library constructor should accept the bus object as an input parameter so that each instance of the buss is unique to the library object in use.

I've not used Portenta, but I guess it's wire1, wire2 etc.

But you most likely would need to change the library to support this.

I created 2 objects but it recognize only the first one and the second one equivalent to the first. Can you help me to find the right solution?
Adafruit_BNO055 bnoA = Adafruit_BNO055(0x28);
Adafruit_BNO055 bnoB = Adafruit_BNO055(0x29);

I do not have a BNOthingy I do not have a Portenta. For me to help you you have to help me help you.

Anyways here is the .h file location Adafruit_BNO055/Adafruit_BNO055.h at master · adafruit/Adafruit_BNO055 · GitHub

there is your object initialize from looking at the h file

Adafruit_BNO055(int32_t sensorID = -1, uint8_t address = BNO055_ADDRESS_A,
                  TwoWire *theWire = &Wire);

It looks like the constructor will take its own I2C object. Just pass the buss used as part of the constructor in the proper place in the constructor.

You're in luck that Adafruity wrote their library to take a I2C object.

I am successfully using 2 I2C bussed on the portenta (using the breakout board). Created a little header board that brings out the I2C busses to QWIIC connectors.

Below is a bit of the code that connects to an I2C LCD display


  Wire2.begin();

  Wire2.setClock(100000L);

  I2C_Mutex2.lock();  // wait for Mutex to be available before start using LCD display to show data

  if (EWSetup.getisGPIOPresent() == true && EWSetup.EWgetSavedGPIO(SPI_LCD_GPIO) == 1) {
    SPI_LCD();  // never returns from here
  }

  lcd.begin(Wire2);  //Set up the LCD for I2C communication

  lcd.setBacklight(255, 255, 255);  //Set backlight to bright white
  lcd.setContrast(5);               //Set contrast. Lower to 0 for higher contrast.

  lcd.clear();  //Clear the display - this moves the cursor to home position as well
  lcd.print("Booting Up...");

Very useful if you have a device that you do not want any latency from sharing the I2C bus

Yes, Portenta H7 has 3 I2C busses.
One is in use already (call it inner board I2C system bus), e.g. to access the PMIC power controller, the crypto chip etc.

Yes, you need breakout board to access all three I2C (the MCU module provides just one, the system I2C).

Be aware off: the other two (user) I2C do not have a pull-up - you need (external).

Regarding the I2C slave address:

  • you cannot connect two slaves with the same address on the same bus
  • sometimes, external I2C boards, have an option to "wire" (solder) an address selection:
    a pin to change the I2C slave address to another one, so that two modules at same bus, but with different slave address

Options:

  • check, if you have a solder bridge, or pin, on external I2C module (when using the same, to modify one to give it a another I2C slave address)
  • connect two identical I2C modules on different (separated) I2C busses
  • be careful when using the system I2C bus: make sure, your external modules connected there do not have the same I2C slave address as the chips on board, e.g. 0x08 for PMIC, Crypto chip I do not know - check the schematics for Portenta H7 board - they tell you which I2C address is in use
1 Like