Is there a preferred method for connecting a switch input?
Don M
Posts: 1,652
By method I'm referring to whether you tie a pin high (through resistor) and then pull it low with the switch or vice versa. Any pro's or con's? I would probably gravitate to tying high and pulling low but wanted some of the "experts" opinions here.
Maybe it really doesn't matter?
Maybe it really doesn't matter?
Comments
1) The pullup can be close to the device (microcontroller) in question and Vdd is readily available there. By having the pullup associated with the input pin, it's always there if the switch is somehow disconnectable.
2) The only wires needed to the switch are the signal line and ground. Ground can be used with twisted pair wiring and/or shielded cable for noise protection. You can use Vdd, but then the noise protection depends on the quality of the bypassing between Vdd and ground.
3) For switches permanently mounted close to the input pin in question, it probably doesn't matter which scheme you use.
http://forums.parallax.com/showthread.php?143174-Switch-or-Whiskers-pulled-up-to-3.3-or-pulled-down-to-0-when-open.
And that voltage is like water flowing in to the middle line (that goes the the mcu input) and it fills up/empties out if you press switch.
5M is like a tiny drip
10K is like a 1mm small pipe
2 ohm is a 1 foot wide pipe.
1mm pipe will never fill up the middle line if it has a 1 foot wide drain pipe connected etc.
And no capacitor if the switch has gold contacts, (we don't want a tiny spark).
Duane J
The processor does not care, either way.
However, other considerations can apply :
If the switch is remote, taking the chip Vcc out into the 'real world' is generally considered risky. Slips to GND or worse, raw-battery become costly...
ESD considerations also prefer a GND pathway, and there, some series resistance (100 ohm-1K) in EACH wire, can lower the ESD current levels, and therefore the disturbance voltages - you will see some TACT buttons come with an extra ESD pin, because of this problem.