You will need good protection circuitry if the cables run alongside mains cables (these can have kV level spikes on them which would induce crosstalk voltages easily capable of frying the Arduino.I'd suggest for protection using a 10k resistor in series with the cable at the Arduino end and a 100pF to 1nF capacitor to ground on the input pin. The chip's protection diodes ought to do the rest (adding schottky diodes will be more rugged). Since the application doesn't require high speed operation the low-pass filter formed by the resistor and capacitor won't be an issue.You will need to debounce the signal since it comes from a relay.
You could test at your place easily enough. I'd start with a circuit like the attached. I'd definitely use software debounce as well, probably for some ridiculously long time like 100ms. There are several debounce libraries out there. My favorite is the one I wrote https://github.com/JChristensen/Button
Sorry about the capacitors...
I take it that Zener can be any 5V Zener? Or is there any particular reason why you chose that model?
Just after I posted my previous reply I did realise that I could test at my place with a 20m cable. What I couldn't test is any potential interference caused by specific wiring at my friend's house. But he assures me that these cables do not run parallel to mains cables.
Quote from: Jack Christensen on Jul 04, 2012, 10:28 pmSorry about the capacitors...Apology accepted...
yup...and MarkT recommended a 10kOhm protection-resistor instead of the 220Ohm resistor...
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16