Hi everyone! first post here..
I need help with my arduino project. I have several machines that I want monitor. Each has a relay that is powered when machine has failure. These relays are connected to arduino with approx 100 meter long wires:

Currently I have 100 ohm pull up resistors in each digital pin and a software that checks the digital pin state every 2 seconds. If it's LOW then it writes "Alarm in device X" to serial.
The problem is that the industrial environment where the machines are is very noisy. These 100 meter long wires run next to big cables with large currents. So every now and then arduino senses the pin LOW even if the machine doesen't have failure.
I was thinking to put second relay next to each digital pin to trigger the pin and then control the coil (12 volts) with this relay in machine. Now I would have short wires to digital pins that don't act as antennas.
Is there a more efficient way to achieve reliable sensing of digital pins?? I think adding 100pF caps between the digital pin and ground isn't enough to filter the noise. If I disconnect these long wires from arduino and connect a led to them, the led blinks randomly, so the noise is quite strong..
Thanks for your help!
With such a distance you are best using a differential line driver and a differential receiver at the other end.
Thanks for your answer! Line driver sounds good and reliable.. However I have almost 20 of these alarm relays in different locations. I assume that I need 40 of these line drivers + powering each chip? On the other hand with second relays near arduino I would need 20 extra relays + 12v power supply:

or you could use 24 - 110 - 220 V and only near the Arduino you convert the signals to 5V ?
If speed is not a concern (and I dont think it is, here):
Make the pull-up resistor in the order of 10 kOhm, with a 47 uF capacitor parallel to it.
Put a resistor of 1 kOhm in series with the input line.
Now you have a time constant of 47 ms that needs to be overcome before the input will trigger.
This is longer than a period of your noise signal, so it will be filtered out.
It will however also delay your signal by approx 50 ms.
Lion251:
If speed is not a concern (and I dont think it is, here):
Speed is not important. In fact something like 0.5 or 1 sec delay before the alarm is triggered would be tolerable. I'll try your setup. Is this correct or should I place the capacitor between 5 volts and digital pin??

If you twist the pairs of relay wires (twisted together quite tightly), or buy "twisted pairs" the noise is "injected into both wires in phase which, at the arduino end, effectively cancels out the noise. Fitting a 0.1 mF capacitor at the input terminal to ground will also reduce the noise level.
I would also suggest lowering the system impedance, say 1k from input terminal to ground and 1k from 5v to the relay feeder wire. The 1k in the feeder wire will also provide short circuit protection from the 5v source into the "field". You are now sensing from 0v to +2.5 volt
You would also benefit from a) rerouting the signal cables away from the power cables and b) using shielded cables with the shield connected at the arduino gnd terminal ONLY (tape up the remote end of the shield so that it cannot connect to earth at the machine (otherwise you will get serious ground loop noise currents)