I have a few Adafruit SHT30 sensors (SHT30 Temperature And Humidity Sensor - Wired Enclosed Shell : ID 5064 : $8.95 : Adafruit Industries, Unique & fun DIY electronics and kits) that I'm using with the Arduino Nano RP2040 Connect board. When the system is powered on, the sensor is visible on the I2C bus using scanning code such as found here: Arduino | How to Scan and Detect I2C Addresses | Adafruit Learning System. As soon as a temperature or humidity reading is taken, the sensor no longer shows up on a scan. Communication to the sensor still works (using the Adafruit SHT31 library) as you still get temp/humidity readings. The main issue is that on reset, the sensor still is not visible and the calls to sht31.begin() fail.
This is happening consistently across multiple SHT30 sensors, with different RP2040 Connect boards. And happens every time and across different programs and happens whether there are other I2C components or not (although the RP2040 Connect has two internal I2C components that can't be removed).
Simple test board setup is:
Basic example code where the issue appears:
Note: The example code runs fine as written except when resetting the Arduino using the reset button, or when the software is reloaded via the IDE. On reset, the sensor is not visible to sht31.begin(). If I merge the I2C scanning code and do a scan every loop(), you can see the sensor disappears after the first temperature or humidity read.
(If you remove power to the board completely, then re-apply it, the sensor does show up again.)
Note as well, that it is specifically the temperature/humidity read (which I believe actually is the same code in the SHT31 library) that triggers the issue. Other communication to the board -- such as turning the heater on and off -- does not cause the sensor to drop off the I2C bus. (You can comment out lines 41 and 42 of that example code -- replacing the return values with dummy values -- and the sensor does not drop off the I2C bus.)
I've tested this alone -- just the SHT30 sensor as the only extra I2C component - and I've tested it with a small OLED screen and an I2C multiplexer and the same behavior occurs and the other I2C components do not drop off the I2C bus.
I've found that I can handle resets by doing one of two things to get around this ... 1) disconnect the Vcc, SDA and SCL lines together or 2) disconnect the Ground line - either option, if done during setup() before the sth31.begin() call appears to reset the sensor and have it show up on the I2C bus again. I've been able to exploit this by adding a relay to disconnect the ground line at the start of setup(), wait an appropriate amount of time (needs about 2 seconds disconnected, and 200ms after reconnect) and then resume the normal setup() process and it works fine. But it would be nice to know if there is a better way to do this without the extra hardware.
Thanks!