Optocoupler Characteristics

1. In my application I need to isolate a PWM signal @ 1 kHz, which is generated from a Beaglebone Black microcontroller. In my signal, I want to have one hundred different steps in duty cycle (from 1% to 100% duty cycles). From what I understand, my opto-coupler should be fast enough, so that it can transmit the narrowest pulse (1% duty cycle), which has a duration of 1% * (1/1000) = 10 μs. Consequently, I need to have: tr + tf < 10 μs, where tr and tf are rise and fall times of the opto-coupler. Is the above logic correct? If so, I need some help in understanding how the above calculations can be translated to bits per second, because everyone filters the opto-couplers according to their data rate (bps).

2. Another question is about the input current of the opto-coupler. My microcontroller can only provide around 4 - 6 mA through its PWM ports. I need some help understanding the datasheets of the opto-couplers. So, for example, this datasheet is from the 6N138M opto-coupler. One can see under the "features" section: "Low Current - 0.5 mA".

This seems okay for my μC. But under absolute maximum ratings, it says that If can reach 20 mA. How do I know in this case how much current should be fed to the opto-coupler, in order to work as intended?

• You don't want 20mA. You need If=12mA only from 5V but low side drive from Vol (3.3 to 0)) ( If is more stable) and 12mA output with CTR=100% using 120 Ohm to 3.3V or 270 to 5V with a comparator to drive FET. for your load. – Sunnyskyguy EE75 Mar 9 at 3:09
• is this a DIY one off project or a volume product design – Sunnyskyguy EE75 Mar 9 at 8:56
• After reading your answers (which have been really helpful), I've noticed many ask about the application.The PWM signal will be used for controlling a power mosfet switch. I am planning to use the STP55NF06L, plus a mosfet driver, like the ICL7667. From my understanding, the mosfet driver needs a tiny amount of current in its input signal, so I should not be much concerned about the output current of the optocoupler. – NickG Mar 9 at 23:35
• Beware that FET Ciss * RdsOn is somewhat constant for each technology. and that may impact your results so CB drive may be necessary. e.g. 1nF *270 Ohms =T= – Sunnyskyguy EE75 Mar 9 at 23:40
• One further question: In many opto-couplers' datasheets, I noticed that there is a resistor (usually named RL) placed between the Vcc and the Vout, on the output side of the IC. Such schematics can be found under the "Test Circuits" section. What is this resistors purpose? Furthermore, in these "Test Circuits", one can see several capacitors. Could someone explain the exact functionality of each one of those? – NickG Mar 11 at 21:26

how the above calculations can be translated to bits per second, because everyone filters the optocouplers according to their Data rate (bps).

A 10 us pulse would be equivalent to a 100 kbps digital data rate.

Another question is about the input current of the optocoupler. My microcontroller can only provide around 4-6mAmps through its PWM ports.

You want to look for the "current transfer ratio" or CTR. This tells you the ratio between the output current and the input current. If you put 5 mA in and the CTR is 100%, you'll get 5 mA out on the other side of the optocoupler. Whether this is enough depends on the input impedance of the load, among other things.

For many "jelly bean" optocouplers, the CTR is less than 100%.

So, for expample, this datasheet is from the 6N138M optocoupler. One can see under the "features" section: "Low Current-0.5mA".

This part claims a CTR of 2000% (due to buffering transistors on the output). So if you put 5 mA in to the LED side, you can conceivably get 100 mA out of the receiver side.

YOu wouldn't want to do this, because the absolute maximum output current rating is 60 mA. You should design your output circuit to limit the output current to substantially below 60 mA for best reliability.

Again whether that is enough depends on what load you are driving.

You should also note that the 2000% CTR specification is only a "typical" spec, and individual samples of this optocoupler could have substantially lower CTR.

(Hat tip to @JackCreasey for pointing out a couple of the issues discussed here)

But under absolute maximum ratings, it says that If can reach 20mA.

Absolute maximum ratings tell you how to avoid damaging the part. They don't tell you how you're expected to use the part normally.

From what I understand, my optocoupler should be fast enough, so that it can transmit the narrowest pulse (1% duty cycle), which has a duration of 1%*(1/1000) = 10μseconds. Consequently, I need to have: tr+tf < 10μsec,

Notice your 6N138 has typical propagation delays of 1 us (and maximum of 15 us) for low drive currents, so this part is probably not appropriate for your timing requirements.

• The 6N138 CANNOT EVER deliver 100mA output current. The average absolute maximum is specified as 60mAhttps://www.onsemi.com/pub/Collateral/HCPL2731M-D.pdf ...and since the application is for a PWM signal that could reach 100% this means that 60mA is the absolute maximum. Any decent design should also not use a CTR% ratio greater than 300% since you could end up with devices with only this CTR%. – Jack Creasey Mar 8 at 23:01
• -1 for also (like @JackCreasey ) quoting the worst case example of 15us with 1.2mA load when 2us is the worst case for a 12mA load. for the 6N139M at a huge cost (ha) of 0.31 and with If=12mA could be reduced to 10 and only needs a CTR here 100% – Sunnyskyguy EE75 Mar 9 at 3:02
• @JackCreasey, thanks for catching those points. Edited. – The Photon Mar 9 at 16:31
• @SunnyskyguyEE75, OP hasn't given us enough information to know whether the load will be closer to 1.2 mA or closer to 12 mA. – The Photon Mar 9 at 16:32
• @ThePhoton Yes the OP has been silent about many choices. But if you need to use this part for this purpose. It is possible to choose the I/O current levels and I/O configuration and Jack and yourself have why it can't used with assumptions. WHere I have shown one example of why it can be used by reducing the impedance, to make it work. The Miller effects can be used by reducing current gain and there are ways to reduce the current gain.with the base lead.to reduce the tPLH tPHL skew. His link showed nothing new.or about the prop delay skew which may be reduced further with CB and cascode – Sunnyskyguy EE75 Mar 9 at 17:21

Your input current should be designed considering:

1- A comfortable value that your source (in this case, the Beaglebone) can sustain. In this case, I would choose 1mA.

2- Looking the graphics of how your optocopler works.

3- Look for the current transfer ratio of your part.

In your case, you probably want to work the opto output always saturated (open or closed). So you should look "current transfer ratio". This will basically tell you how much current your output transistor will make available depending on your input current (forward current).

If you do your math, you will notice the current you calculated will be really high, but that's the "maximum value" you should get from the exit. In practice, the output transistor will just saturate and the current will be determined by your circuit. For example, if you connect the collector to 5V and your emitter to a 10k resistor to GND the maximum current available should be (5V - Vce) / 10k.

Just an observation, if you just want to drive some local circuit logic you can just use an NPN transistor. You didn't give any details about the application, but I don't see the any circuit requiring isolation from a common Beaglebone.

When transmitting digital signals, one step (where the voltage is low or high) is one bit. So the 10 µs is the length of one bit, which corresponds to 100 kbit/s.

The absolute maximum ratings tell you the limits beyond which the chip might let the magic smoke escape. This is not something you should use, but stay away from.

The LED current you should use is current the chip is designed for, which is the current for which the current transfer ratio is specified. In the case of the 6N138, this is 1.6 mA (0.5 mA is for the 6N139). With a guaranteed CTR of at least 300%, this means that you can switch 4.8 mA at the output. To be safe, use the suggested 2.2 kΩ load resistor to get a current of about 2.3 mA.

The 6N138 is rather slow for 100 kbps. You can speed it up with a Schottky diode, but it would be a better idea to use a faster optocoupler like the H11L1 (and with a digital optocoupler, you do not need to worry about the CTR).

1kHz PWM ...my opto-coupler should be fast enough, so that it can transmit the narrowest pulse (1% duty cycle), which has a duration of 1% * (1/1000) = 10 μs. Consequently, I need to have: tr + tf < 10 μs

Correct, but I would suggest you need delay times (not rise and fall times) much much less than 10us. You need to decide what fidelity you need for the output waveform. If you use the 6N138 then the delay times combined could be 65us worst case. At this you would get no viable PWM signal below about 6%. Even using the 'Typical' number, you could expect delay times to be 8.3us so severely distorting small PWM values.
This has nothing to do with the rise and fall times of the output, which are related to the load (Rl) and the capacitance of the load.

The datasheet shows:

From the above data I would suggest that the 6N138 would NOT be suitable for your application.

While there are many opto-isolators that might (when you decide how much distortion and edge delay you can tolerate) fill the bill, I'll suggest what might be a high end solution for you as an example.
The On Semiconductor FOD8071 has very low delay values and a true digital output signal (not open-collector). This device is based on a photodiode receiver, which is invariably much faster than any transistor based coupler. The spec snapshot is:

This type of device ensures that the accuracy of your input signal PWM signal is reflected in the output.

The input threshold current is about 3.5mA for this device, so selecting an input current range of 5-10mA should be good place to start. Your MCU output should be able to sink 10mA and with the Vf of the LED being in the 1-1.8V range then at a 3.3V MCU supply a 230 Ohm resistor would be adequate to define the input LED current. Over the full Vf range this would ensure 6.5-10mA LED current.

You should research opto-isolators in the 1Mbps and above range to get reasonable PWM distortion values. With 1Mbps capability you would expect delay times in the 200-600ns range which may be adequate for your purposes. Perhaps start with a search like this on Digikey.

Update: Understanding the turn on and turn off delays (you can call them rise time and fall times if you like, but they appear as edge delays in the circuit).
This application note on the very problem being discussed is relevant and performed at 1kHz square wave (equivalent to a PWM 50% signal).

They used a very common opto-isolator (PS2501-1) and characterized the turn on and turn off delays as rise and fall times. I disagree with that terminology, but the note aptly shows the delay in producing an edge assuming voltage sensitive logic on the output load. The datasheet for the opto quotes tr/tf at 3us and 5us respectively, but the app note shows the measured values at about 5us and 90us for tr/tf depending on output configuration.

They then attempt to speed up the circuitry adding a more complex output configuration (cascode), but even then only achieve 6us and 32us for tr/tf in their note.

This shows that this type of opto (transistor based) is unsuitable where you want to assure that the output signal accurately follows the input signal. Using an opto based on a photo-diode is invariably much faster, has almost symmetrical delays and is not dependent of high CTR.

This application note by Vishay gives a much more complete comparison of the performance of the various configurations. It also suggests to achieve highest speeds a photo-diode (CB junction) configuration use of the transistor based optos. Well worth reading.

• -1 for circling 2.2k load when 120 Ohms is optimal from 3.3 V into a slicer – Sunnyskyguy EE75 Mar 9 at 2:55
• ALso Prop delay is irrelevant. It could be 1 second or to the moon and back as long as the rise time allows 10us ON pulse time – Sunnyskyguy EE75 Mar 9 at 2:56
• @SunnyskyguyEE75 Thanks for the downvote. I did not circle the 2.2k Ohm load, so don't know hat you are alluding to. the 2.2k is the output pullup resistor, and the If is the LED current. They don't specify the resistor value for a 3.3V MCU and neither did I. However, increasing the LED current with the 6N138 INCREASES the delay times so making the problems with that part worse. But I'm guessing you can't see that either. Propagation delay is the most important characteristic for this part since it's highly asymmetrical and will result in severe pulse lengthening. – Jack Creasey Mar 9 at 6:08
• well you did mention "8.3us so severely distorting small PWM values." when the typ values for 270 Ohms which is what you should have been looking at are 0.2&1.3us for On and OFF, That's because going to off current is high impedance. An even smarter way is to use 12 mA On and 0.5mA off for $I_f$ then it never goes OFF ( continuous conduction mode) and reduces the Prop delay even more. CML (current mode logic) works >10x faster that switched CMOS. There are all sorts of tricks like CB drive and output base bias to speed up optos for cost sensitive designs. One can even get 10Mb/s optos – Sunnyskyguy EE75 Mar 9 at 8:51
• @SunnyskyguyEE75 You said "An even smarter way is to use 12 mA On and 0.5mA off for If then it never goes OFF ( continuous conduction mode) and reduces the Prop delay even more. CML (current mode logic) works >10x faster that switched CMOS" ….now you are just being ridiculous. The problem with opto-transistors is the time taken to clear the carriers from the junction. It might help you to read an appnote like this: cel.com/pdf/appnotes/an3009.pdf – Jack Creasey Mar 9 at 15:56

how the above calculations can be translated to bits per second, because everyone filters the optocouplers according to their Data rate (bps).

A 10 us pulse would be equivalent to a 100 kbps digital data rate. NRZ...01010 is 50 kHz or 20us

Since Tr=0.35/f-3dB = rise time 10~90% using 10101 = f/2 at bit rate = f **
for 10101 pattern cycle of 20us at 100kbps **NRZ max Tr= 7us
but lower is better for InterSymbol Interference ISI ( from group delay) so you get lower BER with more phase margin from reduced ISI. (eye pattern)

Another question is about the input current of the optocoupler. My microcontroller can only provide around 4-6 mA through its PWM ports.

No, that is only true for logic noise margin. Here the Logic margin is your OptoIsolator output. The port is spec'd as VOL Low-level output voltage, driver enabled, pullup or pulldown disabled IOL = 6 mA 0.45 V This means Zol= 0.45/6mA = 75 Ohm RdsOn , same for VOH. REF p90

N.B> Note that Cortex driver specs are worst case (+50%) and CMOS RdsOn at rate supply is usually 50 Ω +/-50% . ALV logic is 1/2 of Ω this. Short circuit power in driver is then 145 mW so you can include this Rs with your IR current limit calculations for series R. and use near IR max If current e.g. 12mA

I agree with @Photon, You want to look for the "current transfer ratio" or CTR and rise time. Worst case CTR can be 25% which is like Beta (hFE) in a transistor.

The only tradeoff is the speed or TPLH with a Darlington , which makes this design marginal.

So, for example, this datasheet is from the 6N138M optocoupler. One can see under the "features" section: "Low Current-0.5mA".

A single transistor when saturated has about 10~20% hFE same with a Darlington which has hFE² or a saturated gain of 10²=100

The datasheet WORST case propagation delay time is TPLH= 7us max 0~70'C and 1.3us typ at 25'C with the following conditions;
RL=270 Ω If=12mA with 270 Ω to 5V - (Vol(sat)=1.2V est.) yield Ic= 3.8V/270=14mA .

To get If=12mA from 3.3V 75 Ω Beagleboard CMOS driver is unstable/ unreliable due to Rdson and If resistance tolerances as temp changes VF which increases IR temp and exceeds MAX so a 5V current limit is better. Fig 4 in datasheet shows Vf ranges from 1.5V to 1.8V so ΔV=Vdd-Vf=1.8 to 1.5V so using 1.8V/12mA = 46Ω which is less than the Driver Rs 75 Ohms max(25 min) which also has a 25% tolerance. Using 1.5V/12mA=125Ω, Since the driver is 33 to 75 Ohms 126-70=56 Ohms

But under absolute maximum ratings, it says that If can reach 20mA.

There is also Fig 5 Vf vs Ta which says if you run at 1.5V the self-heating requires your ambient to be -40'C for cooling.

From what I understand, my optocoupler should be fast enough, so that it can transmit the narrowest pulse (1% duty cycle), which has a duration of 1%*(1/1000) = 10μseconds. Consequently, I need to have: tr+tf < 10μsec,

Yes, the rise time may meet the 7uS max requirement and I expect rise time to be less than propagation delay which is the only spec given. So rise time depends on bandwidth and prop delay.

Conclusion

If you have 5V you must use this with driver Sch. Diode protection to regulate Vf so the temperature of IR diode has less effect on the If stability. Note: Duty Cycle affects avg current and temp also.

• 68.2k22398 You cannot use a simple conversion to bps for a PWM application. It's also not valid to talk about ISI or NRZ since this is not describing a PWM protocol. The OP has specified that the PWM is from 1%-100% so the rise and fall times impact the accuracy of the PWM signal. The OP needs to decide what distortion is allowable in the application and from that decide the minimum rise and fall times that can be tolerated. I would suggest that you will need 1Mbaud or beyond to achieve less than 5% distortion. – Jack Creasey Mar 8 at 23:19
• @JackCreasey WHat's the difference between 100kbps with a single 1 and 99 Zero's and a 1kHz PWM at 1% duty cycle? BTW I have designed a 4Mb/s modem using VITS line 22 that could stay sync with only 1 NRZ transition in 1000 bits. SO I do know what I am talking about, although your suggestion is also valid – Sunnyskyguy EE75 Mar 9 at 2:44
• No, you don't know what you are talking about. A PWM signal has a fixed frame rate so will never appear like an NRZ signal. The application is absolutely nothing like a modem. – Jack Creasey Mar 9 at 4:29
• THat's true but does not contradict what I said. nor support your doubt. The resolution BW is simply 0.35/rise time , sorry I disagree with your unsupported claim of irrelevance. It is very relevant and I proved it. I've done this before @JackCreasey BTW it's not a modem, just a pulse and 99% is worst case and ISI correlates with PW50 distortion !!! but if that's not good enuf for you, my 2nd answer ought to be. No explanation is necessary if you are an expert – Sunnyskyguy EE75 Mar 9 at 5:29

But uses a Common Base transistor. OptoDarlington is simulated with 1mA of 8% CTR to base with a fixed R.