Electrical – Is this optocoupler driving relay circuit reliable and works great

microcontrolleropto-isolatoroptoelectronicsrelaytransistors

This is the circuit that I have, the optocoupler is an EL817 and the transistor is a BC817, the 24V relay is an Omron g2r_1_e, a 24V coil relay.

But when the optocoupler input is floating (not connected to any thing,) VBE on Q1 is floating.

enter image description here

This circuit should be reliable, so I added a 10k pulldown resistor to Q1 base pin, therefore when the EL817 input is floating the Q1 base is always 0V and the relay always off.

This is a kind of darlington but I add a pulldown to it, and I don't if it will work well.

Will this circuit work reliably?

Are the values correct?

Update:

First the R2=1kohm,when i power the circuit on ,R2 is warm and draw current,its base limiting resistor ,it should not get hot!so i change it to 10k .
enter image description here
this is my calculation for R2 : I suppose Ibase Q2=2ma (relay coil current is about 30ma,relay coil is 24V) , 24v-0.7v(EL817 Vce)-0.7v(Q2 Vce) =22.6V ,R2=22.6v/2ma=11.3Kohm.=>R2=10kohm is good. Pr2=V*I -> Pr2=22.6*2ma=45.2mw so i select 0805 package.

1-Is my calculation right? 2-Is it ok i connect the EL817 collector directly to 24v without any resistor?(i think R2 is limit the current)

Best Answer

I don't see much of a point for D3.

R1 also seems really high. You actually need to calculate the current required by the opto LED and size the resistor accordingly to the voltage being applied.

You don't need R3 because Q2 is not a MOSFET which stays on as long as there is a voltage on the gate-source capacitance (which would not be discharged if the opto simply disconnects the gate). But a BJT requires base current to actually turn on and stay on. The opto simply disconnecting the base will do the job.

10K seems a bit big for R2 though. And you have no current limiting resistor on the relay coil so it had better be a 24V coil.

A 1N4007 is too slow to act as a flyback diode for D4. You should use a 1N4448 or something faster.

I'm not sure you need the opto either since the relay already has galvanic isolation, but I've recently heard of people having troubles that seem to be attributed to arcing from the primary contacts over the coil and causing resets.