Author Topic: Calculating resistor for optocoupler  (Read 15264 times)

0 Members and 1 Guest are viewing this topic.

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Calculating resistor for optocoupler
« on: April 07, 2020, 10:19:41 pm »
I'd like to use a TLP290-4 in my design.

https://media.digikey.com/pdf/Data%20Sheets/Toshiba%20PDFs/Half-Pitch%204-Ch%20Trans%20Photocouplers%20Ref.pdf

It is an opto-coupler that works with both AC and DC. The primary use will be 24VAC signals, but it would be great to have it work down to 5VDC. (Something like this https://www.robotshop.com/ca/en/elexol-8-channel-opto-i-o-board-3-24v-dc-ac.html, which has a schematic)

The output side of the opto is going in to a micro controller, so the current needs are next to nothing.

How can I determine the proper sized resistor to put on the input side of the opto?

Maximum current for the LED is 50mA - aim for 45mA at the high end.
24VAC = 34V RMS
R= V / I = 34 / 45 = 755 ohms

At this resistance, a 5VDC input would have around 4mA. I don't know where in the datasheet to know if this will be enough current to trigger the opto.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1583
  • Country: ua
Re: Calculating resistor for optocoupler
« Reply #1 on: April 07, 2020, 10:25:15 pm »
You have to work with CTR - current transfer ratio (minimal value, 50% here).
You have to know load current (output current). Divide it to CTR and the result is your needed input current.
For example, if output curŕent is 1 mA, CTR is 50% (0.5), then input current is 1 mA / 0.5 = 2 mA.
« Last Edit: April 07, 2020, 10:31:05 pm by Vovk_Z »
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 3570
  • Country: us
  • Not An Expert
Re: Calculating resistor for optocoupler
« Reply #2 on: April 07, 2020, 10:27:52 pm »
As was said, make sure you always have enough current to meet the minimum given the CTR at all operating voltages.  Pick a resistance value based on that.

Then size the resistor package(s) such that it can dissipate the worst case power at that resistance value.
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Calculating resistor for optocoupler
« Reply #3 on: April 07, 2020, 10:28:34 pm »
With a micro-controller, with such a high input impedance, wouldn't the current needs be minuscule?
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1583
  • Country: ua
Re: Calculating resistor for optocoupler
« Reply #4 on: April 07, 2020, 10:36:08 pm »
If microcontroller input impedance is very high (so current is in order of microamps-nanoamps) it is better to increase that current to the value which is at least an order larger then optocoupler dark current.
I mean just add some resistor in parallel to microcomtroller input.
For example, that TLP290 collector dark current is 0.1 uA max, then load current have to be at least 10 x 0.1 = 1 uA.
« Last Edit: April 07, 2020, 10:39:20 pm by Vovk_Z »
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Calculating resistor for optocoupler
« Reply #5 on: April 07, 2020, 10:59:34 pm »
So I guess something like this wouldn't work?


(ESP32 will be set to input pulldown, no need for external pulldown resistors)

MCU is an ESP32 - I can't seem to find input impedance anywhere (datasheets or brief googling)
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: sm
Re: Calculating resistor for optocoupler
« Reply #6 on: April 07, 2020, 11:12:15 pm »
With a micro-controller, with such a high input impedance, wouldn't the current needs be minuscule?
It depends on the speed of your signals. With lower currents the parasitic capacities need more time to be charged/discharged (thus the edges will be slow).

With slowish signals you may use, say 50k pullup at the mcu input (opto-collector wired to the mcu_input, emitter to GND), with 3.3V mcu_Vcc the Ic=67uA.

With CTR=50% min the led diode resistor's value Rf should be lower than

If = 67uA / 0.5 = 134uA

Rf = (Vinp_min - Vf) / If = (5V - 1.5V) / 134uA = 25k     (to be on the safe side I would go with 4k7)

Check:

5V input .... If = (5 - 1.5) / 4k7 = 0.75mA
34Vpeak ...  If = (34 - 1.5) / 4k7 = 7mA

PS: also mind the diode's reverse voltage max is 5V, thus you need an anti-parallel diode at the input.
« Last Edit: April 07, 2020, 11:41:03 pm by imo »
Readers discretion is advised..
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 21889
  • Country: gb
  • 0999
Re: Calculating resistor for optocoupler
« Reply #7 on: April 08, 2020, 11:30:42 am »
So I guess something like this wouldn't work?


(ESP32 will be set to input pulldown, no need for external pulldown resistors)

MCU is an ESP32 - I can't seem to find input impedance anywhere (datasheets or brief googling)
Just use an external pull-down resistor, that way you can be certain of the impedance.
With a micro-controller, with such a high input impedance, wouldn't the current needs be minuscule?
It depends on the speed of your signals. With lower currents the parasitic capacities need more time to be charged/discharged (thus the edges will be slow).

With slowish signals you may use, say 50k pullup at the mcu input (opto-collector wired to the mcu_input, emitter to GND), with 3.3V mcu_Vcc the Ic=67uA.

With CTR=50% min the led diode resistor's value Rf should be lower than

If = 67uA / 0.5 = 134uA

Rf = (Vinp_min - Vf) / If = (5V - 1.5V) / 134uA = 25k     (to be on the safe side I would go with 4k7)

Check:

5V input .... If = (5 - 1.5) / 4k7 = 0.75mA
34Vpeak ...  If = (34 - 1.5) / 4k7 = 7mA
That's reasonable, yes it's better to have slightly more, than too little current.

Quote
PS: also mind the diode's reverse voltage max is 5V, thus you need an anti-parallel diode at the input.
Not necessary, because the opto-coupler used by the OP is bidirectional.
https://www.mouser.com/datasheet/2/408/TLP290-4-1209274.pdf
 
The following users thanked this post: joeyjoejoe

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Calculating resistor for optocoupler
« Reply #8 on: April 08, 2020, 12:39:02 pm »
Awesome, thanks Zero!

I added the capacitor in hopes of eliminating noise. I wonder if I should increase R? to also raise the threshold for noise as well?

What's good is if the overall schematic is good, I can order the boards and then play with the resistance value after the fact.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 21889
  • Country: gb
  • 0999
Re: Calculating resistor for optocoupler
« Reply #9 on: April 08, 2020, 01:13:54 pm »
Awesome, thanks Zero!

I added the capacitor in hopes of eliminating noise. I wonder if I should increase R? to also raise the threshold for noise as well?

What's good is if the overall schematic is good, I can order the boards and then play with the resistance value after the fact.
You probably want to increase R? just to decrease the power dissipation a bit. P = V²/R = 24²/750 = 576/750 = 0.77W. Of course this doesn't take into account the small amount of power lost in the opto-coupler, but it's still a fairly chunky resistor and what if the voltage is higher than 24VAC? I think the 4k7 calculated by imo is a more sensible value.
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Calculating resistor for optocoupler
« Reply #10 on: April 08, 2020, 01:23:39 pm »
Okay thanks.

The signal speed is slow - it is HVAC signalling, so... a few seconds :)
 

Online wraper

  • Supporter
  • ****
  • Posts: 18884
  • Country: lv
Re: Calculating resistor for optocoupler
« Reply #11 on: April 08, 2020, 01:24:09 pm »
As was said, make sure you always have enough current to meet the minimum given the CTR at all operating voltages.  Pick a resistance value based on that.

Then size the resistor package(s) such that it can dissipate the worst case power at that resistance value.
Meet and exceed by 50% at least. Optocoupler CTR tend to degrade over time.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 3570
  • Country: us
  • Not An Expert
Re: Calculating resistor for optocoupler
« Reply #12 on: April 08, 2020, 08:10:25 pm »
As was said, make sure you always have enough current to meet the minimum given the CTR at all operating voltages.  Pick a resistance value based on that.

Then size the resistor package(s) such that it can dissipate the worst case power at that resistance value.
Meet and exceed by 50% at least. Optocoupler CTR tend to degrade over time.

+
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13858
Re: Calculating resistor for optocoupler
« Reply #13 on: April 08, 2020, 08:47:30 pm »
Yep.  A prudent engineer never drives an Optocoupler too close to its max If, and always derates the CTR by at least a factor of two to avoid problems as the LED output drops with age.  10000 hours rated life is under 14 months if its on 24/7!  You also need to figure out how much more margin you need if the tolerances of the resistor, LED Vf, driver ON state voltage drop, and supply voltage all stack up in the unfavourable  direction.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 21889
  • Country: gb
  • 0999
Re: Calculating resistor for optocoupler
« Reply #14 on: April 09, 2020, 09:16:42 am »
With such a wide input voltage range of 5V to 24VAC, it might even be worth using a constant current source, although it is extra complexity which you might want to avoid.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1334
  • Country: gb
    • bitdynamics
Re: Calculating resistor for optocoupler
« Reply #15 on: April 09, 2020, 09:53:06 am »
With such a wide input voltage range of 5V to 24VAC, it might even be worth using a constant current source, although it is extra complexity which you might want to avoid.

constant current diodes are reasonably affordable these days?  One component so not difficult to put into the circuit!
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 21889
  • Country: gb
  • 0999
Re: Calculating resistor for optocoupler
« Reply #16 on: April 09, 2020, 02:00:27 pm »
With such a wide input voltage range of 5V to 24VAC, it might even be worth using a constant current source, although it is extra complexity which you might want to avoid.

constant current diodes are reasonably affordable these days?  One component so not difficult to put into the circuit!
Just looking at Mouser, they're not cheap and it's AC, so a bridge rectifier would also be required.
https://www.mouser.co.uk/Semiconductors/Discrete-Semiconductors/Diodes-Rectifiers/Current-Regulator-Diodes/_/N-ax1ml?Ns=Pricing|0
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Calculating resistor for optocoupler
« Reply #17 on: April 09, 2020, 02:22:42 pm »
Yeah not cheap. I think with what is proposed here and a bit of testing I should hopefully be OK with an opto. Even with a 4k7 resistor, that should be plenty of current to trigger a MCU input?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf