Electrical – Drive relays with optocoupler and a Raspberry pi

currentopto-isolatorraspberry pirelaytransistors

I'm currently designing a PCB in order to drive relays (5V) with an optocoupler and a Raspberry pi (a CNY74-4 here is the datasheet). So I made this schematic:

Schematic

My questions are the followings:

  • Is my scheme right?
  • The 5V come from an DC/DC supply which deliver 2.1A and 5V, it's not a problem for the optocoupler and the transistor?

  • Which CMS transistor can I use in this case?

  • Is the optocoupler good for this use?

THanks for your answer!

Best Answer

The 5V come from an DC/DC supply which deliver 2.1A and 5V

I suspect that there isn't a need for the opto couplers. By the sounds of it, the 5V is rated also for the RaPi (2.1 A) and so there is no benefit from adding the opto because the relay will provide isolation from the load however, you do need to use flyback diodes across the relay coils to prevent damage to the NPN transistors.

Looking at the spec of the opto, it has a minimum CTR (current transfer ratio) of 50% and therefore you are roughly obliged to feed (waste) more current driving the opto than you would driving the NPN directly.