Ditch The Switch: A Soft Latching Circuit Roundup

For some of us, there are few sounds more satisfying than the deep resonant “thunk” of a high quality toggle switch slamming into position. There isn’t an overabundance of visceral experiences when working with electronics, so we like to savor them when we get the chance. But of course there’s no accounting for taste, and we suppose there are even situations where a heavy physical switch might not be the best solution. So what do you do?

Enter the latching power circuit, often referred to as a “soft” switch. [Chris Chimienti] has recently put together a fascinating video which walks the viewer through five different circuits which can be used to add one of these so-called soft power switches to your project. Each circuit is explained, diagramed, annotated, and eventually even demonstrated on a physical breadboard. The only thing you’ve got to do is pick which one you like the most.

There’s actually a number of very good reasons to abandon the classic toggle switch for one of these circuits. But the biggest one, somewhat counterintuitively, is cost. Even “cheap” toggle switches are likely to be one of the most expensive components in your bill of materials, especially at low volume. By comparison, the couple of transistors and a handful of passive components it will take to build out one of these latching circuits will only cost you a couple of cents.

Even if you aren’t in the market for a new way to turn off your projects, this roundup of circuits is a fantastic reminder of how powerful discrete components can be. In an age where most projects seem assembled from pre-fabbed modules, it’s occasionally refreshing to get back to basics.

30 thoughts on “Ditch The Switch: A Soft Latching Circuit Roundup

  1. The main goals of any switch is:
    1. Be able to handle the amount of current the application needs.
    2. Not break from the voltage it will need to isolate.
    3. Not waste power.

    Most soft switches tends to consume power even when the product is off, making them undesirable in some applications compared to a physical switch. This isn’t though always the case, since one can build soft switches with no standby power consumption.

    Though, a physical switch is a very simple device, and tends to have fairly high reliability, even when it comes to more extreme situations. Most switches doesn’t care about a 2 KV spark, while most transistors gives up the magic smoke.

    So depending on the application, a transistor might simply be inadequate. Not to mention that a 10 amp rated switch is almost a novelty, while a transistor able to handle the same current is typically not the cheapest of devices.

    In the end, I mostly go for mechanical switches due to their overall ease of integration into a larger project.
    Though, in some cases a transistorized solution can be more elegant.

    1. “…10 amp rated switch is almost a novelty,”

      Your use of “almost a novelty” in this instance is incorrect. A more clear expression of your intended thought might be obtained by using “commonplace and inexpensive” instead.

      1. Well no, he has a point. For instance if you search in Digikey for DC pushbutton switches (AC is not applicable in the examples given, then out of the 4,301 pushbutton switches, only 164 (4%) are rated for 10 A DC, and many of these 164 are listed incorrectly.

        But inexpensive is correct. Typically 10A rated switches are more bulky though.

        What I am missing from the original comment is
        4) not bounce around like crazy. i.e. when you press, generate on/off/on/off/on/off/on spikes.

        1. Yes, Switch bounce is a very important thing in signaling applications.
          Less important in switching power supplies, though, excessive contact bounce can lead to contact welding…

          Though, most power switches have a clear, strong “click” to them, contact bounce is usually not that big of a problem. Compared to most smaller signal level switches that don’t slam hard into place.

    2. Obviously nobody is putting a soft switch on a 2 KV load, this seems like a pretty ridiculous comparison to make.

      Meanwhile, the majority of consumer electronics will be using some kind of soft power control. So clearly it’s worth understanding.

    3. Sometimes you do want a physical switch. e.g. safety reasons
      What happen if you firmware hangs and cannot be shutdown/reboot by switching the device off and on again?
      Many times I have to use the recess reset button on my tablet because it got into a weird mode while shutting down and won’t power off.

    4. For anything powered by rechargable batteries, the protection circuits and self discharge will be ten times more than a good soft switch. BJTs aren’t the lowest power things out there, but the just letting the microcontroller handle on/off can easily get you into the sub uA range.

    5. The one thing I will say in favor of hard switches. It’s really annoying to have a soft switched device that can’t come back by itself when power is restored. Look at common power banks, and how basically none of them can be used as UPSes for that(And other) reasons.

      A hard switch is nice because it’s behavior is predictible. Soft switches can do this almost as well(With always-on microcontrollers and batteries they often have anyway), but the behavior is rarely documented.

    6. I disagree with your assessment for the main goals of any switch. The main goal should be to alter the behavior of the circuit it’s a part of. It seems like you’re implying in your third point that the goal of having a switch is to not waste power, but that’s rarely the case, especially now that switches most often just signal to a microcontroller rather than physically turn on components. There are exceptions to this, mostly power switches and switches in some high-power applications where it’s useful to have a high-power switch rather than a switch and high-power transistors or relays.

      As for the rest of what you said, I think that the low power consumption of soft latching circuits is usually acceptable, but for very low and high-power circuits a physical switch is best.

      Thanks for your time, I hope you’re having a good day.

      1. I generally refer to switching mains. (And/or lower voltage DC supplies.)

        In these cases, having a switch that wastes power while off, is generally not desired. (Or consume excessive amounts of power while on.)

        Signal switching is a totally different story. (Though, I don’t really see much of a reason to have a complicated soft latching circuit for toggling a pin on a micro, seems strange…)

  2. Cool video, I’ve looked into circuits like this but have yet to implement any of them. I’m working on a device that I’ll need to turn on manually, it’ll do it’s thing and then turn itself off. I’m thinking a momentary switch and a pin from the micro attached to the enable pin on a voltage regulator might work – the switch will enable the regulator, power the micro, which will then hold the pin high. The micro can then pull the pin low when it’s done doing it’s thing, and something like a 1 meg pull down on the pin will make sure the regulator enable pin stays low. Have to verify, but it seems simpler than using multiple mosfets, but not having to manually turn it off helps simplify it.

    1. The regulator will consume constantly (even when it’s off), since it’s not made for this task, it does not show a huge impedance. That’s why all those circuits use a MOSFET upfront to present a large impedance to the input power source. You can sort this out with a MOSFET + regulator EN pin, but you’ll still need an additional pin to turn of your MOSFET (so you end up with 2 pins used on your microcontroller).

    2. @sweethack: Most of the regulators with enable pin goes down to ~1uA (or less) when they are in sleep mode. Both linear regulator/LDO or buck converter have their MOSFET in series connections, so they don’t need to to have an external MOSFET. There are boost converter with internal cut-off.

      As for GPIO. The circuit by [Chris Chimienti] I believe uses the same GPIO for sensing and control. IT’ll be a matter of figuring a way to do something similar if you wish.

      1. Yea, the regulator I’ve been for previous versions of my board specifies a max shutdown current of 1.5ua. Powered by a 50mah+ lipo should last years in shutdown mode. But it’s a good point which I’ll keep in mind and always check the shutdown current of regulators if/when I use them in this way.

        1. Lithium chemistry gives really flat discharge curves, so a LiPo battery could be half-discharged without showing much of a voltage drop. Drawing 2 uA it would take 50,000 hours to drain a 0.1 AH source. That’s theoretically a bit less than 6 years to fully discharge the battery.

  3. The node at the switch can be 12V, so I would be careful about (reverse) leakage current for schottky diode D1 by either using a lower value for R2 (say 330K) or substituting a silicon switching diode. Schottky diode goes up in elevated temperature.

  4. I’m confused by circuit #2. caps don’t pass DC current, so in the initially off state- the p-channel gate is pulled high via the 100k pullup. pushing the button shouldn’t change that? Maybe if the 1uF was a resistor (10k to ground on a button push)?

    1. I think it is acting like a charge pump. Both sides of the 1uF cap will be at 5V, so it isn’t holding any charge, then when you press the button, the 10k side will go low and the 100k side will start charging the capacitor. That’s going to pull the 0.1uF cap down before the 100k can charge the 1uF cap.

    2. Assuming the 1u and 10uF capacitors are at 0V, pressing the button will pull the other side of the 1uF capacitor at the PMOS input to .5V (90% to 0V because of the .1uF), then will begin charge up with a 100ms time constant. When the PMOS turns on, the 10uF has 0V so the NMOS is pulled to 5V with a 3S time constant. If the button is released, then the 10uF is discharged to 0V and NMOS pulled to 5V via the 100K+300K. Either the button press or GPIO held low will eventually turn off the NMOS after the 10uF charges up with the 3s time constant. The 1uF keeps the long button press from keeping the PMOS on as in other circuits.

      I have no idea why the test circuit wouldn’t work. Button bounce shouldn’t matter. I wonder what the voltage is at the NMOS input.

  5. On the final circuit, remove the 100K pullup resistor to 9V on the input pin. Use the internal pullup resistor instead. This will keep the voltage on that pin from going above the Arduino voltage, and simplify the design.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.