Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isConnected returns true if voltaje to SHT31 is not connected. #25

Closed
ravargash opened this issue Oct 21, 2021 · 4 comments
Closed

isConnected returns true if voltaje to SHT31 is not connected. #25

ravargash opened this issue Oct 21, 2021 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@ravargash
Copy link

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

@RobTillaart
Copy link
Owner

@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

@RobTillaart RobTillaart self-assigned this Oct 21, 2021
@RobTillaart RobTillaart added the question Further information is requested label Oct 21, 2021
@ravargash
Copy link
Author

ravargash commented Oct 21, 2021

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!

@RobTillaart
Copy link
Owner

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

@ravargash
Copy link
Author

Good one. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants