Detecting a Dry Contact - false detections

jimmie

Well-known member
I have a Teensy 4.1 which is being used to detect a "dry contact" on one of its pins (basically a relay closure where no voltage is involved). I am using the Bounce2 library. In the office, when shorting pin 32 to GND using a short wire, everything works as expected and I can detect the closure.

Code:
pinMode(32, INPUT_PULLUP);

This Teensy is powered in the field by a POE cable and a splitter. At the field, they placed the POE RJ45 cable along with the two "dry contact" wires in the same conduit. The length of the wire run is about 25-30 feet. (please refer to diagram).

Now, when the system starts, I am getting a dry contact on that pin all the time! What may be causing this and how can I prevent it?

Thanks in advance for the community's help as my knowledge of hardware is limited.
 

Attachments

  • Dry Contact Switch.jpg
    Dry Contact Switch.jpg
    143.2 KB · Views: 22
Last edited:
The most likely scenario is that your 30 feet of wire is acting as an antenna and picking up stray 60 (50) cycle fields. It could also pick up nearby transmitters such as FM stations, ethernet access points, whatever is nearby. You could look with a scope if you have one.

Best case you may be able to reduce noise on your signal by using an external pullup to 3.3 volts instead of the internal pullup. A resistor of maybe 1k may work. Worst case you may need a signal conditioning circuit of some sort or perhaps use twisted pair transceivers to remove common mode voltages.
 
Thank you very much rcarr. Is this what is called "crosstalk"?

Would the circuit with the resistor look like this?
 

Attachments

  • Dry Contact Switch.jpg
    Dry Contact Switch.jpg
    144.8 KB · Views: 23
Thank you KurtE for your help on this question and on previous posts.

I will read the link you provided to find the value for the resistor.
 
Back
Top