I've been designing special controllers for a few years now, and the one thing that gives me a headache every now and then is when I need to read a push-button connected to the circuit through a very long wire... say, 20 meters long.
Since 5V was being such an annoyance due to spurious detection, I decided to switch to a 12V signal that would arrive at the MCU's input through a shielded cable (whose shield is grounded at one side only, to prevent a ground loop), and into a voltage divider formed by R1 and R2, as shown in the following figure.
C1 is there to help de-bounce the switch and to further minimize false detections.
This modification improved things significantly.
The circuit, however, still gets false readings every once in a long while, and I'm beginning to feel that the wire arriving into R1 from the push-button is acting as an antenna of sorts... so I figure that adding a weak pull-down (that is, R3 in the following figure) should improve things further.
Am I right in this last assumption? O is there a better way to accomplish what I'm trying to do?
Since 5V was being such an annoyance due to spurious detection, I decided to switch to a 12V signal that would arrive at the MCU's input through a shielded cable (whose shield is grounded at one side only, to prevent a ground loop), and into a voltage divider formed by R1 and R2, as shown in the following figure.
C1 is there to help de-bounce the switch and to further minimize false detections.
This modification improved things significantly.
The circuit, however, still gets false readings every once in a long while, and I'm beginning to feel that the wire arriving into R1 from the push-button is acting as an antenna of sorts... so I figure that adding a weak pull-down (that is, R3 in the following figure) should improve things further.
Am I right in this last assumption? O is there a better way to accomplish what I'm trying to do?