Just in case you were wondering how much this saves... I got a parts list for what he drew whipped up in digikey, and this is what I found: 3A toggle switch = $1.76/unit at 200 item price break (min quantity) 200 units = *$352 total* I will assume the 200 unit price break for the rest of these numbers and surface mount components except for the push button. If the minimum quantity is higher, I'll include that cost. 5,000 100k resistors = $6.46 (4,400 not used) 250 1M resistors = $7.99 (50 not used) 200 22uF capacitors = $16.86 200 30V 3.8A P-channel MOSFET's = $35.00 200 Dual NPN transistors (2 transistors, one package) = $25.90 200 Through hole momentary push buttons = $15.18 Total price = *$107.39* Less than 1/3 the price! And I didn't even try to make things better by trying to minimize the number of different parts.
Yes, but you must consider also the operation cost. The pcb must be manufactured, the electrical components must be placed an soldered. If you are gonna place this components on a pcb which already is designed to be in your system, the influence on the operation cost for this feature is almost insignificant. Anyway, the final price tag is still below.
Try expand the calculation by comparing the pcb cost, pcb assembly and fitting vs Drilling a hole for the toggle switch, soldering leads to the switch and fitting the switch Yes - I do consider the electronic solution done with other electronics fitted anyway. As a former PTA engineer I learned to avoid any extra manual assembly cost on the production line.
As you go higher in production count the end cost may worth it, because the robot machines can populate all those parts in 3 seconds and the addition of the PCB is almost negligible. It is good alternative however.
Hi Dave, I have a slight improvement on the circuit, move the capacitor to collector of the T2 and remove 1 M resister from base of T2, connect both bases togater and put switch between the collector of t2 and basses. replace 100 k resister with 650k at collector of t2 and vcc.works just fine , no more ocilations, hold the switch as long as you want
FYI for those novice, such as myself, who are building this soft latching switch. I had been working on making this switch work for over a month. I'm using all bjts. I tried different resistors, different capacitors, and different types of bjts. I could not get it to latch off. As soon as I let off the momentary switch the light came back on. Holding down the push button I could get it to flash like Dave's but it would not stay in the off position. Finally I went back to original components and then it dawned on me, after viewing Dave's video a couple of dozen times, the LED I was using was not a sufficient load. I put in a 1/2 watt 2200 ohm in parallel with the LED and viola! It's working! Thanks Dave.
Your channel is damn good. The way you describe things from simple to complex can rival the best tech school teacher out there. I am learning things I've never bothered to learn, all thanx to your channel. Cheers.
For anyone wanting to simulate or build some of these circuits as Dave goes along, remember that BJT transistors realistically require either a pull-up or pull-down resistor in order to ensure their default state. For example, in this video, at minute 4:00, this circuit would likely actually start in the ON condition without pressing anything because the base of Q1 (the PNP) transistor is not guaranteed to be held high, and is likely close enough to ground, it will start conducting, causing Q2 to fire turning the circuit on. If we use 100K-Ohm resistors everywhere to keep current low on the base of the BJTs, a weaker pull-up is necessary on Q1 simply to ensure the base is high on startup but can be easily overcome by the ON switch, grounding the base. For this pull-up, simply connect a 1M-Ohm resistor between the collector of Q2 and the emitter of Q1.
You are right.... In reality this 4.00 circuit will be pretty unstable.... We just have to use a big resistor between the collector and base to ensure that the base of Q1 remains high enough not to turn on randomly.
Youare actually right, I tried to make the circuit at 4.00 but turned ON by itself and the ON sswitch seemed to be doing nothing at all. I will try with your suggestion again
Would I read this earlier, I would save myself some 8 hours of building and simulating... 😂 On the plus side, I am able to simulate this circuit in CircuitJS, TinkerCad AND Ltspice... 😅
Commenting again because this is that good. This is the first video by EEVblog I've watched, but communicating the thought/development process of a circuit is what I've been searching for since my undergrad years! Extremely impressed. And delivered with an Australian (?) accent? Amazeballs, and Bob's your uncle.
Yes, it will usually be cheaper, cost it out yourself. It's not just about cost either. Sometimes you want/need a soft switch instead of a big clunker mechanical toggle.
I absolutely love your videos! Usually, analog+me=fire! but your detailed explanations of the theory has given me confidence, and I have less fires and explosions on my breadboards now. So not only have you helped my understanding of electricity, you have helped to save the world as well! Hey! Bob's your uncle! Great job and thank you!
Awesome vid. Quite helpful to see AND hear why things work or don't. Usually you get one or the other. Time to get busy making stuff, thanks for sharing
It's a really good idea! Thank you! Remarks: 1) for the second transistor use a NMOS --> no big capacitors needed 2) use a resistor from basis to ground for the first transistor - helps against leakage current 3) If the battery voltage is more than 15V ... 20V, most of the PMOS don't like this and go to the semiconductor heaven.
re pt 2 - i had issues with the filter cap of the downstream circuit bleeding back through Q1 turning it back on. A 680k resistor as suggested solved this
Loved it ! I had to pause for like 5-10 min when he showed the circuit, trying to simulate the thing in my head, and was able to do it :) Learned a lot from this, thx.
Important: if you have a capacitor on the output, the comportment becomes erratic. It will not latch off anymore (will turn off only while switch is closed), and oscillation becomes unbalanced.
I paused the video at near the beginning, and I tried to make a own solution to this, and I came up with the EXACT same solution you did! LOL (I just used 1K resistors in LTspice instead of 100K and 1M ones.)
Power Max While the NPN transistors are ON, you'll be drawing 100x more current through both of your 1K resistors than if you used 100K resistors, stressing them more. For production, you'd probably want higher reliability, thus higher resistor values.
downthetube within Well it was a simulation, I often use the 2N2222 transistor in LTspice in such a way it ends up dissipating many hundred watts. Not an issue! I often use TO220 transistors when prototyping stuff, as they are more difficult to destroy. However the disadvantage is that more base current is necessary for bias the transistor, and consequently I will end up using low value pullups for the bases. For small signal transistors and darlingtons and stuff, you are correct.
Thanks - I was just mentioning some obvious improvements as a design philosophy. Guess I'd have to look up datasheet for 2N3904 to see how much margin is left when increasing from 1K's or decreasing from 100K's. Another issue is power budget or allotment on the input power form. Of course, how one makes these compromises and reiterations in design are largely dictated by an overall product specification, implementation, schedule, budget, and all the "ilities". The video is a fun, nicely explainable circuit. cheers!
Bob IS my uncle. First time I heard you say that it kind of freaked me out. I had never heard that phrase until I started watching your AMAZING videos. Thank you for all the great information and for the care you take in presenting it.
I tried the circuit @04:00 with BJTs, but without the buttons. On 'out' I had a resistor followed by a lit LED. In theory it was supposed to be off. Apparently, there's a thing called 'transistor leakage'. It means even when a transistor is in cut-off state, some current might still go through (micro-Amps in magnitude, I guess it varies among the different types). I suppose it could be ignored if applied to load, but when it's connected to a base of another transistor - it gets amplified, then it feeds the first transistor and we end up with fully activated circuit. I hope this comment will save people about half a day of puzzled head scratching. In the end it was fun to find that out, probably I should have added a "Spoiler alert" in the beginning :)
Thank you very much Dave for that fantastic video! :) You are a very good teacher. Thank you for doing the EEVblog channel. I enjoy watching it and often find it quite enlightening.
And here I was trying to find a reasonable price for a switch that could handle 200 mA and wasn't momentary... I should ask for them to rescind my degree for the amount of time I've spent on this! It's almost like I could've saved precious time by watching every video from this channel! Beauty!
The bad thing is that the FET is ON after plug-in. Who want to have circuit activated after plug-in? If then you do not need this circuit at all. I think if you add BE resistor to the transistor on the left should solve the plug-in problem. The voltage at the resistor should be lower than 0,5 V assuming the leak current from FET. As it was explained by Trunov Michael bellow.
I quite liked the circuit at www.mosaic-industries.com/embedded-systems/microcontroller-projects/electronic-circuits/push-button-switch-turn-on/latching-toggle-power-switch - see figure 3. two MOSFETS, 3 resistors and a cap.
Just here for a bit of nostaligia for when Dave's videos were actually about circuits! Now they're all mail bags and teardowns, like every other channel :(
So instead of using an on/off switch, add 6 more components to an on/off switch and you now have an on/off switch! Did he really say "Half a bee's dick?"
IvanIvan1974 he means the point of this is that its cheaper to implement because it means you don't need a beefy switch and can use an elcheapo switch without blowing it up :) if you were just joking it didn't work, this is text its hard to tell so you should expect those reactions from people :)
megaspeed2v2 I don`t even know if he wrote to me. His reply is not directed to me. BTW, I use switch system like this too, I implement it a little bit in a different way but actually it`s quite similar. (without Christmas illumination)
This was an *excellent* video, I appreciate you taking the time to explain the how and why in so much detail, as well as giving us the opportunity to ponder some of it on our own. Have you considered teaching as an occupation? You have a knack for it. Tap away!
Uh. This doesn't start up in the on state. The gate of the *P*-MOS is pulled up and the transistor that pulls it down has no base current before you press the switch.
I'm disappointed. I'll just take the liberty to throw the jellybean rule out of the window based on economy and employ a CMOS divider/counter. Then just one resistor, one cap (those just to smooth out the button input) and an output transistor and Bob's your uncle! No blinking, no residual current (which you forgot to fix in your design), an option to make several ON modes in sequence... and the price will be the same!
Sounds interesting! I know nothing about that kind of circuitry (sounds like logic!). Please make a video on a design concept and give us a walk through! Especially of the power-on sequence capability. Then throw a couple part numbers in there so novice people can get up and running! It'd be great!
Luke Wren Also, I doubt his CMOS chip has as tiny standby current as the circuit in the video. Video circuit standby is dominated by C-E leakage in the left BJT.
@@johnfrancisdoe1563 that's true! I have one major problem with Dave's circuit though, which is its sensitivity to bleed time of the system load. Large output capacitance and small load -> 2N3904 becomes biased again and doesn't switch off. I think any circuit where you try and be clever and use system load as a switching element can have this issue. My current favourite circuit involves a latch built from a dual inverter IC, e.g. 74LVC2G04. They cost around the same as a small-signal transistor, leak around 4 uA, and give you clean switching every time. I think the lesson might be "if you want a latch, build a latch" :)
this video is so good. i already made the circuit years ago. and today i was in the need for something like that and remember it. i don't have any toggle switch at hand but plenty of transistors, resistors etc.
Bread Board Success: I built Dave's circuit and it worked. Things to note: - I used a 5Vsupply. - I used an IRF9Z24N P-MFET. - I used a 47uF e-cap. Dave spec'd 22uF, but actually used a 47uF on his board. I like the button press timing of the 47uF better. - I used a red, SMD LED with a 1K resistor, for the load. - Dave's circuit starts in an on state, when power is first applied. To me, this is a problem. Say this is on a stereo and the power goes off/on in the night. The stereo is going to startle you awake . However, for whatever reason, mine does not start in the on state. Lot's of fun, Mr. Dave = Thanks!
Is there an auto dislike bot on RU-vid because every one of your videos has roughly the same amount of dislike and it's almost every channel on RU-vid all having about 30-100 dislikes so wtf???
Jeremiah Lowe There is a core group of people who thumbs down all my videos, some within minutes of uploading. They haven't even watched it yet. I don't know about other channels, but I have a core group of haters!
Almost all videos have approx. 1% downvotes. That's the "standard". Less downvotes than that is either a video on a small channel or what you could call "exceptionally" good. A higher percentage means you either said something controversial or just too much stupid/boring stuff.
EEVblog You're pretty harsh sometimes and some people really don't like that. Me on the other hand I would give thumps up for the sole reason of being able to speak clearly even if it means to bash people who deserve it. Well that is if I could get myself to use the (dis)likes buttons at all. I believe they are made for immature people who actually beleive quality derives from how many likes one gets. Even though enormous amount of proof points in the opposite direction, stupid people (which includes most of the human kind) still cling to the lie. You are doing a great job teaching electronics and I hope it is enough money for you to keep on making videos until death. If it was something I would like to see more of it would be rf. Maybe even a simple DIY spectrum analyzer just to crack the nut about it being so hard. You are a great teacher and you would know how to make so called hard stuff simple to understand. Against, I really appreciate your videos.
I'm in need of a latching circuit like this, and I was about to use a J-K Flip Flop to do the job, but that would require a debouncing circuit with a schmitt trigger. This circuit looks neat, and it just might work great for my application. Thanks Dave!
Great explanation and walk through, very solid final circuit! Thanks! I ended up using a DMG3415U, which you can put a couple of amps through at RDS(on) of ~40mohms, and still about the same RDS(on) as the IRF9110 at small loads. Definitely still taking recommendations though if you have a better one - there are a ton of P-Fets out there to try and compare.
Dear EEVBlog, Thank you very much for your lovely video on Latching. I am doing a small project on controlling small out put (max 20mA 5VDC) with 02 source of separated Inputs as following: 1. Input 1 (Vin1) of about 4.0 V at HIGH and 0 V at LOW (maintained continuously until the switch is off) 2. Input 2 (Vin2) of about 4.96V at HIGH and 0.3 V at LOW (maintained continuously until the switch is off) What I want to do is: 1. Upon Input 1 turn on High or Low the Output will toggle its state; 2. Upon Input 2 on turning HIGH/LOW the Output will toggle it's state as well. I don not care on the state of the out put is HIGH or LOW but I do care about changing the state of each input, the Output state will toggle ON/OFF respectively. This case is similar to controlling of staircase lamp with 2 two-way switches. I hope you would not mind taking sometime to advice me with thanks.
Did not have that P channel Mosfet you used. I had IRF5210 so used that. Worked like a charm first try! Thanks for sharing. You are just amazing. Although I will modify this and using this as an oscillator. I like the wave form coming out of it. A very neat square wave.
Thank you just what I needed, very informative and well explained. I was building a portable lithium battery charger with one tactile switch. Best solution by far, but still there are caveats like with everything, Mosfet threshHold, if it reached maybe 2.6v lets say, and you have a battery that went down but has a lot current power, and your load is heavy. The mosfet might get really hot because it does not like to be in saturated voltage levels, it needs proper 5v and 0v or negative to turn on or off, thus my thoughts of using a separate power supply to turn on or off the power Mosfet once turned on.. Just need to modify your circuit detect if button is pressed or not with micro-controller, in case I need one switch to do many functions, like two fast taps to enable debugging mode or etc. Nice vids, keep up the good work!
You were right, leave it to us to play with the value of resistors. You made me spent hours playing with it and trying to make it as good as I can. Finally I managed it, my main goal was not to turn on again when I turn it off if for any reason I keep the button pressed. So brief press to turn on and brief or not brief press for turning off.
Thank you so much for this. I have been wondering how to do this since I was really little (im 14 now) and this was great info. Everybody that I asked said to use a microcontroller, but this is the first simple solution that ive seen and works great!!!!!!!!!!!
The one thing I don't like about this is that it defaults to ON whenever power is first applied. I'm interested in this sort of circuit for a couple automotive ideas I have, like being able to turn cargo lights on/off from either the cab or the cargo area independently. The idea being that momentary switches in parallel in the separate locations could toggle the state of the circuit. Obviously I don't want cargo lights turning on every time I start the vehicle and I also don't necessarily want them wired always-hot. But your presentation style made it fairly simple for an electrical dunce like myself to follow the logic of the circuit. Thanks for that.
I found this circuit to work best driving a relay, it worked very good for that, and you can switch high current supplies with very little trouble this way.
I have been looking for this kind of circuit for ages. Whats great is, now I also understand why it works the way it does. Since I'm new to circuitry this instructional has been the pretty insightful. Not that it's that it's going to deter me from watching, but I find that typical Australian way of describing things by dipping the voice slightly distracting, and had to go back a few times to regather. I'm sure I will get used to it soon enough though. Thanks for the vid.
Love these concept videos - one of the most precious resources on the internet. Question: Would a voltage divider at the base of the 2nd BJT let you use smaller capacitor values?
This video is awesome, could you do one on a switch bounce circuit? I used to have a plethora of circuit notes and seemed to have lost the majority of them, This tutorial is way better than any other notes I've ever taken. Thanks Dave!!!! PS I watched a commercial for you...