Hi,
I am seeking recommendations, or a tutorial, on how to drive a relay using a 3.3Vdc 2mA digital output from an MCU.
The relay requires a 12Vdc supply and the coil resistance is 270 ohm drawing approximately 45 mA.
I had thought I could use a optocoupler to switch the ground connection of the relay coil but I'm unsure how to correctly size the current limiting resistor between the digital output and the anode of the optocoupler.
Help with my calculations would be appreciated or alternatively if there is a simpler/better way to achieve the same result please let me know.
Thanks,
Neil
I am seeking recommendations, or a tutorial, on how to drive a relay using a 3.3Vdc 2mA digital output from an MCU.
The relay requires a 12Vdc supply and the coil resistance is 270 ohm drawing approximately 45 mA.
I had thought I could use a optocoupler to switch the ground connection of the relay coil but I'm unsure how to correctly size the current limiting resistor between the digital output and the anode of the optocoupler.
- If I assume Vin = 3.3V, Vf = 1.25V (from data sheet) and If = 20 mA (from data sheet) and using the equation R =(Vin-Vf)/If then the current limiting resistor would be 10.25 Ohm. At 3.3V a 10 ohm resistor would draw 330 mA but the MCU output can only deliver 2mA @ 3.3V.
- I am also confused about the CTR (%) for the optocoupler. If I assume Ic = 45 mA and If = 20mA and using the equation CTR (%) = (Ic/If) * 100, the CTR for this configuration is 225%. I can't see on the data sheet if this will be ok.
Help with my calculations would be appreciated or alternatively if there is a simpler/better way to achieve the same result please let me know.
Thanks,
Neil
