My SHT30 (temperature and humidity) sensor worked fine for over a month until I moved it from a plastic box to a metal frame box wrapped in Mylar, both boxes are equipped with motors and LED lights.
My issue is strangely reminiscent of FourRings' post from last year. Their post is why I am writing this up, I think I know what the problem is and wanted to document it for other people. I do not see a way to reply or reopen their original post.
The SHT30 is connected to an ESP32-WROOM Dev Board. The code backing it up is trivial; I do not believe is at issue because there were no code changes between it working and it not working.
The sensor gave accurate and reliable readings during development and 3 weeks in production while in the plastic box. When I moved to the Mylar box the sensor would only work when I had the door open and the ESP32 was connected to a computer, not when the door was closed and connected to a USB charger.
I checked all my code paths.
I tested every connection.
I tried different USB cables.
I tried different power bricks.
I tried different power strips.
I would have tried a different sensor, but I didn't have one and this sensor worked fine 1 hour ago.
Dear reader, you have probably guessed the issue from the hints "Mylar" and "door open". I am pretty sure there is a significant amount of electromagnetic radiation in the Mylar box and the Mylar keeps it in.
After fashioning the world's ugliest Faraday cage, the sensor is rock solid.
I am new to micro controllers and have not worked with small electronics in years, please enlighten me if my understanding of why wrapping the sensor in metal mesh fixed it.
Considering FourRings was using the SHT30 for a similar application, I wonder if their sensor was failing for a similar reason.
Assuming it is EM, are there other ways to solve this problem?
Update:
I had the wrong sensor name, my sensor is an SHT30 Wired Enclosed Shell from Adafruit not a SHT-31. I have correct the name in the post.