I/O long distance

Hi, i want to connect my I/O to some devices directly for long distance.

For example, i have a few buttons connected directly to some input pins in Arduino by RJ45 and that works OK. I tried with a few dozens of meters and that worked OK.

Now i want to know if there is a better way to communicate in long distance. Notice that i dont want to interface with some kind of protocol communication(UART, I2c etc..). I only want to interface my devices directly with I/O of my arduino. If i want UART for long distance i use RS485. But in this case i have an RJ45 and 6 of the 8 pins have to connect directly with my long distance divices.

Thanks :slight_smile:

What is "long" ? 1 meter ? 100 meters ? lightyears ?
Which devices ? For example the temperature sensor DS18B20 allows pretty long wires.

Long = >500 meters.
My devices only require for example paralel inputs. And dont use any kind of communication. But they can be Input or output.

More than 500 meter is long indeed, very long.
The wires will have a strong influence on each other, and signals will jump and overshoot like crazy.
You need at least RC filters on both sides with clamping diodes to clamp the voltage between 0 and 5V.

Are there mains power cables next to it ? Are they under the ground, or is there any chance for lightning to hit the wires ?

What kind of data to you want to transfer ? Just a low or high signal that changes only once per minute ? Is it really only pressing buttons ?

My suggestion is to use a (professional) wireless communication.
Or RS485 signals for each 100 meters.
Or sending SMS messages.

Peter_n:
More than 500 meter is long indeed, very long.
The wires will have a strong influence on each other, and signals will jump and overshoot like crazy.
You need at least RC filters on both sides with clamping diodes to clamp the voltage between 0 and 5V.

Are there mains power cables next to it ? Are they under the ground, or is there any chance for lightning to hit the wires ?

What kind of data to you want to transfer ? Just a low or high signal that changes only once per minute ? Is it really only pressing buttons ?

My suggestion is to use a (professional) wireless communication.
Or RS485 signals for each 100 meters.
Or sending SMS messages.

As a partner of LuisCRSousa on this assignement, we only want to read buttons on this cables.

500 meters will be absolut maximum cable lenght. In some cases two of the wires will be Power lines, 12V and GND. The Current will be fixed at minimum, maybe a maximum of 100mA.
The data lines will have to drive just a few mili amps.
In some cases i will have to output random values on 6 of the 8 lines available fast (1000 times a second maybe).

If i use a RC filter and clamping diodes this can be possible?

I get a weird feeling in my stomage... meaning that this might cause a lot of problems.
1000 times a second is a lot in this situation. Can you drop this ? or lower this feature to 10 times a second ?
Then there are the ground wires, such long wires can easily generate current that damage the Arduino and a computer via the ground wire.

I think the only good option is to use optocouplers. That way it doesn't matter what happens on the wires, the Arduino is protected. You need a seperate power supply for the optocouplers. You don't need very heavy filters, so perhaps 1000 times a second is possible (I still doubt that, 100Hz is more likely).
The most simple way is to have the input of the optocoupler connected to the wires (with power supply and resistor), and a button at the end. When pressing a button, about 10mA will activate the optocoupler and the output of the optocoupler is connected to the Arduino.

You can do some filtering in the Arduino. For example a button should be pressed during 20ms before it is considered to be valid.