I want to drive a 12V, 1.5A valve from a microprocessor and also provide some isolation. The MCU outputs 3.3V logic, and I have this output going into a common source amp & also have a resistor in series calculated for the optocoupler LED value.
The 6n137 is inverting, but the MCU will be aware of this in code & handle it.
On the output, I will have a couple configs for testing so I have a solder jumper. Ignore that and just assume the PMOS source is connected to 12V. Please assume it will be a part that can support the power requirements.
I tested this on the bench and I'm noticing that the 1k pull-up is pretty "strong", meaning the optocoupler struggles to pull the gate to GND quickly but can pull the gate to Vcc very fast. On the output, the slow fall time of the gate means that the PMOS has a delay in turning on and it results in the duty cycle of the output being different from the duty cycle of the input. Since the gate gets pulled up quickly, the falling edge on the output is well aligned in time and fast.