2
\$\begingroup\$

I read following threads, but still there are some unclear parts for me. Multiple I2C devices with the same address I2C Pull-ups with Multiple Power Supplies Design for Multiple I2C slave devices

I have two slave I2C devices (sensors) to connect to one master MCU. They are not modules on breakout boards with preset PU resistors.

The first slave I2C device is on the same power rail as MCU is. I put the other slave I2C device on another power rail due to following reasons:

  1. I want to make a PCB for it, so that the second sensor could be attached through a terminal connector.
  2. Not always the second I2C will be connected (in case I don't want to use it).

  3. To lower power consumption. I want to put MCU on power down mode. So, periodically it can turn on sensors and read their values and turn them off again and go to power down.

I was thinking to do as following schematic. But I would like to know your recommendations, if there are issues with it, or if there are better ways to do it.

schematic

simulate this circuit – Schematic created using CircuitLab

If I use this schematic, do I have to add diodes to prevent current draw from second slave sensor when it is off?

More details:

  • I2C device will not be hot plugged/ how swapped.
  • I have a sensor that could be used as second I2C sensor. But it does not have sleep mode. That's why I'm thinking to turn it off.
  • I2C sensors and MCU are working on 3.3V.
  • The first sensor is BME280 (always connected).
  • Second sensor could be this one.

What do you think about adding a buffer, like PCA9306, in this schematic2?

What do you think about using I2C mux e.g. PI4MSD5V9540B? In case of using mux, I can use two sensors with same address.

\$\endgroup\$

4 Answers 4

4
\$\begingroup\$

"Shutting off" the unneeded I2C device will probably not work like you expect. The issue is that the i2c data lines will probably have protection diodes to VCC and GND that are not shown in the datasheet.

What will happen in that case is that current will flow into the data ports of the unused device and parasitically power it and/or lower the pull up voltage on the data lines.

With other protocols there are simple circuits you can use to prevent this, but i2c is bi-directional so most of those solutions will not work.

The most practical solutions are to either use a shutdown function built into the i2c device, or perhaps use of a different protocol. If you must use i2c, some type of bi-directional switch ic, or a SSR style mosfet circuit might solve the problem.

Related questions:

Is there a good practice approach to powering down peripheral devices (SPI, I2C, UART) which use significant power?

Unpowered devices on I2C/SPI bus

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This is a very key point. However the classic MOSFET I2C level shifter handles a powered down bus segment (at least on the "lower voltage" side) fine. \$\endgroup\$ Commented Dec 20, 2018 at 4:40
2
\$\begingroup\$

PCA9306 is the way to go.

You will need to add pullup resistor also on the other side of PCA9306.

If the device is designed to be connected / disconnected, you would be safer adding some input protection on the I2C lines.

\$\endgroup\$
1
  • \$\begingroup\$ PU resistors on the other side (master side) of PCA9306 are already there (R1, R2). They are connected on MCU directly. Did you mean it?, or are you mentioning some other/more resistors? \$\endgroup\$ Commented Dec 20, 2018 at 9:59
0
\$\begingroup\$

The I2C bus is driven by open collector devices, placing a tristate buffer or any other in that bus will defeat it unless you add additional circuitry to determine which way the data is going in the bus. You may be able to accomplish it with a I2C expander. From what I understand you simply want to disconnect the bus. A 74HC66 would work, it is a bidirectional CMOS switch and is not expensive.

\$\endgroup\$
0
\$\begingroup\$

You can use a 74HCT244 or a 74HCT245 to put the data bus in high hmpedance.

Read the datasheet, see which one is more suitable for your application.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.