Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Reply To: I2C and power management

Home Forums Mayfly Data Logger I2C and power management Reply To: I2C and power management

Sara Damiano

I’m sorry I’m late to this.  But @mbarney the problem with turning off power to I2C devices isn’t universal.  It depends on how your external I2C device is wired.  If the SCL and SDA of your external device are directly pulled up to the incoming Vcc, then when you turn off the switched power, suddenly the system SCL and SDA will be pulled *down* to ground.  I2C lines are supposed to be pulled up, per protocol.  And there’s a bug in the Arduino Wire library that causes an infinite loop if wires are pulled down.  So everything freezes.

I think a lot of (especially inexpensive) sensors do connect the SCL/SDA to incoming voltage without any isolation.  I know the Atlas circuits all do and it seems like your ADC does as well.  But I’ve seen other I2C devices that work fine with the Mayfly switched power going off – I think the Bosch BME280 and INA291’s I played with, but I’m not positive which others.  I’m not sure if in those cases the breakouts I had were actually isolated or if it was just luck and resistor magic that the let the internal pull ups on the Mayfly’s I2C lines overpower the pull down when power went out.  I suspect the latter.

In theory, the I2C isolation should work.  But I haven’t ever actually bought an isolator myself to test.