I'm using a reed switch to detect the state of my garage door. It's connected to an ESP8266 via twisted cables of 1.5m and each line has a pull-up as the signal floats too much otherwise.

Well it still floats and I've been wondering whether it would've been wiser to use the 5V for the pull-up instead of the 3.3V I used. The ESP is 5V-tolerant so that should be no problem.

As far as I know, the higher the voltage the stronger the signal, but I may be spoiled by landlines with high voltage. :-)

Thanks for clarifying.

  • \$\begingroup\$ Adding a diagram of your existing design would help. However assuming you have your pull-up (currently to 3.3V) on the input pin to read "High" when the reed switch is open, and expect to read "Low" when the reed switch closes and connects the signal to Gnd, then in which state(s) do you believe the signal still "floats"? How did you decide that it floats - did you view that signal with an oscilloscope? What value is your pull-up resistor? Only a 1.5m cable is very short to be having problems... \$\endgroup\$ – SamGibson Aug 18 '18 at 14:18


simulate this circuit – Schematic created using CircuitLab

Figure 1. Filter capacitor on input.

Try adding a 100 nF capacitor on the input to your micro. This will shunt any high-frequency noise to ground and provide a little "debounce". The small delay when the switch opens - a couple of milliseconds - should not delay you getting the car in and out of the garage.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.