Simpler than the World's Simplest Softlatch (re: EEVBLOG #262) - Page 1
Forum section: electronics / general

author: NeverDie
author_rank: Regular Contributor
timestamp: October 04, 2022, 03:33:22 pm
content: Reporting back:I came across this circuit, which uses just two mosfets:Source:http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/electronic-circuits/push-button-switch-turn-on/latching-toggle-power-switchAside from using fewer components, it's also easier to understand.Based on simulation, I found that it can also work with just one transistor and one mosfet (see attached schematic, where I used a Tina time switch to simulate brief button pushes).So maybe this really is the world's simplest soft latch? I enjoyed the original video, but maybe it's worth updating the video with these circuits as a fun follow-up.Keep up the good work!

author: Fungus
author_rank: Super Contributor
timestamp: October 08, 2022, 12:07:57 pm
content: I ordered a bunch of these modules last week:https://www.aliexpress.com/wholesale?SearchText=Si4599I needed some P-channel MOSFETS and these boards were cheap so I figured I could have a stock of "MOSFETS" that can be used in either low or high configuration as needed.They should be able to implement this circuit easily, too.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 10, 2022, 08:29:23 pm
content: I'd be interested to know how much leakage current there would be in this circuit, since the stated objective is to mimic a physical switch.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 11, 2022, 07:50:51 pm
content: @Fungus Given the seemingly never ending chip shortage I find myself gravitating toward easily substitutable parts that have generic footprints and generic pinouts. In this case, something like SI2312BDS-T1-E3 and SQ2315ES-T1_GE3 for n-channel and p-channel mosfets. They also have less leakage and lower threshold voltages, which is a better fit for the general trend toward lower voltage and lower power electronics. What I like about Vishay parts is that Vishay generally has easy-to-find p-spice models of their parts. I don't know of any other manufacture that does as well as Vishay at publishing p-spice models for their parts. Can anyone here name some? It seems hit or miss with other manufacturers whenever I've gone looking.

author: Fungus
author_rank: Super Contributor
timestamp: October 12, 2022, 06:58:57 am
content: Quote from: NeverDie on October 11, 2022, 07:50:51 pm"Jellybean" parts.https://en.wiktionary.org/wiki/jellybean_part(funnily enough,https://jellybean.parts/is a site for parts that are anythingbutjellybean)My little NP-MOSFET modules just arrived. I might have a go at building that circuit to try one of them out and make sure I haven't been sold duds.I'll measure the leakage current...

author: Zero999
author_rank: Super Contributor
timestamp: October 12, 2022, 01:21:11 pm
content: Quote from: NeverDie on October 04, 2022, 03:33:22 pmA MOSFET is a transistor.That BJT needs a base resistor. The huge current surge from the capacitor isn't going to do it any good.

author: Fungus
author_rank: Super Contributor
timestamp: October 12, 2022, 01:34:14 pm
content: Update: I built the circuit as a test....At first I couldn't get it working, it always switched itself on after a delay.After a lot of head scratching I figured out the load is important for it to work. There always has to besomeload or it won't stay off.I was switching a 3W LED so the voltage at the load was below the diode's threshold voltage in the "off" state. Result: No electrons could go that way and it switches itself on again.I added a 47k resister across my LED (as shown below in red) and it works perfectly.The only thing I don't like is that it needs a very short press/tap to turn it off. It turns back on again if you hold the button for more than half a second.Measured quiescent current is negligible, sub-microamp.

author: Peabody
author_rank: Super Contributor
timestamp: October 12, 2022, 03:28:39 pm
content: I assume no current is flowing through the 47K when the switch is off, but it does sink current when it's on. If the 47K is there to ground the gate of the N-channel mosfet, then I wonder how big a resistor value would still work. Have you tried 1Meg? And I guess if the load was more normal, there would be a path to ground through the load when it's powered down, so you wouldn't need the 47K.

author: ledtester
author_rank: Super Contributor
timestamp: October 12, 2022, 04:55:50 pm
content: Quote from: Fungus on October 12, 2022, 01:34:14 pmThat seems to be a common problem with all of the simple, single switch soft latches.

author: Fungus
author_rank: Super Contributor
timestamp: October 12, 2022, 05:10:02 pm
content: Quote from: Peabody on October 12, 2022, 03:28:39 pmI didn't optimize it.47k means it would be insignificant compared to my LED and it's in the "better safe than sorry" range.Quote from: Peabody on October 12, 2022, 03:28:39 pmI assumed there must be some leakage through the P-channel at the top and it was slowly charging up the gate of the N-channel at the bottom. Once it reaches a threshold it will create a positive feedback loop and rapidly turn the thing on.I leave the optimization as an exercise for the reader.

author: Fungus
author_rank: Super Contributor
timestamp: October 14, 2022, 01:16:39 pm
content: Hah!I just watched Dave's video again and he specifically claims his circuit is the simplest possible.https://youtu.be/Foc9R0dC2iI?t=950This one is obviously much simpler.(and it doesn't oscillate if you hold down the button - it stops at "on")

author: NeverDie
author_rank: Regular Contributor
timestamp: October 14, 2022, 02:21:18 pm
content: Interesting results. Maybe this is a case then where using an NPN transistor (as shown in the second attachment on the OP of this thread) instead of an n-channel mosfet is therefore preferable: whatever leakage current leaks through the p-channel mosfet would presumably pass through the NPN transistor to ground, rather than build-up as an ever increasing voltage on the gate pin of the n-channel mosfet.AFAIK, the only way to totally shut-off the D-S leakageon the p-channel mosfet is if the gate voltage is higher than the input voltage (such as by using a charge pump).

author: Fungus
author_rank: Super Contributor
timestamp: October 14, 2022, 03:24:40 pm
content: Quote from: NeverDie on October 14, 2022, 02:21:18 pmYes, although using a dual-MOSFET ICs like the one I usedcouldreduce the overall component count so it might be cheaper.For high power circuits you'll need a bigger MOSFET though and the BJT makes more sense.Quote from: Peabody on October 12, 2022, 03:28:39 pmNot as much as the 10k resistor on the left. :-)

author: Peabody
author_rank: Super Contributor
timestamp: October 14, 2022, 03:52:07 pm
content: Quote from: Fungus on October 14, 2022, 03:24:40 pmIndeed. Maybe we need a new target of not only the simplest switch, but one that also draws no continuous current when on, if that's possible, or maybe the least current. As I remember, Dave's circuit grounded through a 100K resistor. This one grounds through 10K.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 14, 2022, 06:13:48 pm
content: Quote from: Fungus on October 14, 2022, 03:24:40 pmYes, in retrospect you made a good pick.I'm now open to the Si4599, because when I tried simulating the circuit with the 300mv threshold voltage mosfets that I named, the circuit no longer worked. Apparently the threshold voltage needs to be greater than 600mv, or else the circuit won't turn off. The threshold voltage on the Si4599 is 1.4v and -1.2v, so the absolute magnitudes are big enough that it sidesteps the issue.Anyhow, in playing around with one variant of the circuit, it works (at least in simulation) even if the button presses are as long as half a second, which seems manageable. I'll have to try the real McCoy though, as I'm not sure just how accurate Tina really is in its simulation. Sometimes the Tina simulations look a bit wonky. Is there a better simulator I could be using instead, preferably one with a large and current catalog of well vetted components?

author: thm_w
author_rank: Super Contributor
timestamp: October 14, 2022, 09:00:27 pm
content: Quote from: NeverDie on October 14, 2022, 06:13:48 pmhttps://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/

author: Fungus
author_rank: Super Contributor
timestamp: October 15, 2022, 06:30:20 am
content: Quote from: NeverDie on October 14, 2022, 06:13:48 pmIt was dumb luck. I already ordered those before I saw this circuit, it just seemed like a perfect test for themQuote from: NeverDie on October 14, 2022, 06:13:48 pmIt probably will if you make the capacitor bigger or increase the 10k resistor on the right.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 27, 2022, 12:22:16 am
content: Quote from: thm_w on October 14, 2022, 09:00:27 pmCool. Apparently it was fairly expensive (around ~$4500) before it became free:The same guy (and maybe others) also has a youtube tutorial series on how to use it. I'll give it a try and see if it's as twitchy as Tina is to the length of simulation time and other such things which paradoxically do affect the simulation outcomes (even though they shouldn't). That's why I sometimes have trouble believing the Tina results. Maybe there's a way to fix that in Tina? I like Tina over LTSpice because Tina is wildly faster than LTSpice, although maybe (?) the price of that much faster speed is the weirdness in Tina simulation that I'm observing. I just don't know, but if anybody here does then please post.

author: thm_w
author_rank: Super Contributor
timestamp: October 27, 2022, 09:53:31 pm
content: I haven't noticed any weirdness with simulation times.But if you don't set enough simulation points, you could miss out on high frequency oscillations, etc. Usually this will be obvious on the waveform.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 29, 2022, 08:20:44 pm
content: I got it working in Micro-Cap. It works over a nice wide range from 1.5v to 3.3v, which is the range that I happen to care about, and can be made to work at higher voltages by tweaking some of the values. Attached is a simulation showing that it works even when the button presses are 1 second long, which addresses one of the concerns voiced above in this thread.Regarding the micro-cap simulation, the results are not in complete agreement with the Tina simulation, but there's enough leeway wrt component values that I'm pretty sure it can be made to work on the bench. Unfortunately, I couldn't figure out how to simulate multiple button presses on the same button using micro-cap, so I used two separate time switches to simulate two different presses of the same button. The results are obviously equivalent, even if the resulting micro-cap schematic isn't as pristine as I would have liked.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 29, 2022, 10:36:06 pm
content: By way of explanation, the blue curve is the output voltage across the load (simulated by the 1k resistor), and the red curve is the charge across the capacitor. The red curve is plotted merely to give insight as to what's going on. As for the chronology of events, the simulated "button" gets pressed at time=1second, and released at time=2second. Then again at time=5second it gets pressed again, and released at time=6seconds. Of course, it can be held down for just 100ms if so desired, but I present it this way to cover the concern voiced in the comments above that you have to very quickly jab the button. At least in this particular circuit, you don't.

author: NeverDie
author_rank: Regular Contributor
timestamp: October 29, 2022, 11:44:29 pm
content: One of the micro-cap quirks that the simulation betrays is that the initial output should be zero, whereas in the micro-cap simulation it is full-on. I'm sure there is a way to fix the micro-cap simulation to account for this, but in digging around for how to do that it became clear to me that micro-cap is primarily a very thin veneer over text-oriented p-spice--so get ready for that if you aim to have micro-cap as your simulator of choice. IMHO, Tina does as much better job of insulating you from p-spice syntax. In the end, though, I imagine it's probably good to have at least a couple different simulators that you're familiar with and can draw upon.

author: NeverDie
author_rank: Regular Contributor
timestamp: November 03, 2022, 11:22:58 pm
content: @Fungus Just for grins, I ran a simulation of the circuit on micro-cap 12 using the Si4599 (see attached), and with little effort effort I found it appears to work just fine in the voltage range from 3v to 5.5v. Perhaps with more effort that voltage range could be widened.Have fun!

author: Fungus
author_rank: Super Contributor
timestamp: November 04, 2022, 02:54:30 am
content: Quote from: NeverDie on November 03, 2022, 11:22:58 pmI'm not pushing that chip, I just happened to discover it on Aliexpress that week.FWIW, I've ordered some more since then. They work great with Arduinos and those little PCBs are way easier/neater than messing around with TO-220s. 4A current is plenty for most things I do.

author: NeverDie
author_rank: Regular Contributor
timestamp: November 04, 2022, 02:47:58 pm
content: What I find interesting is that different MOSFET's have different "sweet spots" as to the voltage range over which the circuit works well. What are the dominating factors that determine what that sweet spot is for a given pair of mosfets, and what are good rules of thumb for pairing mosfets to work especially well together? I'm not exactly sure, except that 1. threshhold voltage appears to be one of the factors, 2. for higher current scenarios, presumably Rds(ON) may be important as well. In terms of selecting resistor values suitable to get the whole thing working.... for me that has so far been more art than science. Surely there must be a way via simulation to answer these types of questions in a more automated manner than just manually plugging and chugging based on hunches?

author: Fungus
author_rank: Super Contributor
timestamp: November 04, 2022, 02:54:51 pm
content: I think the gate capacitance will be really important, too.

author: Zero999
author_rank: Super Contributor
timestamp: November 17, 2022, 10:44:54 pm
content: It's possible to do this with a relay. This can be handy inside industrial control systems.It works because the relay has hysteresis. The relay won't turn on, when power is fist applied, because the voltage across it is too low, thanks to R1. C1 charges via R2. When the switched is pressed (W3) C1 discharges a bit into L1, causing the relay to turn on and connect R2 to 0V. C1 discharges when the switch is released. When the switch is pressed again, C1 charges via R1, briefly pulling L1's voltage down to 0V and turning it off.R1 should be a bit higher than the relay's coil resistance and R2 about double R1. C1 should be large enough to soak up enough charge to turn the relay off. Normally getting it to turn on is easier, than off.