It doesn't work that way. You have three choices:Hi everone ,
I am looking for a way to use two I2C sensors with the same I2C address of the same I2C port.
Regards,
That is not an option. He wants two devices with the same address to play nice on the bus with each other. Ain't gonna happen.Some sensors allow their address to be changed. Look into it. Otherwise use a jumper.
Can you provide me with more details about the mux solution ?You can produce a second I2C port by driving the SCL and SDA lines to each sensor via an analog mux and select the sensor that way. Or bit bang another I2C port. Or a second Arduino.
But as mentioned above, the sensors need to have different addresses, or I2C ports.
An I2C multiplexer would get you that functionality if you're not able to change the addresses of either of the devices. TCA9548A is one such device. You can find board for a few dollars on eBay.Hi everone ,
I am looking for a way to use two I2C sensors with the same I2C address of the same I2C port.
Regards,
What is the connection of the pullup resistors ?Have a look at something like a CD4052 dual analog multiplexer.
Connect X and Y to SDA and SCL on the Arduino.
X1 and Y1 to sensor 1 SDA and SCL.
X2 and Y2 to sensor 2 SDA and SCL.
A to a port pin used to select the sensor, and B to 0V for just 2 sensors, or another port pin for 4 sensors.
INH to 0V
VEE and VSS to 0V
VDD to 5V
make sure both sensors have pullup resistors.
https://www.ti.com/lit/ds/symlink/cd4051b.pdf
Can you clarify more ?For one sensor keep the SDA and SCL the way you have it... for the other sensor swap the SDA and SCL. in software talking between the two just reassign the SDA or SCL depending on which sensor you want to talk to.
Note: This will only work if you have two sensors with the same address on the I2C buss. We did this all the time over the years when I was an employee at Parallax Inc. ... i.e. a p;opular I2C memory expansion card utilized this method
That is very clever!For one sensor keep the SDA and SCL the way you have it... for the other sensor swap the SDA and SCL. in software talking between the two just reassign the SDA or SCL depending on which sensor you want to talk to.
by Jake Hertz
by Jake Hertz
by Jake Hertz
by Aaron Carman