I am looking for some advice on running long wires (from a 20 foot wire pair to a 250 foot wire pair) (some 14, 16, and 20 gauge wire) to Connect a spst momentary pushbutton to an I/O pin on the arduino.
The only examples I found are where the button is just a few inches the arduino I’ve seen examples where they use pull-up resistors and examples where they use pull-down resistors. Some where the use 5volts and some where they use 3.3 volts. I guess I should use the larger ( 5volt) on a long wire run. Please advise me on the resistors (value as well)
Since you’re not moving much current the wire gauge doesn’t matter, nor the Arduino running voltage. What will be an issue is switch bounce, and that has nothing to do with the gauge or voltage. It may be exacerbated by the long wire length and the wires LC characteristics. Debounce using software and/or hardware. If this runs outside you may want some lightning protection for that pin. Using twisted pair, perhaps shielded, to cut down on induced noise might be a good idea too.
At those distances, I’d prefer the 5V Arduino because you get better noise immunity with the wider voltage swings. I’d probably also go with 100 ohm pullup resistors to increase the current and reduce effects of noise coupling in.
Like 'Mac said, if it’s outside (or even inside under certain conditions), protect the Arduino with transient suppression. If you still have trouble with noise, the old-school RS232 receiver chips (1489?) can let the switch lines run at 12V and couple to the Arduino at 5V for even better noise immunity. I designed a PC parallel-port (remember those?) input interface using them and it worked really well.
steven834:
I am looking for some advice on running long wires (from a 20 foot wire pair to a 250 foot wire pair) (some 14, 16, and 20 gauge wire) to Connect a spst momentary pushbutton to an I/O pin on the arduino.
The only examples I found are where the button is just a few inches the arduino I’ve seen examples where they use pull-up resistors and examples where they use pull-down resistors. Some where the use 5volts and some where they use 3.3 volts. I guess I should use the larger ( 5volt) on a long wire run. Please advise me on the resistors (value as well)
Thank you.
Steven
250 ft.
RS232 will do that at moderate speeds and with low capacitance cable. Maybe even cat5. Be sure to keep TX,TX in separate pairs.
Don’t bother trying with 3.3V or 5V single-ended logic signals, even with low ohm pullups.
forgospic:
“the old-school RS232 receiver chips (1489?) can let the switch lines run at 12V and couple to the Arduino at 5V for even better noise immunity”
I tried this… no go. Any other options that are similar in simplicity and ease on the budget?
What was “no go” about it?
As far as other low-cost solutions, a current loop comes to mind. Not as cheap, but should be under $1/channel.