This is probably a very basic question, but unfortunately I have zero experience in this.
So I'd like to get a simple interrupt like signal from one uC to another. The controllers will be installed outdoors on two 2-3m high posts approx. 2m of each other. They will have separate power supplies.
I get the sense, that it's not a good idea to connect the two GND of each controller, because that would be a very long ground wire, which would probably gather undesired noise. So an optocoupler should be necessary the enable the transfer.
But what about the voltage level? Is 5V capable of doing this? Or is higher (e.g. 24V) voltage needed?
Have you considered to use two NRF24L01 (the small SMD modules) to transmit data? You cannot do what you want without a common ground and the signal wire must either be rather beefy or the signal must be shifted up by the transmitter and down by the receiver in order to make it through.
You did not disclose if the signal is one way or both ways. Each one will need a pair of wires.
Opto isolators will work, but you still need a pair each way.
Paul
I would agree with opto couplers. If only one way then the optocoupler should be near the receiver. This because the opto led drive is higher current so less likely to pickup noise.
If these are outside, I would expect even with an opto coupler you will have issues with lightning striking anywhere in the area.
As radio's have been mentioned, how about a simple IR link like a TV remote control. 2M is not that far. I know all my remotes can reach that distance. You might find it simpler.
My opinion is that RS-485 or RS anything is likely to fail if outside.
One article I read from the university of Georgia presented a table of lightning vs voltage differential on the ground. One point in that chart is:
If lightning struck the ground 1/4 mile away the voltage differential across two points on the ground 1 foot apart is 100 Volts.
The signal is just a one way logical bit signal, high/low, that's it.
(sorry, I was not clear enough with the "interrupt like" expression in my first post).
I meant outside, that the controllers will installed outside, but in weatherproof circuit box. So I don't think lightning will cause any trouble if an optocoupler will be used.
The RF solution would create software overhead also, so I would stick with the simplest solution regarding the software.
And what about the voltage level to drive the LED side of the coupler?
It's the LED current you need to think about, a typical opto coupler like PC817 works OK with about 5mA through it's LED which has a forward voltage of about 1.2V, so, if you're driving it with 5V, 5 - 1.2 / 0.005 = 760, a 680, 750 or 820Ω resistor should work. For 3.3V, 390 or 470Ω. The resistance of a few meters of 20 or 22 AWG ( 0.5 or 0.35mm) wire should not make a difference.
If I were doing that, with a little foresight, I would run a 6 or 8 core shielded cable for possible future adventures.
I generally use cheap 8 core alarm cable and test long cable runs, and things, on the workbench before committing to an installation.
For one test I simply cut up a number of 6m lengths of cable, left them coiled up, connected their ends to the arduino and the peripherals, observed if the system worked or not, checked voltages etc.
Using the above method, you can quickly check the effect of joining the grounds on long cable runs, and also check the voltage drops. This should allay your fears.
I know lightning at some point will pass right through an opto isolator. This is because the combination of a very fast risetime and potentially large voltages can overwhelm the 4k 60 Hz specification of your average opto isolator.
However depending on where you live and if lightning strikes nearby you might have no issues. However if its toasted one morning I would consider lightning a strong root cause.
The best you can do with an opto is wire the inputs and outputs in opposite physical directions keeping them as separated as possible.
BYW If I were making this, I would start with the opto (because its easy) and perhaps order parts from eBay to have on hand in case the opto becomes problematic.
The situation somewhat changed since my original post. The power supply (12V) has to be wired over a long distance , about 20-25m. It is outdoors, so the wire will be in a protection tube under the ground.
Besides the first step; choosing the sufficient wire cross sectional area based on the expected current flow and the allowed voltage drop, what precautions should be taken for robust operation?
An Arduino Mega board will be powered from the supply. Thanks in advance!
Just another solution to get you confused ;-):
Use a constant current source to transmitt your signal. E.g. 10mA equals logical high, 0mA equals logical low. Let this current flow through a resistor at signal's destination to achieve approbriate voltage logical level (e.g. 470Ohm to get 4.7V = 0.01A * 470Ohm). Make sure, that wire resistance is far below that 470Ohm.
For 3V3 MCU adapt resistor accordingly.
You want to add capacitors at the board. I suggest 0.1µF in parallel with a 47 to 100 µF. These will supply energy to your board in the case of an LED (opto) turning on.
The processor output and any mosfet you choose to drive the Opto will have a fast risetime unless you add component to make it slower. Adding 30ma load with a fast risetime may drag the power supply down locally due to any inductance in the feed wires. These caps hold up the power at the board to compensate for any potential loss.