0
\$\begingroup\$

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)

\$\endgroup\$
  • \$\begingroup\$ Bear in mind that with R1 at 1 kΩ, you will have less than 2 mA through the LED on the EL817. That may be enough since you are using a second transistor, but don't be surprised if you can't get more than a mA out of it. \$\endgroup\$ – evildemonic Nov 15 '19 at 21:46
  • \$\begingroup\$ there is no Q1 in the schematic \$\endgroup\$ – jsotola Nov 15 '19 at 22:41
  • \$\begingroup\$ @evildemonic you are right,i have mistake here,the datasheet said :IF=60ma,VF=1.2ma.so R1=3.3-0.7-1.2=1.4V,R=1.4/20ma=70ohm, i think for relay coil R1=100Ohm is good option. \$\endgroup\$ – Danesh_sa Nov 16 '19 at 7:09
1
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Instead of D3, a diode anti-parallel to the opto's LED can be useful for protecting against reverse bias (which some LEDs are not tolerant of). \$\endgroup\$ – The Photon Nov 15 '19 at 21:46
  • \$\begingroup\$ @ThePhoton Yeah, that would be a better solution because the combined voltage drop across D3 and the opto LED could take up so much voltage drop that there's practically none remaining of the 3.3V to drop across the resistor for proper current regulation. \$\endgroup\$ – DKNguyen Nov 15 '19 at 21:49
  • \$\begingroup\$ @DKNguyen,Thank you for your complete answer.I have OR circuit in optocoupler input ,so i have two 1n4148 in paralel (another signal will control the relay sometimes),i change R1 to 100 ohm ,(F=60ma,VF=1.2ma.so R1=3.3-0.7-1.2=1.4V,R=1.4/20ma=70ohm, i think for relay coil R1=100Ohm is good).the problem i had when i add R3 pulldown resistor because of the floating voltage on Q2 base,and i think in future maybe i could be problem therefor i pull the Q2 base down ,when the opto is off ,the Q2 is off 100%.Relay coil is 24V ,does it need a current limiting resistor? \$\endgroup\$ – Danesh_sa Nov 16 '19 at 7:26
  • \$\begingroup\$ @Danesh_sa If the relay coil is rated for 24V you don't need a current limiting resistor. Relay coils require a certain amount of current through them to operate, and the resistance is tuned so that the required current flows through at the rated voltage. If the supply voltage is higher than the rated voltage, then you add a series resistor so that the rated voltage, and thus rated current, appears across and flows through, and the excess voltage appears across the resistor. \$\endgroup\$ – DKNguyen Nov 16 '19 at 7:52
  • 1
    \$\begingroup\$ @Danesh_sa R3 is an unnecessary pull up so 10K is fine if you want to keep it in. Just keep it large. You size R1 the same way you size current limiting resistors for LEDs (you can look this up in lots of places including other answers on Stack Exchange, except in your case you have two diodes so use their combined total voltage drop. You don't care about the current in F3 so use the desired current for the opto LED. Your R2 calculations is fine. \$\endgroup\$ – DKNguyen Nov 16 '19 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.