hi just wondering if there is anyway to protect input pins from external cabling, im using low's for my inputs and a cable run of 15 metres, ive tested the run it works ok, but a bit worried about static, noise ect that might damage the pins thanks
connect a pull-down resistor to the pins not used?
There are diode clamps inside the AVR chip, but with long cable they could blow.
Just one resistor for every input pin is the most common solution. Say about 1K.
A coil with two capacitors is also a good solution, but the resistor in the line is most of the time a better solution. The input impedance of the AVR chip is very high, so the resistor does almost not influence the input signal.
If there are very heavy spikes or danger for high voltages, you have to add a good protection circuit. But that will probably slow the signal.
You can use external diodes to beef up the internal ones - best way is to use some schottky diodes (which have a lower forward voltage and will take all the current away from the internal diodes - schottky diodes are also very fast and won't affect the signal at all.)
You wire one diode cathode-to-signal, anode-to-ground
The other is anode-to-signal, cathode-to-5V
In the absence of schottky diodes the traditional signal diode like 1N4148 will give a reasonable degree of protection as they can take 100mA or so happily, but to be sure add a 1k resistor between the diode junction and the input pin to limit current to the internal diodes.
See this page http://www.thebox.myzen.co.uk/Tutorial/Protection.html
Simplest solution is a resistor in series with each input that's connected to the long cable, however I'd choose 10K rather than 1k.
Are there any guidelines/references for when such protection measures are necessary? I'm curious because I have a model railroad installation; actual interfaces to the track are optoisolated, but there are still 3A AC electromagnets going off in the vicinity.
And if so, what about an output pin? I.e., if I have the Arduino controlling a LED over a meter or so of wire, where the wire runs through a noisy environment?
[quoteAre there any guidelines/references for when such protection measures are necessary][/quote] No you must treat each case individually, unless you are trying to comply with some ESD standards ( Electro Static Discharge )
Because outputs are a much lower impedance than inputs they pick up much less interference so clamping in not so important.