Reading different design rules regarding optocouplers used as switch I have a question about the current limiting resistors R4 and R6
One aspect is the protection of the devices (e.g. ~200Ohm for a standard LED over a 3V voltage drop @ 15mA). How can I calculate the correct values?
For the 4N25 the forward voltage is 1.5V and my digital pin can produce up to 20mA => $$R_4 = (5V-1.5V)/20mA \approx 175\Omega $$ where for the Mosfet can switch logic input (5V) but I do not know which value describes the limiting factor for calculation of the resistor R6?
My attempt is with \$V_{GS} = 2V\$ @ \$I_D = 250\mu A\$ with following consideration $$ R_6 = (5V-2V)/250\mu A) \approx 12k\Omega$$
Edit: the datasheets 4N25 IRLZ34NPBF