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:
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:
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.
I feel like I'm getting this wrong.