Electronic – Switching relay directly with an optocoupler

driveropto-isolatorrelay

I have a relay network (more than 1 relay running in parallel), that I need to operate using a STM32 based MCU.

The relay I am using is Omron G5V-1 (24v).

I wanted to know if I can directly run these relays with optocouplers such as PC847.

Looking at the calculations, G5V-1 has a nominal power usage of 150mW @ 24VDC. So technically around 6.25mA. Each opto-isolator block in PC847, is rated at a max of 35VDC and 50mA, which is well above the safe range for driving the relay coil.

  1. Is it really necessary for me to add an extra transistor, diode and
    a resistor as the relay driver?
  2. What are the tradeoffs of not using these and directly running off the optocouplers?

Have seen similar questions (Driving relay directly from optocoupler, what is best?, Why is transistor needed when using a relay?) though, but haven't been able to draw conclusions.

Adding Schematic:-

Sample schematic for the above question

Best Answer

I wanted to know if I can directly run these relays with optocouplers such as PC847.

The simple answer is yes but, you will waste a lot of power driving the internal opto LEDs. In fact, you will use more current driving the internal LED than what your relays need. Consider this: -

enter image description here

To drive 7 mA through the phototransistor (\$I_C\$) with low volt-drop (say 0.6 volts) requires an LED drive current (\$I_F\$) of 7.5 mA and this is just a typical device; to guarantee that all devices work you should be aiming to drive \$I_F\$ at twice this value i.e. your STM32 ought to be pushing 15 mA into each opto.

That's over twice the current needed by the relay and may actually exceed what is allowed from the STM32. Of course you might get away with 10 mA but then, you might be scratching your head when a couple of channels don't work properly. How much do you value your time is a question I sometimes ask in this situation.

Compare this with an NPN transistor and a base resistor (much more efficient and much less base current needed) and the comparison numbers don't really stack up but, you may have "special" reasons for going down this route.

Both solutions will need flyback diodes across the relay coils.