[solved] How to keep I2C lines from powering up other devices?

Hi there,

I am running into a problem with I2C devices trying to cut off power to them.
I was wondering if anyone could push me in the right direction.
I have had no formal education in electronics and I am learning by trial and error so perhaps there is a obvious simple solution to my problem which I am not seeing at this point.

When I disconnect the VCC lines of I2C devices by using the latching control board the problem occurs.
Some, not all I2C modules, will send power back to the latching control board.
This keeps the latching control board in a ON state there where it should be OFF when commanded by the MCU.

I wonder why not all I2C devices give this problem and some do. Is there a way to keep the I2C bus powering the latching control board?

The reason for using Pololu’s latching control board is because I am trying to build a battery powered system with 3 ATMEGA328P-PU’s and multiple I2C devices. To reduce power consumption I want to cut off power to the devices connected to the master and 2 slaves when not needed.
Each MCU will have a separate function with some of them sharing I2C devices.

Here under I will try to describe the whole system:

All ATMEGA328P-PU’s will communicate with eachother via I2C and some of them will share modules.
All ATMEGA328P-PU’s will be in a deep sleep mode (using 0.15µA each) and woken up when needed trough and interrupt on the digital pin’s 2.

The primary ATMEGA328P-PU is the master which gives commands to both slaves via I2C. Until a user presses a button the master will be in a deep sleep.
This one also keeps a log of button presses, runtime etc saving it all to the FRAM module. The FRAM module is also there for reading a configuration set by an administrator.
The slave devices will only be woken up by the master within certain hours and will be in deep sleep the rest of the time, even if the master is awake to do other stuff.

The following devices are connected to the master:

  • Adafruit DS3231 RTC module (I2C)
  • Adafruit FRAM module (I2C)
  • Adafruit VS5310 Audio module (SPI)

The secondary ATMEGA328P-PU is for power control. This one will be woken up by the master and measure power usage of the whole system through the INA260 module. The measurements will be written to the FRAM module (connected to the master) via I2C.
This slave will supply power the the devices connected to the master and other slaves when needed and cut off power when not.

The following devices are connected to slave_1:

  • Adafruit INA260 module (I2C)
  • Multiple Pololu 2808 latching power control boards

The tertiary ATMEGA328P-PU is for communications with an administrator via GSM. This slave will be woken up by the master only withing certain hours. When woke this slave will read the data stored in the masters FRAM module via I2C. When needed the administrator will send new data or a new configuration via SMS to be stored into the FRAM module of the master.

The following devices are connected to slave_2:

  • Adafruit FONA module (UART)

The devices are likely being "phantom powered" thru the I2C lines themselves. You will need to use P-channel MOSFET or similar to power/depower the I2C lines so they do not leak current into the devices thru the input protection diodes, such as on the 328P, see Section 14 of the datasheet to see what I mean.

If you would provide an interconnection diagram among your devices, then we could have better understanding of your system, realize the problem and recommend something meaningful!

You have the following devices: 1. Arduino UNO-1 : Master (primary device). It is connected with a with DS3231 and FRAM using i2C Bus and with VS5310 using SPI port.

2. Arduino UNO-2 : Slave-1 (secondary device). It is connected with INA260 Module over I2C Bus. How many INA260 Modules do you have in the circuit? How many Pololu 2808 Modules do you have in the circuit? Can you show/post a connection diagram of a 2808 module with other devices?

3. Arduiono UNO-3: Slave-2 (tertiary device). It is connected with FONA Module using UART Port.

How are 3 UNOs communicating -- I2C Bus? INA260 can monitor the power parameters of only one device - correct? There are as many 10 devices in your system? How do you measure the power parameters of other devices?

If possible, provide a connection diagram or provide the complete specifications; we will draw connection diagram and will submit to you for correction/approval.

Thank you guys for replying!

@CrossRoads Thank you for the term "phantom powered", this is leading me more out of the dark! I will look into this and try to make a circuit for one problematic I2C device and measure on it my scope.

@GolamMostafa I will make a schematic of the whole system and will try to post it later this evening. All MCU's are indeed connected through the I2C bus and all devices share the same ground. At this point there are 6 devices and 3 MCU's. The additional 2808 are not counted at this point, but I will probably use 5 2808 latching boards. So totally 14 devices next to other components as resistors/caps/etc. The system will grow in the future with additional sensors/devices. Oh and not to forget, the INA260 module will measure the power of the whole system.

Use an I2C bus isolator.

Such as the TCA4311, it will prevent exactly the phantom powering you are seeing, and it works well.

So, you have-- 1. One 9V battery (what ah?).

2. 3 Arduino UNO.

3. 5 peripheral devices: (1) DS3231 (2) FRAM (3) VS5310 (4) INA260 (5) FONA

3. 8 Pololu 2808 Power switches to control power to all 8 devices (3 MCU + 5 peripherals); or, 5 power switches to control power to 5 peripheral devices. Why are you talking about 6 power switches (1 + 5)?

I have drawn the following connection among your devices based on your description. Does it make sense? Now, let us analyse the diagram to figure out how the phantom powering could be avoided. Try by excuting this code: Wire.end() to isolate SDA(A4)/SCL(A5) line from the internal I2C Logic. |490x500


@GolamMostafa Thank you for your effort but this was really not necessary. The devices which should be turned off, are still getting current through the I2C bus. The lines are being held up high by the other devices because the I2C bus on the devices are not isolated from one or another. This also leads to the rest of the Atmega328P's to freeze up when I try to shutdown an I2C device.

In the meantime I changed my setup, so for now I walked away without a scratch.

I2C was apparently not designed to be used as I hoped for. CrossRoads and srnet already suggested that the I2C bus should be isolated one way or the other. This is a thing I definitely will look further upon later because I am quite sure I will need this later.

Perhaps I will make a little PCB with TCA4311A or similar chip with a latching circuit to and a little arduino library to power up and power down I2C devices. When all is ready I will post more info here.

I thank you all for think along and helping me with my journey.

jackrobot: Please share the schematics

Which schematics are you referring to?

izmizm: Which schematics are you referring to?

He is referring to the following one that you promised; but, you never did?

izmizm: @GolamMostafa I will make a schematic of the whole system and will try to post it later this evening.

@GolamMostafa If jackrobot is asking for the schematics of the system, there is none. When I attempted to draw the schematics I figured a way I could design the system without having shared I2C lines, so I stopped drawing the schematic. With this said, my initial problem does not exist anymore.

If jackrobot is referring to the schematics of the I2C isolator board which I will probably make in the future, I will share more info to that in this post. At this point I can't say when that will be, because I don't know when I will have a look at that.

CrossRoads and srnet mentioned ways to prevent phantom power in the I2C bus, so for now we will have to do with that until unless someone else comes with another solution.

I hope this answered unanswered questions.

Found a working solution:

I'm using now a 4-Channel bidirectional logic level shifter from Pololu.

With this now I can power down slave arduino's safely at any time, and power them back up later. i2C communication works like a charm and doesn't hang ever. Even after many power downs and ups of the slaves in loops.

The master arduino is powered with 5V and all slaves are powered 3.3V. Tried powering the slaves with 5V but this lead to some communications errors. Apparently there has to be some voltage difference between the logic level of the master and slave.

Also good to know, the level shifter keeps the lines HIGH in "rest" state. You need to send a LOW to set the line LOW, otherwise it will be HIGH (also when not connected).

The circuit I'm building is quite big now, so I don't think it will add value to place a diagram here of it, but there is a diagram in the pdf (link see below) how the level shifting is setup.

More info of the logic level shifter: https://www.pololu.com/product/2595

Level shifting techniques in I2C-bus design: https://www.nxp.com/docs/en/application-note/AN10441.pdf

Hope this could be of some help!