Author Topic: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)  (Read 4517 times)

0 Members and 1 Guest are viewing this topic.

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« on: October 04, 2022, 03:33:22 pm »
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-switch

Aside 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!


« Last Edit: October 05, 2022, 08:58:18 am by NeverDie »
 
The following users thanked this post: thm_w

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #1 on: October 08, 2022, 12:07:57 pm »
I ordered a bunch of these modules last week:
https://www.aliexpress.com/wholesale?SearchText=Si4599

I 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.  :)
« Last Edit: October 08, 2022, 12:19:48 pm by Fungus »
 
The following users thanked this post: NeverDie

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #2 on: October 10, 2022, 08:29:23 pm »
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.
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #3 on: October 11, 2022, 07:50:51 pm »
@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.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #4 on: October 12, 2022, 06:58:57 am »
@Fungus Given the seemingly never ending chip shortage I find myself gravitating toward easily substitutable parts that have generic footprints and generic pinouts. 

"Jellybean" parts.

https://en.wiktionary.org/wiki/jellybean_part

(funnily enough, https://jellybean.parts/ is a site for parts that are anything but jellybean)

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...

 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19520
  • Country: gb
  • 0999
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #5 on: October 12, 2022, 01:21:11 pm »
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).
A 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.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #6 on: October 12, 2022, 01:34:14 pm »
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 be some load 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.
« Last Edit: October 13, 2022, 02:29:39 am by Fungus »
 
The following users thanked this post: thm_w

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #7 on: October 12, 2022, 03:28:39 pm »
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.

 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #8 on: October 12, 2022, 04:55:50 pm »

The only thing I don't like is that it needs a very short press/tap to turn it off. If you hold the button for more than half a second it turns back on again.


That seems to be a common problem with all of the simple, single switch soft latches.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #9 on: October 12, 2022, 05:10:02 pm »
I assume no current is flowing through the 47K when the switch is off, but it does sink current when it's on.

I didn't optimize it.  :)

47k means it would be insignificant compared to my LED and it's in the "better safe than sorry" range.

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?

I 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.

« Last Edit: October 12, 2022, 05:14:21 pm by Fungus »
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #10 on: October 14, 2022, 01:16:39 pm »
Hah!

I just watched Dave's video again and he specifically claims his circuit is the simplest possible.

https://youtu.be/Foc9R0dC2iI?t=950

This one is obviously much simpler.

(and it doesn't oscillate if you hold down the button - it stops at "on")
« Last Edit: October 14, 2022, 01:18:57 pm by Fungus »
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #11 on: October 14, 2022, 02:21:18 pm »
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).
« Last Edit: October 14, 2022, 03:04:55 pm by NeverDie »
 
The following users thanked this post: Fungus

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #12 on: October 14, 2022, 03:24:40 pm »
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.

Yes, although using a dual-MOSFET ICs like the one I used could reduce 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.

I assume no current is flowing through the 47K when the switch is off, but it does sink current when it's on.

Not as much as the 10k resistor on the left. :-)
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #13 on: October 14, 2022, 03:52:07 pm »

I assume no current is flowing through the 47K when the switch is off, but it does sink current when it's on.

Not as much as the 10k resistor on the left. :-)

Indeed.  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.



 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #14 on: October 14, 2022, 06:13:48 pm »

Yes, although using a dual-MOSFET ICs like the one I used could reduce the overall component count so it might be cheaper.


Yes, in retrospect you made a good pick.  8)   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?
« Last Edit: October 14, 2022, 06:24:20 pm by NeverDie »
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6378
  • Country: ca
  • Non-expert
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #15 on: October 14, 2022, 09:00:27 pm »
Yes, in retrospect you made a good pick.  8)   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?

https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: NeverDie

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #16 on: October 15, 2022, 06:30:20 am »
Yes, in retrospect you made a good pick.  8)   I'm now open to the Si4599

It was dumb luck. I already ordered those before I saw this circuit, it just seemed like a perfect test for them

Apparently the threshold voltage needs to be greater than 600mv, or else the circuit won't turn off.

It probably will if you make the capacitor bigger or increase the 10k resistor on the right.
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #17 on: October 27, 2022, 12:22:16 am »
Yes, in retrospect you made a good pick.  8)   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?

https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/

Cool.  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.
« Last Edit: October 27, 2022, 06:15:44 pm by NeverDie »
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6378
  • Country: ca
  • Non-expert
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #18 on: October 27, 2022, 09:53:31 pm »
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.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: NeverDie

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #19 on: October 29, 2022, 08:20:44 pm »
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.

 
The following users thanked this post: thm_w

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #20 on: October 29, 2022, 10:36:06 pm »
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.
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #21 on: October 29, 2022, 11:44:29 pm »
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.
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #22 on: November 03, 2022, 11:22:58 pm »
@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!

 
The following users thanked this post: Fungus

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16649
  • Country: 00
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #23 on: November 04, 2022, 02:54:30 am »
@Fungus  Just for grins, I ran a simulation of the circuit on micro-cap 12 using the Si4599

 :)

I'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.
 

Offline NeverDieTopic starter

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Simpler than the World's Simplest Softlatch (re: EEVBLOG #262)
« Reply #24 on: November 04, 2022, 02:47:58 pm »
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?
« Last Edit: November 04, 2022, 03:01:06 pm by NeverDie »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf