Multiple Non-addressable I2C devices alternatively powered by IO pins


I have a couple of I2C sensors which have fixed address. I want to be able to connect to both of them with arduino and read data almost simultaneously. So, I was thinking to power them alternatively by supplying power from different I/O pins by alternating them using digitalWrite.

Will it work?

I/O pins can only provide a max of 40mA and 20mA would be more sensible. You will probably need to put a transistor between the I/O pins and the I2C devices.


Or use an I2C mux and leave both powered up.

As above. I made a circuit that used two oled i2c screens in the same way. I just used a CD 4053 chip. Surprisingly simple.


In my case the sensor's current requirement is extremely low. It is only few uA. So no problem of driving current. It is way below 20mA.

Since I have a 3.3V based sensors I am unable to verify this myself with Uno. (waiting for my pro-mini to arrive). Can anyone confirm if it works without any additional circuitry?


I have a couple of I2C sensors which have fixed address.

Ahhh yes,, fixed addresses so what.. or is it that they have the same ID?

Check this link; or this Tom.... :) What are the sensors?

If you can power down the I2c device that's not being used, then I would guess that would work. But is there a power up or warm up time involved for your sensors?

In my case. I was using two displays were on the same i2c address and I couldn't really power down the alternate display. Otherwise, they will flash. Quite undesirable.

This worked for my situation.


I am surprised nobody tried this before!!!

@TomGeorge! I am using HM5883L magnetometers whose power requirement is very low. So using transistors/MOSFETs for driving them is overkill. But in theory, switching on one power supply while keeping the other one off should work right? But I am only bothered about any practical detail that I missed...

@retrofiesta I am not sure if they have some warm up time. Even if there is I don't mind waiting for a few ms or even a full second to get the data. I feel I2C multiplexer is an additional unnecessary component in my case!

What are the thoughts?

What are the thoughts?

The thoughts are that they are both wrong. An unpowered device looks like a diode to ground therefore one unpowered device on an I2C bus will stop the bus from working as the other device could never then see a logic one.