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\$
2
\$\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\$
  • \$\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\$ – Chris Stratton Dec 20 '18 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\$
  • \$\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\$ – Nima Sajedi Dec 20 '18 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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