[Wiring two I2C devices][Qwiic connector]

Hello,

I use to work with Sparkfun AS7265X spectral sensor and recently needed to wire two of them with the same arduino (uno) board.

The easier solution was to use a multiplexer, which works very well but it seems like it would be possible to use the qwiic system to wire the two sensors.

I don’t understand : how can I get both sensor data by wiring sensors between them, while the arduino board will only be wired to one of them…

Thanks you,

Ilias

Hello Ilias_sabout,

Are you asking about having the qwiic connectors connecting each board to each other? Like the picture below?:

spectralSensor_qwiicConnect.png

Hi Ilias.

The problem you run into is both sensors have the same address and if you try to talk to that address both will respond at the same time and cause the data they are transmitting to be garbled.

You can think of it as you talking to your friend Bill. If you say “How’s it going Bill” in a room with two other people in it and they both happen to be named Bill, they both respond at the same time and you won’t be able to understand what each is saying.

In a situation like this you have two options.

  • - Use a micro controller that has two different I2C busses and put one sensor on each. (Which the Uno doesn't have)
  • - Use a Mux to select the sensor you want to talk to, disconnecting the other sensor from the bus.
  • In the first case, you could think of both Bill’s each living on a different street. If you want to talk to Bill 1, you have to walk down his street and start a conversation. When you want to talk to Bill 2, you walk over to his street, leaving Bill 1’s street.

    For the second case, you could think of it as both Bill’s living on the same street but now they each have their own houses. To talk to Bill 1, you go to his house. To talk to Bill 2, you leave Bill 1’s house and go to Bill 2’s house.

    Our [Qwiic Mux would be ideal for connecting more than one of the same sensor. The Qwiic Mux has it’s own I2C address and you can talk to the Mux and request access to one of it’s 8 ports. Once you have selected a port, you then can talk to the sensor attached to that port. When you’re done, you close the port and open another to talk to the second sensor.

    You can think of the Qwiic Mux as the electronic equivalent of a 8 position rotary switch like the one below. You’d have your Arduino connected to the common terminals and each sensor is connected to one of the numbered outputs.

    F3115048-01.jpg](https://www.sparkfun.com/products/14685)