Why doesn't my latch work (schematic attached)?

I tried to make a simple latch with a PNP transistor and a MOSFET. The idea is that initially it is off, when you press the button it turns on and stays on.

But it doesn't stay on.

Here is the circuit:

I've tried it with both 12v and 5v, it doesn't work.

I also tried increasing the pullup and pulldown resistors R1 and R4 to 4.7K, in which case the LED is initially on. (Not sure why!)

I attached a picture of the actual implementation, I don't know how much you can make out from it but here it is:

• The schematic looks OK, so maybe you have a wiring error. Can you show us your actual implementation? Aug 28, 2017 at 1:59
• the switch resistance can be the problem. It should be tied to base not drain using same as R2 Aug 28, 2017 at 2:02
• @TonyStewart.EEsince'75 I connected it to the base, still the same problem. I attached a picture of the breadboard.. Aug 28, 2017 at 2:11
• What's the PN of your MOSFET? Aug 28, 2017 at 2:16
• @ThePhoton It's an IRFZ34N, data sheet is here: infineon.com/dgdl/… Aug 28, 2017 at 2:18

You could put a cap to ground at/near your mosfet gate. Perhaps across $R_4$ in your circuit.

Try this as an option:

simulate this circuit – Schematic created using CircuitLab

$R_3$ limits sudden currents to $C_1$ and the gate of $M_1$ and oscillations, but still also allows $C_1$ to discharge pretty fast through the LED load when the power is removed. $R_4$ is needed to keep trace currents from charging the mosfet gate and to also further discharge $C_1$ when the LED isn't conducting much anymore.

The above circuit is set up for an LED current of about $20\:\textrm{mA}$ as an example. If you plan some monster LED later on, the values and part selections would need to be changed.

EDIT:

I'd much have preferred the use of another BJT rather than a mosfet. In that case, the following circuit is an easy derivative, robust, and doesn't need $C_1$:

simulate this circuit

You could also get rid of one (or perhaps even both) of the two $33\:\textrm{k}\Omega$ resistors and further simplify it. The LED load is plenty, already, so I don't see much real need for $R_4$. And given that, the whole thing should power up in the right state also without the need for $R_2$. But this applies so long as there is a load. Otherwise, I'd keep at least one of them.

• Thanks for the detailed response. What is the purpose of adding a capacitor? Aug 28, 2017 at 12:21
• @CaptainCodeman Well, I'd have much preferred using a BJT rather than a mosfet. But with the mosfet in your arrangement I'm mostly bothered by $C_{GD}$.
– jonk
Aug 28, 2017 at 14:48
• @CaptainCodeman Let me know if it works for you. I'd be interested to know.
– jonk
Aug 28, 2017 at 15:08
• Hi! yes, it worked, thank you! I believe the problem with my original design was that the pullup and pulldown resistors were too small! Aug 30, 2017 at 8:16
• (By the way the reason I used a MOSFET is because I need it to drive a motor!) Aug 30, 2017 at 8:17