1
\$\begingroup\$

Apologies in advance if this has been asked before, but I haven't been able to find anything like it. Please let me know if it has.

I'm curious about the proper/standard way to connect a SPDT switch in a digital circuit. Below are two potential configurations for connecting a high/low signal to a digital pin-- which is better? Are neither of them preferable?

I know the first can use a simple SPST instead of the switch I used; I'm more concerned with the wiring principles. Is it sensible to leave a power signal "floating", like in the bottom configuration, or does it not matter? Should a pull up/pull down resistor configuration be used instead?

Thanks a ton!

Two different wiring configurations

\$\endgroup\$
  • 3
    \$\begingroup\$ you are not thinking clearly ... regarding the 2nd circuit ... what happens to the input pin when the switch is moving from one contact to the other? \$\endgroup\$ – jsotola Dec 8 '17 at 3:57
  • \$\begingroup\$ Ah, of course, it floats. You're absolutely right! \$\endgroup\$ – Kyle Dec 8 '17 at 4:00
  • \$\begingroup\$ note: the controller that you are using may already have internal pullup resistors, in which case all you would need is a switch to ground \$\endgroup\$ – jsotola Dec 8 '17 at 4:08
  • \$\begingroup\$ you want to debounce the switch, Logic or power? \$\endgroup\$ – Sunnyskyguy EE75 Dec 8 '17 at 6:22
  • \$\begingroup\$ @jsotola is correct, for peace of mind it might be better to tie the second throw position to the input pole. After all, one never knows when you might put an invalid voltage on an exposed or floating pin and fry an input into your MCU. \$\endgroup\$ – Dave Dec 8 '17 at 11:17

Your Answer

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

Browse other questions tagged or ask your own question.