Opto-Coupler Resistor Value


Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 08:42am 10 May 2022      

What is really required?

I am only driving a Pico's input from an external 24v. CTR is not an issue so I guess that the DS-stated LED If of 10mA is unimportant, correct? Really want to keep the resistor's power-rating to the minimum.  


Craig

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 9125
Posted: 08:49am 10 May 2022      

You usually only need a couple of mA through the LED to get good enough current transfer. With a 24v input, that's 22.2v / .002 = 11.1k. Try 10k as the series resistor. It'll dissipate about 0.05W.

The exact output current depends on the LED current, but it hardly matters here.

Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 763
Posted: 08:58am 10 May 2022      

The resistor value is calculated like for any other LED; R= (Vin - ledVf) / Iled


Example: R= (24v-1,5v)/ 0,04A = 562 Ohm, for the Power rating of the resistor:

P= 0,04A^2*562 = 0,89W

Greetings
Daniel

Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 09:00am 10 May 2022      

Thanks Mick  

I was looking at 3.3K but I guess, with this format, I can easily test a variety:







Craig

phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3378
Posted: 12:44pm 10 May 2022      

The required LED current can be reduced by increasing the load resistance on the output side. Maximum speed may be reduced if you go too high. Experiment!

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 9125
Posted: 01:35pm 10 May 2022      

You can get the "gain" of the opto from the DS. It's the current transfer ratio - the ratio of the LED current to the output current. There will be a graph as it's usually non-linear. It doesn't start at zero as you need a minimum current through the LED for anything to happen. Better allow a bit more than minimum though as your "24v" might be 19v in reality. :(

Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6103
Posted: 05:14pm 10 May 2022      

@Tinine

If you have 10k from 24V to the LED, and 10k pullup or pulldown at the optocoupler output that will work for all normal optocouplers. Assuming 3.3V.

In specific cases you can tune these values (speed / noise immunity / analog behaviour).

But if speed is an issue, please don't spend too much time tuning. Solve it by using a digital optocoupler. These are far superior in speed to anything you can achieve with normal optocouplers.

Volhout

Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 05:04am 11 May 2022      

Many thanks, guys  

No speed concerns here. These are typical inputs from proximity-sensors and they all spend a chunk of time in software de-bounce.

I think I have another question but I'll start a new thread because I like to keep the topic in the main thread title.


Craig