RobTillaart / SHT31

Arduino library for the SHT31 temperature and humidity sensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isConnected returns true if voltaje to SHT31 is not connected.

ravargash opened this issue · comments

Hello!

I'm making a small tester for an SHT31 that passes though a connector. I'm making a small test to check if the connetor is well made. I tried using the isConnected function and simulate different connection errors and turns out that the funcion returns true when no power is provided to the sensor.

Is this normal or there is an issue?

Using an Arduino Nano board and a common SHT31 sensor board. To trigger this issue, just attach or detach the respective pins

Regards!

SHT31tester.zip

@ravargash
(No hardware here to recreate the specific effect nearby)

Possible explanations:

one
It could be that some remaining change is in the sensor after disconnecting the power.
To test this assumption you could place your connected test in loop() with a delay(1000).
Then you would get some OK's and when the charge is gone you would get FAIL.
(then you have continuous testing)

two
The sensor is charged somehow e.g. by the CLOCK signal (sort of parasite power.
To test this assumption you can measure with a scope if you see a changing voltage on the 5V pin of the sensor
Another way to check this is to have a pulldown resistor of 10K between the 5V and the GND.
Then if you disconnect the 5V from the sensor, the sensor 5V pin will be drawn to GND so definitely get no
power.

Hope this helps

Hello!

Thanks for the quick reply. Actually, it was very stupid of my part. The SHT31 has such a low consumption that the capacitor installed can keep it powered for a few minutes.

However, I did found that when effectively discharged and unpowered, the code hangs whenever the endTransmission funcion is called. This can be fixed by setting setWireTimeout at setup. I used Wire.setWireTimeout(1000,false), as I don't care if the bus keeps hanged.

Regards!

The only stupid thing is when you do not learn from this experiment ;)
failures are far better teachers than success!

If no questions remain, you may close the issue

Good one. Thank you!