Optocoupler switching and isolation

Thread Starter

andrew74

Joined Jul 25, 2022
204
Hi!

I want to switch on/off by isolating input from output using a photocoupler (for example SFH6106) and I saw a circuit of this type in its datasheet:

1763670787042.png

Look the image below.

1) Is the first circuit correct? ..and is it therefore correct to indicate two different masses?
(..maybe adding a 10nF decoupling capacitor at the input is a good idea)

2) I drew the second circuit because I vaguely remember seeing online optocouplers in the past that closed in input with a diode (or resistor), as I drew in the second schematic.
I don't see the point of it, but maybe I'm missing something.
Is there any reason?

switch.jpg

Thanks
 

crutschow

Joined Mar 14, 2008
38,316
Is the first circuit correct?
No, as it will blow the input LED diode, since there's nothing to limit the current from the 5V supply.

It needs a resistor in series with the signal, as shown in the data sheet schematic.
The resistor value is selected to deliver the desired input LED current for the circuit output current and input voltage, as specified in the data sheet for the saturated switching current.
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
No, as it will blow the input LED diode, since there's nothing to limit the current from the 5V supply.

It needs a resistor in series with the signal, as shown in the data sheet schematic.
The resistor value is selected to deliver the desired input LED current for the circuit output current and input voltage, as specified in the data sheet for the saturated switching current.
Thank you, you're absolutely right, I hadn't thought of that.

So is it possible that in the second diagram the diode acts as a resistor? ...since it is directly polarised by the 5V.
 

ci139

Joined Jul 11, 2016
1,949
i don't know for iR LED values but some RED LED-s will give out faint barely detectable glow ??? at 270μA 1.7V 459μW
it depends on the LED-s "chemistry" but lets assume the iR is closer to RED than to others it likely drops 1.4V → 328μA assuming same power (it however might be the "same current" near-equivalence) . . . however -- with 5V drive at input side it limits your series resistor to (5–1.4)·1V/0.328mA=10.98kΩ --not-- to several MΩ-s . . .
. . . and perhaps even much lower resistance in order to be able to distinguish in between the ultra-weak input drive & the thermally induced dark current at the RX side phototransistor.
 
Last edited:

Irving

Joined Jan 30, 2016
4,995
In the 2nd circuit you have the same issue, when IN is low (0v) there's nothing limiting the current through both diodes (they aren't back to back). In both cases the 1 - 2Mohm resistor does nothing useful. The optocoupler LED in the SFH6106 is spec'd at 1 to 10mA with a transfer ratio from 30 - 200% depending on configuration. Using 10mA current through the diode, and a transfer ratio of 20% giving 2mA current through the transistor, gives the resistor values shown for 5v logic levels in and 3.3v logic out. Note also the logic is inverted - logic 1 in gives logic 0 out and vice versa.

1763723241862.png
 
Last edited:

crutschow

Joined Mar 14, 2008
38,316
So is it possible that in the second diagram the diode acts as a resistor?
No.
Diodes are used as resistors (although there forward drop does have a small resistive component).
The second circuit has a similar problem, as there's nothing to limit the current through the two diodes when the input is low (0V).
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
In the 2nd circuit you have the same issue, when IN is low (0v) there's nothing limiting the current through both diodes (they aren't back to back). In both cases the 1 - 2Mohm resistor does nothing useful. The optocoupler LED in the SFH6106 is spec'd at 1 to 10mA with a transfer ratio from 30 - 200% depending on configuration. Using 5mA current through the diode, and a transfer ratio of 40% giving 2mA current through the transistor, gives the resistor values shown for 5v logic levels in and 3.3v logic out. Note also the logic is inverted - logic 1 in gives logic 0 out and vice versa.

View attachment 359199
Thank you for your reply.

Please let me know if I have understood the calculation for Rin and Rout correctly:
INPUT: 5V - Vdiode (1.2V) / 10mA = 390 ohm
OUTPUT: 3.3V / 2mA = 1,65k ohm ..did I accidentally forget to subtract the Vce(?)
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
i don't know for iR LED values but some RED LED-s will give out faint barely detectable glow ??? at 270μA 1.7V 459μW
it depends on the LED-s "chemistry" but lets assume the iR is closer to RED than to others it likely drops 1.4V → 328μA assuming same power (it however might be the "same current" near-equivalence) . . . however -- with 5V drive at input side it limits your series resistor to (5–1.4)·1V/0.328mA=10.98kΩ --not-- to several MΩ-s . . .
. . . and perhaps even much lower resistance in order to be able to distinguish in between the ultra-weak input drive & the thermally induced dark current at the RX side phototransistor.
In the 2nd circuit you have the same issue, when IN is low (0v) there's nothing limiting the current through both diodes (they aren't back to back). In both cases the 1 - 2Mohm resistor does nothing useful. The optocoupler LED in the SFH6106 is spec'd at 1 to 10mA with a transfer ratio from 30 - 200% depending on configuration. Using 5mA current through the diode, and a transfer ratio of 40% giving 2mA current through the transistor, gives the resistor values shown for 5v logic levels in and 3.3v logic out. Note also the logic is inverted - logic 1 in gives logic 0 out and vice versa.

View attachment 359199
Sorry for the confusion, but I don't understand why in one comment the input resistance on the left is 10k while in the other it is 390... these values seem a bit too different to me
 

Irving

Joined Jan 30, 2016
4,995
Sorry for the confusion, but I don't understand why in one comment the input resistance on the left is 10k while in the other it is 390... these values seem a bit too different to me
Not sure I understand his comment either...

Thank you for your reply.

Please let me know if I have understood the calculation for Rin and Rout correctly:
INPUT: 5V - Vdiode (1.2V) / 10mA = 390 ohm
OUTPUT: 3.3V / 2mA = 1,65k ohm ..did I accidentally forget to subtract the Vce(?)
You're welcome...

Yes, (5 - 1.25)/10mA = 375, use 390 as nearest -> 9.6mA @ 20% CTR = 2mA so (3.3-0.4)/0.002 = 1.45k, use 1.5k

NB I'd actually used 5mA and 40% originally which gives same output resistor, but a higher input resistor of 750ohm, then decided 5mA was confusing since in I'd mentioned spec at 10mA, so re-did calcs at 10ma and 20% CTR, now corrected in text!

I would normally use 5mA and a higher spec opto with a higher CTR if there were several ports on an MCU being isolated to avoid stressing the chip too much
 

crutschow

Joined Mar 14, 2008
38,316
why in one comment the input resistance on the left is 10k while in the other it is 390
10K is typically too high for sufficient input LED current to operate the opto.
You select the resistor value to give the desired current as determined by the control input voltage and the voltage drop of the LED.
Thus for a nominal LED voltage of about 1.1V at typical operating currents, the current with a 5V source and 390Ω series resistance would be (5-1.1) / 390 = 10mA.
 

crutschow

Joined Mar 14, 2008
38,316
Below is the LTspice sim of Irving's Post #5 circuit:
It shows the 10mA LED input current (red trace).

The circuit is not necessarily optimized for the opto you are using or your operating signal requirements.

1763750271948.png
 
Top