Multiple Qwiic ICM20948 sensors with Qwiic Mux Breakout TCA9548A

Hello,

I would like to compute the angle of the knee when walking. Therefore I am using two ICM20948 IMU sensors (one at the thigh and one at the shank). Since the two sensors have the same address, I am using a Mux Breakout TCA9548A to read from both of them.

I wrote the following code however the sampling rate is really slow already without inserting any delay (approx. 80-90 Hz). Is there a way to make the reading of both sensors more efficient?

I really thank you for your attention.

Best regards.

test = qwiic.QwiicTCA9548A()
test.disable_all()

test.enable_channels([0])
IMU = qwiic.create_device('QwiicIcm20948')
if IMU.connected == False:
    print("The Qwiic ICM20948 device isn't connected to the system. Please check your connection", \
    file=sys.stderr)
else:
    IMU.begin()
test.disable_channels([0])

while True:
    test.enable_channels([0])
    if IMU.dataReady():
        IMU.getAgmt()
    test.disable_channels([0])

    test.enable_channels([1])     
    if IMU.dataReady():
        IMU.getAgmt() 
    test.disable_channels([1])

What is your main processor? Is it an Arduino UNO or something more advanced?

Dear bidrohini,

thank you very much for your answer. I am using the python libraries on Beaglebone AI.

If you’re looking for speed, you might consider SPI over qwiic/I2C. in addition to SPI being faster, you can have multiple sensors on the same bus by just adding an additional CS line per sensor.