I have bought three SHT41 sensors (i2c, 10k pull up resistors already on board). I cannot figure out strange unreliable behavior.
One of the sensors seems to always work without issues, but the other two behave like this:
Yesterday, no way I could get one of them working, the second one sometimes worked for few seconds, and then esp32 (or i2c) freezes. Like something happens on i2c, because sometimes it did not fail completly, but i saw some artifacts on SSD1306 display (display is on the same i2c line). When this happened, I tried also removing esp32 dev board usb connection from PC and plug it in powerbank (to eliminate if maybe keyboard USB is dirty). The same problem. I tried to move all connections a bit - nothing.
However, today in the morning I am testing again, first sensor works (as yesterday), also second and third sensor work. What?!? I left it running like half an hour, and then only then briefly some some artifacts on display.
What happens during the night? What could it be?
I use ESP32 Dev board with USB-C, plugged into USB-A in my keyboard.
-I power the breadbord + and - rail from ESP 3,3V and GND lines. Both display and sensor ar powered from this line.
-I connect sensor board SDA and SCL together with display SDA and SCL and then to default i2c on ESP32 (SDA 21, SCL 23).
-I also have connected mini SSD1306 on the same lines and i2c, for displaying values.
-There are NO extra capacitors, resistors...
-Sensor and screen already have pull-up resistors of 10k integrated, therefore combined pull-up on SCA and SCL is arround 6,6k ohm.
I run this on ESPHome, and when it failed in Log i see error: Recovery failed: SCL is held LOW on the i2c
It seems like you’re experiencing issues with the I2C communication. Using 10K resistors as pull-ups is borderline and may not be sufficient. Try adding 4K pull-up resistors to the 3.3V line for both the SCL and SDA lines, while keeping the existing 10K resistors in place.
I would just say if everything works some of the time, then the problem is likely to be a bad connection somewhere. Breadboards are often the source of that problem, as well as bad jumper wires.
Indeed.The way the Dupont connectors are angled in the esp board suggests lateral force on them, which tends to loosen the female connectors, resulting in dodgy contacts.
I think you have incorrectly assumed that it's the SHT41 that is failing when the same error message could indicate a display problem or intermittent wire connection.
-Sensor and screen already have pull-up resistors of 10k integrated, therefore combined pull-up on SCA and SCL is arround 6,6k ohm.
That would be 5K not 6.6K, which is low enough so don't add any extra pull-ups.
Also don't twist the I2C lines together, that can cause communication problems.
Extra pull-ups should not be necessary
Thanks for all your suggestions (all of you). I will combine response, to keep it shorter:
I did try try to lower the pull-up to 3K it did not make any difference (two days ago when I was noticing troubles)
Dupont connectors on cables do not have any force on esp, they wiggle a bit. There point of contact seem so be the tip of the pin, so they go a bit left and right. I can hold cables and wiggle all of them a bit, and everything still works.
I also tried to replace display with another one (when I had problems), and it still did not work.
About resistance you are probably right that is 5K. I measured 6,6K with multimeter, but individualy on sensor and display i measured around 9,5K. But this should be ok.
Thanks for suggesting to untwist the wires!
Today, I noticed the artifacts on screen once, but otherwise it worked - tested all three of sensors.
Why I thought it was sensor, is because the error was repeatable two days ago: remove a "bad" one with "good" one, and it worked. Replace it back and it stopped working.
Also, why I think it is not ESPHome related is because when I first received the 3 sensors, I used SHT4x libray demo sketch and just could not get data from sensor, it was frustrating. It was until I used i2c scanner sketch, and found NO sensor that I realised something might be wrong with sensor. Then I changed the sensor, and started working immediately. So the error was repeatable. I also made one video at that point, I upload it here: https://youtu.be/ls4GTg1Zpvo
I am thinking about one more thing: How could time running the sensor impact this?
Could there be some flux on the sensor board which is conductive?
I soldered SHT41 sensor. Display and ESP32 are pre-soldered.
I bought new solder iron and equipment, and soldered fast, so I dont believe I overheated anything. Yes I used flux (Pro'sKit 8S005 Solder Paste). I cleaned sensor board with isopropyl, only where I cannot clean is under the pins.
Update:
Yesterday it happened again.
I was updating code for graph and display for 2, 3 hours (nothing communication related, only config of displaying the values on display graph). Then I left it runnning, and half an hour later display gets artefacts and goes black. Then:
I remove the "bad" sensor, display turns back on, reconnect the sensor, display goes black.
I connect another sensor, everything works, change to "bad" one again, freeze again
Than i start to wiggle the "bad" one in the breadbord, forrward, backward, left, right - not working. Put the "good one" in it is working again.
Then I added two restistors to decrease pull-ups to around 2,2K - nothing. "Good" one works.
Then I added a 10uF capacitor to + and - on breadboard (getting desperate) - nothing. "Good" one works.
Then I connected to logs, and keep replacing the sensors. "Bad" one:
Resolder the pins.
Taking a close look at the photo you posted before, the solder joints look a little matte (esp. on SDA). Good solder joints are perfectly shiny. Matte joints can be an indicator of 'cold joints' that make intermittent contact.
Thanks for your observation. Sensor failed again just now - light was shining on it and it got warmer. If there are really cracks, temperature change could cause this. You might be right.
I went and heat the joints up well and added some tin.
I use this solder: Weller
Here is my "updated" job. A bit too much solder on VIN I know. I reconnected it, it seems to be working (for now).
I think at this point you have two choices, throw away those sensors and buy new ones from a different seller or continue debugging.
If you want to continue, you will need to write and debug some test software using Arduino code, install new libraries for the sensors and make a new test set-up. Then spend a day or two making tests.