Driving an opto isolator where ground can swing between 30V and 0V
I believe that your circuit looks like this:



simulate this circuit &ndash; Schematic created using CircuitLab
Calculate the current in the opto diode. The opto diode has a drop of roughly 1.3V, the plain diode has a drop of about 0.7V:
= (5.0 - 1.3 - 0.7) / 510 = 5.9 mA
Calculate the current in the opto transistor. Vce at saturation will be about 0.3 V.
= 4.7 / 1k = 4.7 mA
You need a transfer percentage (transistor current / diode current) of:
= 4.7/5.9 = 80%
Now, look at the transfer characteristic table. EL357N (with no letter after it) isn't guaranteed to work. The &quot;A&quot; device is marginal.
If you are using the higher gain part and there is no chance you will ever use a lower one, then you are fine.
But, consider this, one concept that I try to teach young engineers: when margin is cheap, put in a lot. And here I mean cheap in the broadest sense, not just cost. Unless overall power is a concern, make R2 smaller for more margin.