Electronic – Reading an optocoupler datasheet and calculating the resistors for its input/output

opto-isolatorresistors

This is a continuation from this question (sort of)

I want to replace the relays from an existing circuit with optocouplers and had trouble how to read the optocoupler datasheets as well as understanding how they operate. I think I understand a little now, but still consider myself quite newbish in the topic.

I changed the optocoupler from the previous question, since I've found that it's probably easier to start with a more widespread component (4N25 or 4N27).

If I understand opto-couplers a bit better I might switch to a more fitting opto-coupler for my appliance.

So, to start, here is the schematic with relays:

schematic

simulate this circuit – Schematic created using CircuitLab

Since optocouplers consist of LEDs an input protection resistor is necessary. Also there's a voltage drop from the transistor on the output.

For the Input Module the schematic is almost identical, since the voltage drop of the transistor is neglect-able on the module side.
But for the Output Module I have trouble finding the right resistor so that the Passive (\$ I_{passive} = 10mA \$) / Active state (\$ I_{active} = 20-30mA \$) for the monitored output are still correct.

The output module has an internal resistor of 26K7 ohm and a MOSFET bypassing that resistor when active.

Here are my schematics with optocouplers:

schematic

simulate this circuit

I also don't really know how to calculate the resistor for the LED.

It seems to me like the output module can't be used with optocouplers, as the passive state is enough to activate the led / saturate the transistor.

Reading the datasheet, there's this figure, which tells me the 4N25 would become active from the passive state of the output module.

EDIT:

R2 on the output module is mandatory because it's a monitored output.

When the output is inactive, the internal 26K7 ohm resistors will limit the current to around 10mA (in series with 800 ohm).
This 10mA basically tells the circuit that there's no wire-break.

Now, when the output is active, the internal resistor gets bypassed. With the bypass all I have is the 800 ohms, which needs a parallel resistor to limit the current on the LED.

But that's where I fail, since I don't know how to size R3 properly.

enter image description here

I feel like I'm getting this wrong.

Best Answer

A few comments about your assumptions and notes: 1) Your note states that 10mA must flow for broken wire detection. But using ohm's law and the voltage and resistance values you provided: $$I=\frac{V}{R} \rightarrow \frac{27.5V}{26.7kΩ}=.001A\rightarrow 1mA$$ Knowing this much lower "passive" value, make this a bit easier to design with. So now what you need to do is differentiate between 1mA and 20mA. Your method is one way to do this, and you can complete it with a zener diode:

schematic

simulate this circuit – Schematic created using CircuitLab

R3 is then calculated as follows: $$\frac{(27.5V-10V-1.3V)}{20mA}=810Ω$$

So in summary, R2 will provide a path for the 1mA sense current while D2 blocks the opto from turning on. When the mosfet activates and presents the full 27V to the output, then the zener will break over and conduct while R3 limits the current to 20mA through the opto's LED.