I need to design a MOSFET control circuit which is driven from an FPGA through an optocoupler. Following are the conditions required to be met in my design:

  1. When the power is up initially and the FPGA is not programmed, the MOSFET should be ON.

  2. When the FPGA is driving HIGH (3.3V), the MOSFET should be ON.

  3. When the FPGA is driving LOW (0V), the MOSFET should be OFF.

The FPGA IO is being driven at LVCMOS 3.3V levels. The output load requirement on 12V is approximately 1.5A. Here is the circuit which I came up with:


simulate this circuit – Schematic created using CircuitLab

Please note that the above created circuit cannot be simulated. Though this circuit can meet both conditions 2 & 3, it doesn't satisfy condition 1. Is there a way in which I can modify the same circuit and make it compliant to all 3 conditions?

  • \$\begingroup\$ @Mandar: What's with all the shouting? No need to be rude here. He has already said the FPGA output line switches between 0 and 3.3 volts, and we can see from the schematic that the grounds of the FPGA and the 12 V supply are tied together. Seems pretty clear to me. \$\endgroup\$ Commented May 14, 2014 at 12:21
  • \$\begingroup\$ @Olin, that was originally an "answer" converted to a comment for obvious reasons. \$\endgroup\$
    – PeterJ
    Commented May 14, 2014 at 12:26
  • \$\begingroup\$ @Peter: Yes, I know that. I was one of the people that flagged it. However, that has nothing to do with what I asked. Shouting for no reason is still rude, whether in a comment or in a answer that should have been a comment. \$\endgroup\$ Commented May 14, 2014 at 12:31

2 Answers 2


There is no need for a opto-coupler here. In your circuit, it is not performing isolation since both sides are tied to the same ground. It is therefore just acting like a slow-responding transistor with very limited gain. Replace U2 with a NPN transistor or "logic level" N channel MOSFET.

Personally, I'd use the NPN transistor in this case. Just about any small signal NPN will do. I use 2N4401 (actually MMBT4401, the SOT-23 version, but that's more cumbersome to write) for such jellybean applications, but many many others would work fine too. Connect the emitter to ground, the base to the right side of R1, and the collector to the FET gate. Yes, it really is that simple.

Since a bare transistor will have more gain than the opto-isolator, you can increase R1. 1 mA base drive is more than enough in this case. Let's say the B-E drop of the NPN transistor is 700 mV. That leaves 2.6 V accross R1 when the transistor is supposed to be on. (2.6 V)/(1 mA) = 2.6 kΩ. That will be slower to turn off, but the FET turnoff time will be dominated by R2 acting against the FET's gate capacitance anyway.

This isn't a high speed switching application, right? If it were, you would need to make the FET turn off more deliberately than with just a 10 kΩ pullup. Your circuit is fine if the FET is just occasionally turning power on and off to some other circuit or device, not switching at more than 100 Hz or so.


I just noticed that you want the 12 V power to be on when the FPGA is "unconfigured", whatever that really means. I'll take it to mean that the P1 output will be floating at that time. In that case add a pullup resistor to the P1 output. With the NPN transistor as describe above, you don't really need much current thru its base to turn on the FET. Even a 10 kΩ pullup would be enough to keep the NPN transistor on, but high enough to not cause significant current when the FPGA is actively driving the line low to shut off the 12 V supply.

Here is the overall solution I am proposing:

  • \$\begingroup\$ That is a better way to drive the MOSFET in the circuit. Thanks! Mine is a slow-speed switching application. Also, when I wrote "unconfigured", I actually meant that the FPGA is not programmed. I now realize that I hadn't mentioned it clearly and have made edits above. Is it possible for me to add isolation to the circuit taking into consideration that my FPGA power rails are also derived from the same 12V rail? \$\endgroup\$
    – Avin
    Commented May 14, 2014 at 12:39
  • 1
    \$\begingroup\$ @Avin: Isolation makes no sense in this case since the 3.3V and 12V supplies share the same ground. Isolate what from what? I don't see what you are trying to achieve by this isolation, even if it were possible. \$\endgroup\$ Commented May 14, 2014 at 12:47
  • \$\begingroup\$ The DC-DC converter which derives 3.3V from 12V has got a separate input GND plane and an output GND plane. So if I have to protect my FPGA IO from any voltage surges or spikes happening on the 12V rail, can I isolate them by connecting the emitter of the optocoupler to the input GND plane? \$\endgroup\$
    – Avin
    Commented May 14, 2014 at 12:55
  • \$\begingroup\$ @Avin: I still don't see any need for isolation. \$\endgroup\$ Commented May 14, 2014 at 13:05

Assuming the FPGA pins float when it is unconfigured, try this:


simulate this circuit – Schematic created using CircuitLab

When the pin P1 is floating, the optoisolator is "off" and the MOSFET M1 is on (gate is pulled to -12V with respect to the source.

When the pin P1 is high, the same as above.

When the pin P2 is pulled low, the optoisolator turns on, and the gate is pulled to within a few hundred mV of the source, turning M1 off.

Of course, the optoisolator provides isolation, so the grounds need not be common between the two sides, which protects the FPGA and can avoid concern about how the heavy return current through the 12V load flows (assuming you do keep it separate).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.