Arduino and external powered I2C devices

When Arduino is used with I2C devices powered by external source there will be problems.
In my project I use Arduino with Stand-by power and IR remote. When Power On command is executed Arduino turns on main power supply for all other devices, including I2C extenders (PCA9359). When testing the extender powered by Arduino all worked perfect, but when I use main power, I2C extender don’t work.
I tried to investigate the problem and found that after main power on the I2C extender must be re-initialized.
Another very important thing is to add additional pull-up resistors between SDA, SCL and I2C extender VCC. Without them extender don’t work with main power supply.

Here is the schematic (+5VD is main power supply):

I2C extender

And code on PowerOn function:

void Power_On() {
....
digitalWrite(POWER_PIN, HIGH); // main power on
delay(100); // stabilize power
// re-initialize I2C
Wire.begin();
i2c_p1.portMode0(ALLOUTPUT);
i2c_p1.portMode1(ALLOUTPUT);
i2c_p1.digitalWritePort0(0); // max attenuation
i2c_p1.digitalWritePort1(0); // analog in 0
...
}

To avoid current from Arduino I2C bus through extender pull-up resistors when PowerOff is performed Arduino I2C pins must be set as LOW just before main power off:


void Power_Off() {
...
digitalWrite(SCL, LOW);
digitalWrite(SDA, LOW);
digitalWrite(POWER_PIN, LOW); // main power off
}

Leave a Reply

Your email address will not be published. Required fields are marked *