I2C device's having same address

Status
Not open for further replies.

Kittu20

Member level 2
Joined
Oct 18, 2022
Messages
52
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Activity points
427
"Hello everyone,

I'm presenting a hypothetical scenario for discussion. In this scenario, I have a microcontroller setup with two temperature sensors connected via I2C, one monitoring the hallway temperature and the other the kitchen room temperature. Unfortunately, both sensors share the same I2C address, and this is causing some confusion in my communication.

I'm curious to know how to effectively communicate with each sensor individually. Are there any strategies you can suggest to overcome this address collision issue?

Your suggestions in this theoretical situation would be greatly appreciated!

Thank you!"
 

Hi,

Use an I2C BUS MUX IC like PCA9546

Klaus
It seems there are two possible solutions to this issue, as you've pointed out. One is the hardware-based approach using an I2C multiplexer (such as the MUX chips you mentioned), and the other is a software-based solution involving I2C bit-banging.

Regarding the bit-banging approach, Do we create two separate buses or use use a single I2C bus ? If single bus than how do we identify specific I2C device
 

Hi,

What's your idea about bit banging? I don't see it as a solution.

Klaus
 

Bit banging just copies what a hardware interface does but using software to control the lines. It offers no advantage in this case. You haven't told us what type the sensor is, many if not all I2C devices have a pin that can be connected in various ways to modify the bus address. If you device has it, simply map the sensors to different addresses.

Brian.
 

The question makes no sense if the hypothetical I2C device is provided with a feature to change the address. Thus I presume it isn't.
The devices have to be connected to separate busses (hard- or software interfaces of the controller) or sub-busses (e.g. generated by a mux device). If you are short of controller pins, the busses can share a common SCL line.
 

Hello!

There is no solution in your case if you have the exact same address. Either you use 2 I2C buses or you can't use it. Bit banging mimicks the I2C bus with GPIOs, so this solution itself is a I2C bus.
Now what are your sensors exactly?
Some sensors have A0 A1 A2 inputs allowing you to adapt your address. If you have that kind of sensor, then you can address 8 devices on the same I2C bus.
Here is an illustration of this method. You can notice the 3 address inputs.
The first is 000, the second is 110, the third is 111.
Suppose the device address is 0x70, then the actual addresses will be 0x70, 0c76, 0x77 and you can therefore address the thermometers separately.

Dora.

 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…