I'm trying to implement a latching circuit for around 4.1V of voltage (LiPo battery). Below is the circuit:

Latching circuit

The problem is that the circuit is always on as soon as the power is applied (so even before pressing the button).

I tried removing both transistors and can confirm that the MOSFET works as expected. No voltage on VSYS after turning on, but it appears after grounding the gate.

After adding only Q2 (2SC5663) back (Q1 is still de-soldered) VSYS has voltage when the power is applied, so it's always on. After I remove R4, the transistor is no longer on, and I can turn it on by pressing the U5 button. However, it also turns on even when I touch one of R4 pads with my finger (the one connected to the base of Q2). So it feels like Q2 is overly sensitive.

The original transistor in the schematic was BC547 but I needed an SMD transistor and found 2SC5663.

Why is this happening? Is there a way to fix this?

Datasheet for 2SC5663


2 Answers 2


When Q3 is off and the switch is open, the bases of Q2 and Q1 are effectively disconnected, floating. In that state any induced current in that node, no matter how small, including current you inject by touching it, will switch on Q2 and Q1, momentarily. That's enough to bring Q3's gate low, switching it on, and staying on due to the latching action of Q2.

It wouldn't surprise me if merely applying power was enough to evoke current in Q2's base, either capacitively or inductively, triggering the latch in this way.

Also, by closing the switch, you brutally apply a fully charged capacitor's voltage directly across the base-emitter junction of those poor transistors, which is way beyond the 0.7V that they ever expect to see there or can tolerate. All the capacitor's energy is instantly dumped into a tiny PN junction, and is likely to cause damage.

You must protect those bases from C3, and you must hold them low, never allowing them to float like that.

Also, the orientation of D2 is suspicious to me. As it is, bringing OFF_PIN high will damage Q1 and Q2, and when it's low nothing happens.

Here's a suggested setup, which I haven't tested, and in which I shuffled components around to help me understand their function:


simulate this circuit – Schematic created using CircuitLab

The changes are:

  1. Added R6 to keep the bases grounded when Q3 is off, which should deal with the "touch sensitivity".

  2. Added R7 to limit base current when switch U5 is closed.

  3. Reversed D2, which makes more sense. Bringing OFF low will cause all transistors to be turned off. When OFF is high nothing explodes, no black holes are created, and the laws of physics remain intact.

  • \$\begingroup\$ Thanks Simon for the awesome answer! Adding R6 was the key! After adding it the circuit no longer turns on when powering up and when I press the button it turns on and properly latches!! I will add Q1 back tomorrow to see if it can be switched on, but I don't see why it wouldn't :) Thanks for fixing D2, it was the only part of the circuit that I've designed myself and I messed it up :D The only thing is that "touch sensitivity" still remains when I touch the base of Q2 (or rather R6/R4 since the transistor is so tiny) \$\endgroup\$
    – Leonti
    Sep 2, 2022 at 11:34
  • \$\begingroup\$ I guess it's not a big deal, since I can just avoid touching it, but I'm not sure why it's happening. I tried reducing R6 to 1k just to see if it would make things better and obviously it no longer latches, because R4 is still 100k, but it still activates on touch :( \$\endgroup\$
    – Leonti
    Sep 2, 2022 at 11:41
  • \$\begingroup\$ Also, will definitely add R7 resistor, I wasn't aware of how the current would flow through the transistor, thanks for catching it! \$\endgroup\$
    – Leonti
    Sep 2, 2022 at 11:44
  • \$\begingroup\$ Vales of 100k and 220k for R4 and R6 are definitely on the high side, and you can reduce them a lot, for better noise immunity. You will pay for that luxury in increased current draw through them, once Q3 is on, though. \$\endgroup\$ Sep 2, 2022 at 15:39
  • \$\begingroup\$ I've soldered Q1 back on and added R7, and now the whole circuit works! I have to press the button really fast for it to turn off though. If I understand it correctly it's because C3 discharges too fast. Should I introduce another resistor between the ground and C3 to increase the discharge time? I was thinking about increasing value of R5, but then it would mean I have to increase R6 as well for the "ON" press to work? \$\endgroup\$
    – Leonti
    Sep 3, 2022 at 3:50

When you first apply power, all the terminals of Q3 are at zero potential. When you apply battery power, Q3's sources goes high right away, but the gate still has not been charged, so the MOSFET conducts. Then VSYS stays high. You need an arrangement that at the very least let's Q3's gate get charged before you ever push your button. If you put a large enough resistor from the gate to ground, then Q3's gate would quickly charge and Q3 would stop conducting. Pushing the button would cause the gate to discharge, as you intend.

When you do push the button, there will be an effective short from C3's charged end to ground through Q1. You may want to limit the resultant discharge current by putting a resistor in series with Q1's collector.

Finally, as the MOSFET is susceptible to damage from static electric discharge, be sure you're grounded before touching the pads of R4. This will prevent damage to the MOSFET.

  • \$\begingroup\$ This circuit is basically a copy of this one: electronoobs.com/eng_circuitos_tut60.php And it doesn't have a resistor from gate to ground. Is it because my MOSFET is different? What would the value of the resistor be? I guess my main question is why Q2 turns on when I just touch it's base (R4 pad). R4 is disconnected, so it can't be explained by power coming from the MOSFET on startup. \$\endgroup\$
    – Leonti
    Sep 2, 2022 at 6:09

Your Answer

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

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