Optocoupler for 3-30v input

Hya peeps,

Can anyone recommend an opto coupler I could use to take a 3-30v input signal?

I´ve been searching online and found a few, eg.. https://docs.rs-online.com/566f/0900766b8009c194.pdf
And I´ve read a bunch of posts and information, but I just cannot be sure any optocoupler I look at can handle upto 30v. I´m getting myself confused!

I´m concidering using a voltage divider before the opto coupler, but I´m sure theres an easier way.

Does anyone have any tips?

TIA

I would have replaced the 1k resistor with a constant current circuit.

Take the maximum current rating of the optocoupler LED, say 20 mA (though I know many are rated higher).

OK, ignoring the voltage drop of the LED, you have 30 V resulting in 20 mA, that relates to a resistance of 1k5. What power will it dissipate? 0.6 Watts, so you need a 1 W resistor. That is for where your 1k above is. 1k5 at 1W.

OK, at 3 V what will happen? Well, the voltage drop of the opto LED is about 1.2 V, perhaps 1.5 so we now have 1.5 V remaining over 1k5, 1 mA.

Let's look at the output side. You don't want to connect the opto to VCC, just connect it from the Arduino pin to ground and use a pinMode of INPUT_PULLUP. The internal pullup is about 36k at 5 V (Figure 31-301 in the datasheet), and apparently much the same at 3.3 V, so to pull the input down to 0.5 V, the phototransistor will need to pass about 75 µA.

This will then require a minimum CTR (Current Transfer Ratio) of 7.5% for which practically any optocoupler will suffice, even the obsolete 4N25! I would however strongly advise using a more modern device such as the PC817.

3 Likes

thehardwareman:
I would have replaced the 1k resistor with a constant current circuit.

Why?

What is wrong with a simple resistor?

Paul__B:
What is wrong with a simple resistor?

Power dissipation?

I think Physics shows that the same power must
be dissipated one way or another.

Paul_B thanks loads your explanation really lit a light bulb... or led! Ha.
I understand this better now and I have something I can work with.

herbschwarz:
I think Physics shows that the same power must be dissipated one way or another.

We have another Physics here. For resistor power dissipation is V^2/R while for constant current source it is V.I. For the minimal supply voltage the dissipation is equal but with increasing voltage dissipation increases much more quickly with resistor.
(The reason is for CCS the current is fixed but increases for resistor.)

Paul__B:
Why?

What is wrong with a simple resistor?

The current flow through the led will be very high at 30V compared to 3 volt. I'm not sure what voltage the led require but if we assume 2 volt, the voltage over the resistor will be from 1 to 28 volt. At 1 volt the current flow will be 1 mA and 28 mA at 28V.

You must check the datasheet for the opto-coupler and see if 1 mA is sufficient and if 28 mA is too much. If the min/max (required) current through the led is within this range, then a resistor is OK. But if not, a constant current will solve this.

(and to complete what I did not manage to write before the forum went offline for a while). As other has already said - the power dissipation can be high on the resistor. So 1/4 W is not enough. 1 W or more is required.

thehardwareman:
I'm not sure what voltage the led require

Datasheets cited in #2. It's 1.4 ± 0.1 V

thehardwareman:
but if we assume 2 volt, the voltage over the resistor will be from 1 to 28 volt. At 1 volt the current flow will be 1 mA and 28 mA at 28V.

Cited in #2, 1 to 20 mA.

thehardwareman:
You must check the datasheet for the opto-coupler and see if 1 mA is sufficient and if 28 mA is too much.

There is no strict "sufficient" but 500 µA is cited. While not particularly linear, opto-couplers have a dynamic range of at least two or three orders of magnitude as per the datasheets cited in #2, I suspect much more given the dark current cited. You will note they are specified at a maximum of 50 mA.

thehardwareman:
If the min/max (required) current through the led is within this range,

It is specified from 500 µA to 50 mA, but not limited at the lower value.

thehardwareman:
then a resistor is OK. But if not, a constant current will solve this.

Nothing really to solve. A resistor is an awful lot simpler!

thehardwareman:
(and to complete what I did not manage to write before the forum went offline for a while)

It does that. However it specifically jacks up with references to "www.electroschematics.com" for some peculiar reason, which is from where that illustration comes and that is what actually prevented you from submitting your reply! :roll_eyes: :astonished:

It took me ages to figure out how to get past it. :grinning:

thehardwareman:
As other has already said - the power dissipation can be high on the resistor. So 1/4 W is not enough. 1 W or more is required.

As cited in #2. Not however a major problem, as long as the source can supply the 20 mA.


Edit in 2024: Actually, the constant current circuit is not such a bad idea insofar as it does limit the overall power dissipation.

Note that the transistor itself is dissipating virtually all of the power at 30 V. So if we arranged a constant current of 5 mA, the dissipation would be less than 150 mW at 30 V and most transistors (rated of course at least 50V collector voltage) could readily handle this.

Can anyone recommend an opto coupler I could use to take a 3-30v input signal?

Ahh, Gotta love optos ... here's some to choose from that should do the job. Let's choose the VO618A-4 ($0.77) and do some calculations.

On the transistor side of the opto, it only needs to switch 0.33mA to pull up the voltage on the Arduino pin to 3.3V

On the IRLED side, the voltage drop (Vf) is about 1.1V. To calculate the required resistor, lets set the minimum current so that its at least 1mA or higher. The CTR at 1mA is specified to be 160% to 320%, so for 1mA through the IRLED, the transistor can switch from 1.6 to 3.2mA. This is more than enough, as we only need to switch 0.33mA max.

Using 1mA and calculating for R, then R = (3-1.1)/0.001 = 1.9KΩ.
Lets use 2.2K for a standard resistor size (or 2 x 1K in series).

So, for 3V signal, the forward current through the IRLED is (3-1.1)/2200 = 0.9mA
So, for 30V signal, the forward current through the IRLED is (30-1.1)/2200 = 13.1mA

Power dissipation = (V*V)/R = 0.38W (use 1W resistor or higher), or 2 x 1/2W 1KΩ resistors in series.

2 Likes

Just wanna thank Paul_B again! Just got the final puzzle solved on this project!

1 Like