on/off latching circuit

Thread Starter

robotDR

Joined Mar 17, 2020
80
Hi All,
Can I get your opinion on this simple latching circuit? I got it from here (first circuit shown):

I need it to power on with a push of the momentary button. and then turn off with another push. I am ok to use the micro controller as discussed in the video. Micro keeps it on, and micro can shut it down after reading the button press.

Does anyone see any red flags with this circuit? Note he moves the cap to be in parallel with the mosfet gate pull up.
1674417274678.png
 

Irving

Joined Jan 30, 2016
3,806
The capacitor is to delay switch-off to allow the MCU time to power up and go through its initialisation sequence after the button is pressed and released before the MCU is able to turn the NPN transistor on.

The approach shown is fairly conventional, I've used it myself in various forms.
 

Thread Starter

robotDR

Joined Mar 17, 2020
80
The capacitor is to delay switch-off to allow the MCU time to power up and go through its initialisation sequence after the button is pressed and released before the MCU is able to turn the NPN transistor on.

The approach shown is fairly conventional, I've used it myself in various forms.
Great to hear. Thank you for the reply and insight to the circuit!
 

MisterBill2

Joined Jan 23, 2018
17,855
The circuit shown is about a hundred times more complex than a traditional start button/ stop button latching relay circuit.
That circuit uses a normally open start button and a normally closed stop button, and a relay with at least two independent normally open contacts.
But now I see the requirement for a single button. Consider, though, the benefit of always being certain as to what pressing a button will do: OFF is always OFF, and ON is always on.
But if you want alternate actions using only one single button, but do not want to use an actual "alternate action" push button, then a more complex circuit will be required.
 

SamR

Joined Mar 19, 2019
5,019
If used from a 5V Arduino Out Pin, sure. In fact, there is an entire class of logic level mosfets. Such as the 2N7000 which requires a minimum of 3V (or less) at the gate to turn on.
 

Irving

Joined Jan 30, 2016
3,806
Instead of the NPN transistor pulling the mosfet gate to ground, can I use an n channell mosfet?
Not only can you do so, but there are standard packaged dual N- & P-Channel devices that are designed for this purpose. Check out, for instance, IR7317 - shown below in LTSpice simulation of 5v/500mA switch. The p-channel device is good for switching up to15v at 4A.

IRF7317 datasheet

1674650403535.png
 

Thread Starter

robotDR

Joined Mar 17, 2020
80
Follow up questions. I just realized something.

That circuit I posted in the first post, there is a 2.2uF cap (moved to V+ net).
What if that V+ net has more capacitance on it to ground, elsewhere? 99% of hte time, the caps will be charged as they are connected to a battery. Will extra capacitance to ground cause performance issues on this circuit?
 

MisterBill2

Joined Jan 23, 2018
17,855
Additional capacitance across a battery, or any other voltage source, has the effect of reducing the source impedance as seen from outside the circuit. This effect is usually an improvement to some degree.
 

Irving

Joined Jan 30, 2016
3,806
Follow up questions. I just realized something.

That circuit I posted in the first post, there is a 2.2uF cap (moved to V+ net).
What if that V+ net has more capacitance on it to ground, elsewhere? 99% of hte time, the caps will be charged as they are connected to a battery. Will extra capacitance to ground cause performance issues on this circuit?
Not sure what you're getting at. Capacitance on the input side at V+ will have little impact on the function of this circuit. When the button is pressed the 2.2u charges from V+ via the diode and the switch as the gate of the P-channel is pulled to ground. If the button is held down long enough the MCU starts, asserts pin12 (out) turning on the transistor and thus maintaining its power. If the button is released sooner the gate of the P-channel is held -ve with respect to its source by the capacitor, keeping it on, while the capacitor discharges through the 1Meg resistor, holding the supply up for approx 0.5 - 0.7sec. Capacitance on the MCU side from regulator input to ground would also hold the supply up but would need a much larger and more expensive capacitor for the same time delay.
 
Last edited:

Reloadron

Joined Jan 15, 2015
7,455
I need it to power on with a push of the momentary button. and then turn off with another push. I am ok to use the micro controller as discussed in the video. Micro keeps it on, and micro can shut it down after reading the button press.
OK, you want a latching circuit. Latching circuits can be as simple or complex as you want them to be. You want to power on / power off something. Would be nice to know the something? Well how much power are you switching for example what is the load out there? DC 12 Volts @ 10 amps? AC 24 volts @ 20 amps? Knowing the load parameters is the first step in determining the best suited latching design. Yes, you can use a uC (micro-controller) But in most cases a few simple push buttons and a DPDT relay are all you need. You want a simple circuit for your specific application so it all begins with your application, knowing the load and load requirements id where it all; begins.? Hell there were mechanical very reliable systems long before uC camw around. So what's the plan?


Ron
 

MisterBill2

Joined Jan 23, 2018
17,855
In addition, I have seen even those tiny little 4-legged switches in the alternate action form a few times. That could be the simplest way to get the alternate action as required.
 
Top