Wasteful Optocoupler Isolation

I was hoping to get some advice on a better approach to the solution I have come up with. For a project I'm working on, I will have a 28V digital signal which I want to isolate and read with an Arduino digital input.

I was planning on using a common optocoupler like a 4N25 and I wanted a minimum input current of 10mA. So some basic calculations lead me to an R value of 2.2k. The trouble with using this is it means about 300mW dissipated by the resistor. A half watt resistor deals with this fine on the bench but it does get warm and seems unnecessarily wasteful.

I know an easier solution would be to use a resistor divider but I want them fully isolated and don’t really want to use a mechanical relay. So does anyone have a smarter solution?

PS I cannot change the 28V input signal voltage.

Use a Opto with higher CTR, therefore you need less led current.

But, experiment with lowering the led current to see the results with the Arduino.

How is the transistor output wired?
You do not need much collector current for this circuit.

.

does anyone have a smarter solution?

Nope. Classic "voltage regulator" problem. To go from 28V to the ~1.2V @ 10mA for the IR LED in the optocoupler requires throwing away a bunch of power, and a 1/2 W resistor is pretty clearly the easiest and cheapest solution.

Thousands of optocouplers to choose from. Some give specifications with IF only 0.5mA, some have CTR greater than 1000%.

Why not use one with CTR of at least 100% and only use 1 mA through the IRLED. Then connect the transistor output to an Arduino input configured using INPUT_PULLUP.

LarryD:
Use a Opto with higher CTR, therefore you need less led current.

But, experiment with lowering the led current to see the results with the Arduino.

How is the transistor output wired?
You do not need much collector current for this circuit.

I did think a better opto would be the simple answer but tried sticking with the 4N25 since it's the most easy to obtain. Might have to just suck it up in the end though.

I've attached a quick drawing of how it's wired but it's pretty much the most basic arrangement you could use.

What would be the minimum practical collector current you'd suggest?

Try my suggestion with the 4N25. No resistor needed on the transistor side.

Value of R2 ?

R2 can be large, therefore LED current can be reduced.

Experiment, try R2 100K then increase the value of R1.

Make sure transistor saturates.
.

@dlloyd Thank you, of course it makes so much sense that the resistor is unnecessary with the internal pull-up enabled.

@LarryD I think R2 was going to be about 2.2k as well but I'll play around with increasing it (as well as dlloy'd solution).

Maybe this is an optocoupler 101 question but how do I ensure the transistor will be saturated? I know how to experimentally test whether it currently is but I don't know how to ensure it will always be based on datasheet info...

With optocouplers and switching low level signals, I don't worry about saturation. I look at the minimum Current Transfer Ratio (CTR). For the 4N25 its 20%.

Calcultations for your example:

Starting on the transistor side, if you're using INPUT_PULLUP for the resistive load, then with VCC=5V, RL=35K (from ATmega328P datasheet chart). The load current here is 5/35K = 0.143mA

Therefore, on the IRLED side of the optocoupler, you would need (1/20%)0.143 = 50.143 = 0.715mA minimum. Therefore R1 max = (28-1.2)/0.000715 = 37.5K. Power dissipation = 0.0007150.00071537500 = 19mW.

Going with a lower value for R1 (10K), the current IF is (28-1.2)/10000 = 2.7mA The power dissipation is 72mW.

Really, just a 10K resistor and the 4N25 is all you need. The maximum resistor value for R1 is 37.5K

What's the maximum switching frequency of the input signal?

Dloyd +1

You might try a bunch of 1N914's instead of a resistor. Trade cost for about 10 diodes for current.

You guys are awesome. Karma for all. Thanks especially dlloyd for going into so much detail.

I would measure the collector voltage when the LED current is flowing to make sure the transistor is saturated i.e. you should get ~.7 Volts.
If not, increase the LED current.

.

LarryD:
I would measure the collector voltage when the LED current is flowing to make sure the transistor is saturated i.e. you should get ~.7 Volts.
If not, increase the LED current.

.

Yeah see that's the bit I'm still a little unsure about. I can measure it on the bench under ideal conditions but how will I be certain that it will be saturated under all temperature conditions and after being switched on and off a few times a day for the next year or two?

dlloyd has suggested it won't be an issue so who do I believe? :stuck_out_tongue:

with VCC=5V, RL=35K (from ATmega328P datasheet chart). The load current here is 5/35K = 0.143mA

Therefore, on the IRLED side of the optocoupler, you would need (1/20%)0.143 = 50.143 = 0.715mA minimum. Therefore R1 max = (28-1.2)/0.000715 = 37.5K. Power dissipation = 0.0007150.00071537500 = 19mW.

OK, how do you figure that that's an appropriate value? Doesn't that make the optocoupler transistor have an equivalent resistance of 35k as well, giving you a 2:1 voltage divider with Vcc/2 ending up at the input pin? Vcc/2 is a value you DON'T want at a digital input!

To get a nice solid "0" at the pin, you want the transistor equivalent resistance to be much less than the pullup resistance (not necessarily "saturation", but ... headed that way. (does saturation even happen in an optocoupler?) The 10k resistor sounds like an OK suggestion, but I'd be more comfortable with a somewhat lower value, especially give the rather "loose" specification of the pullup value. Or - time for some measurements?

You need < ~1.5v to guarrentee the Arduino will detect the low state.
This can easily be proven by presenting 28v to the LED input resistor.
With a DVM, measure the collector to emitter voltage.
If this is less than ~1.5v you are OK.
If it is more, you cannot be sure if your input will see this as a low.
As mentioned, if you get ~.7v you will be fine.

If you get >1.5v decease the LED resistor to increase the LED current, then remeasure again.

.

westfw:
OK, how do you figure that that's an appropriate value? Doesn't that make the optocoupler transistor have an equivalent resistance of 35k as well, giving you a 2:1 voltage divider with Vcc/2 ending up at the input pin? Vcc/2 is a value you DON'T want at a digital input!

To get a nice solid "0" at the pin, you want the transistor equivalent resistance to be much less than the pullup resistance (not necessarily "saturation", but ... headed that way. (does saturation even happen in an optocoupler?) The 10k resistor sounds like an OK suggestion, but I'd be more comfortable with a somewhat lower value, especially give the rather "loose" specification of the pullup value. Or - time for some measurements?

Hmm ... the datasheets from Lite-On, Fairchild/ON Semiconductor, Vishay, Broadcom, Toshiba, Sharp, Everlight all guarantee 20% minimum CTR. This graph looks promising considering IF=2.7mA, therefore the transistor will try to sink 0.54mA, but the internal pullup resistor will only provide 0.14mA. I would say the voltage swing would be 0.4V to 5V, even if a 33K resistor is used ... which would prove there's more than ample allowance for aging, etc.