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.
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?
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 .
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)