0
\$\begingroup\$

I wanted to connect some relays to my Raspberry Pi (for 12V, not 230V) and I found the waveshare RPi Relay Board, which has the following schematic:

Imgur

I like that they spend some thoughts on filtering the 5V supply, but what is the point of the opto-couplers? According to the schematic it appears like they won't provide any isolation.

\$\endgroup\$
5
  • \$\begingroup\$ Not sure why the designer put the (Red?) LED in series with the opto LED emitter on a 3.3V supply. \$\endgroup\$
    – sstobbe
    Nov 18, 2019 at 21:20
  • \$\begingroup\$ @sstobbe Probably just an indicator. Flashy lights are comforting. \$\endgroup\$
    – DKNguyen
    Nov 18, 2019 at 21:22
  • 1
    \$\begingroup\$ @DKNguyen Yes, blinky LEDs are a joy. Just not sure why they didn't drive the 2 in parallel. When their forward voltages are added, they coming close to the 3V3 supply and may only be driving the opto with less than 1 mA. \$\endgroup\$
    – sstobbe
    Nov 18, 2019 at 21:44
  • 2
    \$\begingroup\$ Very closely related: Why are relays so frequently driven by optocouplers?. \$\endgroup\$
    – The Photon
    Nov 18, 2019 at 22:04
  • \$\begingroup\$ Also related... Why adding optocouplers won't help if the ground is shared even by a really long cable. \$\endgroup\$ Nov 18, 2019 at 23:59

3 Answers 3

3
\$\begingroup\$

I think it's redundant. That said, I have heard from someone of experience on SE that although relays provide galvanic isolation, they can't be relied upon to prevent arcs from jumping from the primary contacts to the coil.

I've run into more than one newbies online where they are using a relay to switch a large motor (always an AC motor if I remember correctly) and every time it switches (both on and off) it causes their processor to reset. It's a seemingly unsolvable problem that I can only attribute to the above thus far, but I never hear more experienced people having the same problem nor do I hear them talking about using optos with relays.

However, an opto whose output is not isolated from its input side (as yours is), would not help. Your 5V is probably not non-galvanically isolated from your 3.3V supply and it needs to be for the opto do provide any protection.

Now that I think about it, the focus of the help was always on flyback diodes or RC snubbers across the relay coil and decoupling capacitors, none of which helped. An AC motor would preclude from using flyback diodes across the motor itself (unless they were bidirectional TVS diodes) which is why it was never suggested (and unnecessary if the relay was as isolated as we assumed it to be). However, placing a small RC snubber across the motor itself was never suggested either which should solve the issue if an arc jumping from primary contact to coil is the problem.

\$\endgroup\$
2
\$\begingroup\$

Step currents being full spectrum not only cause a broadband radiated EMI as well as conducted EMI and DC ground shift since that ground is not isolated.

Thus the loop current radiates noise and the conductor path shifts by V=IR+L*dI/dt on the shared return ground path.

Opto isolation will NOT reduce this EMI if you neglect the radiated noise on cables NOR will it reduce and filter your ground if it is sharing a path to the source .

It is a newbie design error or overkill to use opto-isolators with an obvious shared ground from an RPi which uses a 5V to 3.3V LDO. There is no advantage.

Thus it is important to focus on the radiated EMI reduction with shielding, or cable orientation, or CM choke or any combination of the above when using relays to abruptly switch inductive loads from low level logic.

To minimize conducted ground noise issues, you must minimize the impedance from the switched inductive load to the power supply.

e.g. PSU to relay board

  • heavy AWG, short "Star Path", twisted pair,
  • it relies on your experience to physically isolate load wires from control side.
    • not only gap,and orientation but as well use twisted pairs for both.
  • opto isolator = if you have a shared ground
    • this does not reject common mode voltage if the grounds are common.
    • it can perform OK in spite of shared common if you follow the above EMI rules of thumb for conducted and radiated EMI.

Conclusion

  • Design documentation failure by omission
  • gives false hope of better performance unless they specify using isolated RETURN PATH to power source.
\$\endgroup\$
1
\$\begingroup\$

IIRC, the reason that this particular board uses optos is to separate the logic and relay grounds. It is to prevent ground bounce issues when switching the relays (as the inductive relay coil can cause quite the spike on both power and ground nets, even with the freewheeling diodes across the coil). In addition, they translate the common 3.3V logic to the 5V drive level needed to operate the relays. It's not necessarily good practice across the board, but it can save a lot of problems and debugging time right from the start for a fairly low cost.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ How can it separate the grounds when the supplies aren't isolated? \$\endgroup\$
    – DKNguyen
    Nov 18, 2019 at 21:25
  • \$\begingroup\$ You could have separate 5V and 3.3V supplies that were isolated with that board since the only "ground" on that board is to reference the 5V supply. \$\endgroup\$
    – SlashLP97
    Nov 19, 2019 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.