# A question about using optocoupler instead of FET for longer signal wires

After my previous question I had concluded to use the following circuitry to operate this solid state relay:

But now I found out that, from the micro-controller(Arduino UNO) digital output pin to the relay there will be around 3 meters of wire.

Now Im worried because of the length of the wire, noise can induce voltage at the gate of the FET(?).

So I thought better to isolate the grounds of the micro and the relay input.

Im not familiar with optocuplers but could the following be a better solution for such scenario?:

The SSR " Input Impedance" is given as "current regulator" 16mA for 5V. So would this optocoupler need an extra resistor? I have the 4N26 at the moment.

It sounds to me like you have a pretty good grasp of the hazards.

At the frequencies I imagine you want to switch that relay, (very low) the only reason that the long cables leading to the gate and source of the target MOSFET would have a voltage induced in them that you didn't intend (noise) would be if they are sufficiently far apart, or there's another ground (return) path which is physically separated from them.

Assuming that the ground common to both sides is one of those two wires, then twisting them together, or otherwise ensuring that they run very close to each other, would go a long way to mitigating induced noise, be it magnetically induced, or capacitively.

Since the MOSFET has ridiculously high impedance to ground via its gate, it's true that any noise current induced in the wire could cause serious voltages to appear between the wires, and influence the MOSFET, but the way to deal with that is to ensure that the impedance $$\Z\$$ around the entire loop is low enough to make induced $$\V=I\times Z\$$ voltages negligible compared to the MOSFET's gate-source threshold voltage.

The simplest way to do that is to ensure that the impedance between the wires at the MOSFET end is small, say 1kΩ. In fact, the optocoupler in your second circuit would be much better than the first circuit, precisely because the combined impedance of R3 and the LED is in the low hundreds of ohms. Compared to the 47kΩ resistance across the wires in the second circuit, you can expect two orders of magnitude less interference across the LED than the MOSFET's gate and source.

You can fix that easily, by replacing R2 with 1kΩ, assuming your signal source can drive that. If your Arduino output can drive an LED and 220Ω resistor, it can drive 1kΩ.

The second reason you might find the optocoupler works better, is that its response to transients will be much slower.

You can achieve similar rejection of high frequency noise with a capacitor across R2. If you expect to be switching the SSR on and off no faster than, say, 1Hz, then you could use any capacitance which when combined with loop impedances gives you a cutoff frequency somewhat above 1Hz. Don't connect an Arduino output directly across a capacitor, though - place a small resistance in series to keep current sensible when the capacitor is discharged - say another 220Ω

You might end up with something like this:

simulate this circuit – Schematic created using CircuitLab

The thevenin equivalent resistance of R1 and R2 is about 200Ω, meaning noise will be heavily attenuated at freqencies above:

$$f_C = \frac{1}{2\pi \times 200 \times 1\mu} = 800\text{Hz}$$

Don't forget that the potential divider R1 and R2 will attenuate to 80%, so be sure to use a MOSFET with low $$\V_{TH}\$$.

This circuit above should perform similarly well to your optocoupler design. Don't rule out the optocoupler option, though, galvanic isolation can very very useful. Considering optocouplers generally have the transistor built in, parts count could even be less.

As for the input impedance of the SSR, again you've hit the nail on the head, this is indeed a concern. However, regardless of the relay, there's no harm at all in placing a resistor between MOSFET drain and +12V (across the relay's inputs), to ensure that drain voltage is guaranteed to rise to +12V when the MOSFET is off, and to help remove potential across the relay's input. It can be many kilohms.

It would be easier to protect the gate rather than adding an opto-coupler.

To protect the gate, you can add a Zener diode with a voltage lower than the Mosfet Vgs max and a 1k resistor in serie.

You can also add a small cap to dampen the noise.

simulate this circuit – Schematic created using CircuitLab

Another simple option is to replace the FET with a NPN Transistor, since the transistor is current driven, noise from the cable will have little effect.

simulate this circuit

Don't forget the flyback diode on the relay.

• Gate threshold voltage for 2N7000 is 3V. Your zener is 5.1V. Is that fine? Oct 8, 2018 at 13:24
• @panicattack The zener diode should be greater than the designed operating voltage of the circuit. Oct 8, 2018 at 13:25
• You should look at the Vgs Max, it is usually on the absolute maximum rating section of the device datasheet. It is +/-20V for 2N7000 Oct 8, 2018 at 13:26
• The relay is SSR doesnt need a flyback diode Oct 8, 2018 at 13:26
• No my aim was if the noise couples it would false trigger at even 4V. zener will not prevent that. Oct 8, 2018 at 13:26

Going from your first schematic to your second schematic doesn't really help. If anything it might be worse. It's like deciding whether beer is better than smoking.

What you want is either twisted wires, a shielded cable (coax) or differential signaling.

By twisting the wires, the electromagnetic fields that may be interfering with the loop is being twisted. Imagine just one twist, forming the number 8. Then as electromagnetic interference is interfering with both holes in the 8, the current cancels out. By having more twists, you are making more of the cable like an ooooo (imagine infinity symbol), meaning that you are less sensitive to where the noise is. This is probably good enough for you. If your design is going to be on a vehicle, or something else with a lot of noise, then you will probably want to use coax or differential signaling.

The coax is simply covering your signal with ground. The idea is that any noise that would interfere with your signal wire, is instead shorted to ground, and your signal is unaffected. This is slightly more expensive compared to twisting the wires (free). But this is also great.

If you are for some reason in an environment that is so ridiculously noisy, or working with very high frequencies where everything can be considered as noise. Or you just want to be ~100% certain that you want your signal to work as intended. Then you can have two wires in differential mode, one with your signal, and another that is negative of that value. So if you want to send 5 volt, then you would send 5 and -5 on to wires. And if you want to send -5 volt, then you send -5 and 5 volt. The idea here is that any noise that effects your signal, will also affect the other signal right next to it. So any noise will be cancelled out because you will be, on the receiving end, measure from one signal to the other. You will probably need two chips for this, one on the sending side and one on the receiving side, for your particular setup.

I'm not 100% sure if coax is better than differential signaling, or vice versa. But you can use both together which might be something you'd do for a medical product where something just is not allowed to fail. If something fails, someone dies. Just twisting the wires is probably good enough for you, though I don't know if your product is about life and death, or how noisy your environment is.

• For long wires the opto solution is recommended. Since it isolates the grounds of the transmitter and the receiver. Differential signalling is not possible for me for this case. Oct 8, 2018 at 13:54
• @panicattack I think that is for reasons which are not relevant to you. Here's why: 1) aren't you sharing the ground? Meaning that both ends are close to each other, voltage wise? Meaning that using an opto solution is pointless? 2) The channel (loop/wire) is still there, which is still susceptible to noise. 3) an opto solution is good when the LED side is floating, or on an entirely other voltage potential than your BJT (in the opto-IC), neither of which is the case in your schematic, or problem (I think, I still don't know how you are powering the two different sides (arduino & ssr)). Oct 8, 2018 at 14:01
• The power supply for the uC and the SSR Relay are different power supplies they dont share grounds. For the opto case I mean Oct 8, 2018 at 14:11
• My problem is here since I dont know the input impedance of the SSR I cannot be sure whether I need a resistor for the collector. docs-emea.rs-online.com/webdocs/140b/0900766b8140b509.pdf It says for the inout impedance "Typical Input Current @ 5VDC! is 16mA. I dont know what does that mean. Oct 8, 2018 at 14:19
• @panicattack That is a messy datasheet, yeah, I'm on the same confused page as you. - It looks like you don't need a NMOS / opto. - Don't you have the SSR infront of you, allowing you to test it out? Oct 8, 2018 at 14:21