I2C trubs - multiple sensors, same address

Hello Particle community. I have been using a Photon to run some tests with half a dozen moisture sensors (simple analog voltage) and a SHT21 (I2C) air temperature/humidity sensor. Life has been good.
My most recent test, however, requires TWO SHT21. Since these sensors share an address I thought to power the first, take measurements, de-power the first, power the second, take measurements.
This does not work.
Even using the code for the earlier tests (nothing for the second sensor), merely having the SDA/SCL lines connected to the second sensor (completely unpowered, verified by multimeter) causes the first sensor’s measurements to come out garbage.
What am I doing wrong?

Are you using bare chips or a breakout boards for the SHT21s?

If you’re using breakout boards, make sure you remove any pull-up resistors on the boards and instead use external pull-ups on SDA and SCL at the Photon.

Otherwise, the pull-ups on the breakout boards can end up powering the chip enough to cause difficulties, even though you didn’t supply VCC to the board.

I made some little PCBs with pull-up resistors in accordance with the SHT21 datasheet and the Photon I2C reference document. That makes sense to me. I’ll see what I can do for trying that out.

@Terve, @rickkas7, whether the pull-ups are at the breakout or at the Photon, the result is the same. Having a single set of pull-ups, however, will reduce the effective resistance, increasing the available current at the SHT21 pins and possibly ghost powering them. Do make sure to pull-up to 3.3v and not 5v (Vin), assuming you are powering with 3.3v.

When controlling power to the devices, make sure you allow each enough time to come up to spec, which is around 15ms or so. From Sensirion’s datasheet:

As a first step, the sensor is powered up to the chosen
supply voltage VDD (between 2.1V and 3.6V). After
power-up, the sensor needs at most 15ms, while SCL is
high, for reaching idle state, i.e. to be ready accepting
commands from the master (MCU). Current consumption
during start up is 350µA maximum. Whenever the sensor
is powered up, but not performing a measurement or
communicating, it is automatically in idle state (sleep

Also, if you follow design guidelines, a 100nF decoupling cap is recommended across the power pins of the SHT21.

If none of this works (which it should), you could use an I2C multiplexer:


1 Like

I was thinking that VCC on the breakout was being powered by a GPIO, thereby selecting which one was the active one. I could be wrong, but wouldn’t that have a dramatically different effect if there are pull-ups on the breakout? If the breakout VCC is pulled low, then you have completing pull-up and pull-down. If the breakout VCC input is in Hi-Z, then there’s a resistor between the chip’s VCC and the SDA and SCL lines, which would partially power the sensor.

@rickkas7, I see what you mean. I always assume the pull-ups go to the common power bus which is 3V3. You are correct about the ghost power being supplied if Vcc is put in Hi-Z or an unwanted voltage divider if put to GND, reducing the I2C bus voltage to below desired thresholds.

You approach of “centralized” pull-up resistors is the correct approach, combined with correct startup timing as indicated. :smile:


You should consider using an i2c multiplexor/switch to isolate the identical devices. Loads of people make them, but NXP is probably the best place to start.


The boards do have 100nF caps. The startup timing is very generous.
Tried moving the pull-up resistors as suggested, no dice.
Looking into a multiplexer now. Know of any outlets located in Finland? International shipping is a pain.

Thanks for the help, everyone.