Using I2C and a bus transceiver IC

Hello,

I am doing a project and i would like some of your experiences using I2C. So what i am trying to do is to control an LED driver IC but because i want to use 10 of those, i have some problems regarding the fact that they’re going to have the same address. In order to get around this i thought to use a bus transceiver IC in order to control when and which IC i want to have access to the bus. However because the transceiver uses buffers(which isolates the 2 circuits) I’ll have to use a separate pull up resistor between the transceiver and the driver IC (slave). Intuitively, I say that the pull up resistor has to be the same as the built-in one in the Arduino. So the question is:

(a) Does my resistor really have to be the same as the built-in one in the Arduino or a 2KΩ one will do the trick? If yes then
(b) What value pull up resistor does the Arduino Mega use for I2C?

Chris

The Arduino Mega board has 10k onboard pullup resistors to 5V.
The maximum sink current (to pull the signal low) is 3mA.
A pullup resistor of 10k or 4k7 is normal, but when longer wires are used, then 2k2 can be used (as long as the sink current stays below 3mA).

Can you tell more ? What are the distances ? Which cable do you use ? Which buffers for the I2C bus ? Can you draw a schematic on a piece of paper and make of photo of it ?

Some I2C driver chips make the I2C “stronger”, they allow a lower value for the pullup resistor.

The I2C bus was designed to be used on the same pcb board. It is not meant to bring communication to an other location and it is not meant to go into a cable.

All the components are going to be on to the same PCB so although I can’t tell you the exact wire length it’s going for sure to be less than 50cm long. As for the components, the Bus transceiver i am probably going to use is the SN74LV244AT and the LED driver is the LP5024. The plan is with a DIR(direction) signal I’ll be able to control which way i want the data to be transferred. For example with a logic 0 only data from A can move to B line so only the top raw will have access to the bus. On the other hand with a logic 1 data from B line can move to A therefore giving access to the bottom raw and isolating the top one. Below i have the schematic:

Chris

The I2C bus has SDA and SCL.
They are both bidirectional signals. When a Master communicates with a Slave, information is going in both ways all the time. The Master and Slave are tightly coupled, and keep an eye on each other, for every byte.
If the Slaves are normal chips and not microprocessors, then the SCL-signal is from the Master only, and then the SCL is not bidirectional.
It does not matter if data is only written to the led displays. Information is still going in both directions over the SDA line.

Oh, that’s right. Because of the acknowledge bit i suppose that the slave sends to the master. I forgot about that.

Chris

Yes. Also when the Master does a Wire.requestFrom() then the Master sends the address, the Slave sends data and the Master sends ACK between the data.

So bus transceivers won’t cut it. There has to be an IC able to isolate the slave from the bus and whenever i want to communicate, it can handle bidirectional communication. It can’t be that it’s straight away impossible to have slaves with same addresses communicating with the master, can it? Not any of the millions and millions of ICs available can accomplish that?

Chris

Unless I use a counter. The acknowledge bit comes at predicatble times(let’s say the 1st one always comes after 8 bits have been sent), so i could use a counter in order to literally count the bits that are being sent and whenever it’s time for the slave to send back the acknowledge bit, a signal will be sent to the transceiver in order to change for a brief moment the direction of the data and allow the slave to send the bit back to the master. Basically the counter will count up to 8 and then using logic gates I could detect that and send the signal to the transceiver to change the direction of the data flow. Seems like a messy way of doing it but i can’t think of anything else right now. What do you think?

Chris

How about a real I2C multiplexer

Datasheet from Mouser

There are many chips and many solution.

That chip at Adafruit with a tutorial: https://www.adafruit.com/product/2717. That one makes 8 (sub)I2C busses.

There are I2C bidirectional bus drivers with an enable. So it is possible to do the same thing that you had in mind. But I don’t like those chips, a I2C multiplexer is better.

It is possible to connect all the SCL signals and use a analog multiplexer for the SDA. Analog multiplexer: https://www.gammon.com.au/forum/?id=11976.

You could make a separate I2C bus for each Slave device with a software implementation of the Wire library. The SCL pin can be combined, so for 8 Slaves you need 9 pins. Just normal digital pins.

Manufacturer’s page of the LP5024: https://www.ti.com/product/LP5024.
According to the datasheet, it has 4 possible I2C addresses. So now you only need to create two (sub)I2C busses instead of 8.
I’m not sure what the Enable pin does, it probably turns off the whole chip and the leds will probably also turn off. But I can not read that explicitly in the datasheet.

I think these are the most common solutions, there are probably even more.

Oh wow ok. I’ll take a look at the links. Thanks for the resources. Also I would like to ask if i can buy the TCA9548A chip ceparately or if it only comes integrated in to that Adafruit board. I did a Google search and the only thing i could find was the board itself and not the chip sold separately. I also typed the name written on the actual chip but it didn’t return any results either.

Chris

Mouser, Aliexpress and others

Ok. Thank you for your help

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.