ON/OFF Switch with 2 momentary push buttons (1st ON, 2nd OFF) - Page 1
Forum section: electronics / beginners

author: bluevd
author_rank: Contributor
timestamp: April 03, 2015, 08:43:37 pm
content: Hello folks,To keep is short and concise:I'm trying to build a switch to drive a mosfet with 2 momentary buttons (1st button ON, 2nd OFF). I've got to a thyristor configuration using 2 transistors, but here's where it gets difficult for me (EE level: noob).The switch is design to drive a motor (via a mosfet). The OFF button is actuated mechanically by the motor shaft. The problem is that I want the switch to be in OFF state once the 2nd button is pushed indifferently of the 1st switch state. That is, if the user keeps it pressed, once the 2nd switch is triggered, the circuit would not re-engage until the user depresses the ON switch and presses it again. My goal is to build it without the use of any IC (I want to use only passive elements). The thyristor configuration would normally work, but the motor inertia actuates the OFF switch and releases it (thus if the ON switch is still pressed, the motor keeps on spinning).Any simple schematic will do (even without the explanation, I'll go step by step to figure it out and thus maybe learn a few things).Thanks!

author: Ian.M
author_rank: Super Contributor
timestamp: April 03, 2015, 08:59:47 pm
content: Capacitively couple the switches so they must be released to let the capacitor recharge/discharge through a resistor before they can deliver another pulse to the bistable or thyristor. Make sure the capacitors are big enough for reliable triggering . . .

author: janoc
author_rank: Super Contributor
timestamp: April 03, 2015, 09:25:26 pm
content: I have just found exactly this sort of circuit in a small solar powered controller for a garden pond pump.I am sorry for the messy schematics, this is a small part copied from a larger circuit, reverse engineered directly from the PCB. I didn't really clean it up as I am not done with the board yet. The transistors are some Chinese jellybean parts, in this case they are rated up to 1.5A collector current, but they are not really critical - size them depending on your needs. The battery voltage is around 6V (6V sealed lead acid battery).Basically pushing the SW1 turns on the Q2 transistor, which turns on Q1 too. Q1 "shorts" the SW1, keeping the entire thing latched on. Pushing SW2 forces Q1 to close by grounding its base, thus Q2 closes too and the load goes off.EDIT:I have realized only later that the objective was to make the load stop regardless of whether or not the user holds the start button down. The circuit above won't do that as-is. The simplest method is to add a normally close (NC) push button in series with the R6 resistor and remove the original OFF switch. Then when the new switch is triggered, the circuit will turn off, no matter whether the ON button is held down or not.If you want to use a MOSFET for switching the load, you can either replace the Q2 with a P-channel one or use Q2 to drive a MOSFET - e.g. by putting a resistor to ground in the collector of Q2 and using the voltage drop on this resistor to drive a gate of an N-channel FET.Disclaimer: This is a reverse engineered circuit, I haven't tried to build it. There could be mistakes in the schematics. YMMV.Dave has an excellent video on a similar circuit too:http://www.eevblog.com/2012/03/30/eevblog-262-worlds-simplest-soft-latching-power-switch-circuit/

author: SL4P
author_rank: Super Contributor
timestamp: April 03, 2015, 10:21:33 pm
content: A simple relay, using one contact pair to latch the coil voltage.One NO momentary PB to 'turn on'An NC contact to release the relay at the end point of the motor.No other parts.

author: JesusCB
author_rank: Contributor
timestamp: April 04, 2015, 11:06:51 pm
content: Last semester I did something like that with an arduino, but there are other ways to do it like SL4P said.

author: cosmicray
author_rank: Frequent Contributor
timestamp: April 04, 2015, 11:08:55 pm
content: Quote from: SL4P on April 03, 2015, 10:21:33 pmA 2-coil latching relay would also do that. One switch/coil to latch, one to unlatch.

author: bluevd
author_rank: Contributor
timestamp: April 06, 2015, 01:55:33 pm
content: Quote from: Ian.M on April 03, 2015, 08:59:47 pmThanks Ian,Best answer I could have gotten! I ended up learning a few things while researching your idea.I've attached a rough schema of the circuit (most values will need to be calculated properly based on the transistors). The 2 switches that are highlighted in red will be replaced with a 2 way momentary switch. If you guys see anything wrong with this design please let me know.

author: Kjelt
author_rank: Super Contributor
timestamp: April 06, 2015, 06:23:16 pm
content: Have a look at eevblog 262 for some ideas, dave also mentions very briefly your situation.

author: janoc
author_rank: Super Contributor
timestamp: April 06, 2015, 06:26:18 pm
content: I don't think this will work as you want - if those two switches in the upper left corner are both on, the capacitor is bypassed and the circuit will be constantly on, no matter what you do with the OFF switch.Put a normally closed switch in series, e.g. between the base of the PNP transistor and the base resistor, and drop the capacitor - in that way when you push this switch, it will break the base current to the transistor and the circuit will go off, regardless of the state of the ON switch.

author: bluevd
author_rank: Contributor
timestamp: April 07, 2015, 10:13:32 pm
content: Quote from: janoc on April 06, 2015, 06:26:18 pmHello Janoc,While this would be the simplest solution, the problem is that for my specific application it does not work (not do the relay solutions posted above). Here's why:The circuit is used to power on and off a motor via a mosfet/relay/etc. The motor itself is used in a gearbox with the end gear pulling a spring based mechanism. Also, the end gear has a rigid leaver to engage the off switch once a full turn is complete. The load on the end gear is released mechanically right before the engagement of the off switch. Because of this release, the gear gathers quite the momentum, and, once the off switch is triggered, it will still rotate a bit (causing the off switch to bounce back to depressed state).The purpose of the circuit is to ensure that one cycle is complete per each engagement of the on switch. The switch I mention above is a SPDT - ON-MON (but because I was using and online program to draw the diagram I represented it via 2 switches).

author: Annakin4
author_rank: Contributor
timestamp: April 08, 2015, 12:14:29 pm
content: I agree with the relay idea, that would be the simplest route

author: Grapsus
author_rank: Regular Contributor
timestamp: April 08, 2015, 12:25:49 pm
content: What is the load to be switched ? Relay contacts tend to bounce before making and it might be a problem. Also for capacitive loads a relay might produce a huge inrush current whereas a transistor activation can be smoothed if necessary.

author: Annakin4
author_rank: Contributor
timestamp: April 08, 2015, 01:05:35 pm
content: Can't you use both a capacitor and a inductor to help make the relay smooth and less harsh?

author: janoc
author_rank: Super Contributor
timestamp: April 08, 2015, 09:25:16 pm
content: Quote from: bluevd on April 07, 2015, 10:13:32 pmRight. So if I understood correctly, your mechanism "bounces" and you want to ensure that no matter what mechanical oscillations it does, it stays off, even though the ON switch could be still held.One thing you can do is to add an R-C circuit to make the ON switch produce only an impulse when it is pressed down. Holding it will not generate any more impulses. Then the bouncing of the off switch won't really matter. I believe this was actually suggested by someone already.If you need something more robust, then I would likely build this using a micro and a simple state machine to ensure that all the constraints are met. Doing the interlocking in just discrete parts is going to be a PITA.Quote from: bluevd on April 07, 2015, 10:13:32 pmI am a bit confused about the point of the two switches (or two halves of a single switch). What is the purpose of the switch with the 100R resistor in series there? Closing the top left one (the one in series with the cap) will turn the circuit on already. The one with the resistor does nothing if the top left one is open (one pin floating). And if it is closed, the switch with the resistor will just bypass the cap, but that doesn't do anything, because the circuit is on already ...

author: Kjelt
author_rank: Super Contributor
timestamp: April 09, 2015, 07:39:01 am
content: The requirements are getting sillier, the off switch can bounce back ?Well then use an emergency stop actuator on top of the switch.Check out Eaton M22 series of switches and emergency stop switches, like the M22-PV. You need the M22 switch and adapter with it or buy the complete with switches M22-PV/K11.They can not switch back on till the user rotates or for the above mentioned switch pulls back (mechanically) the knob to re-engage it.For motors and safety requirements you given this is almost a must.

author: janoc
author_rank: Super Contributor
timestamp: April 10, 2015, 08:06:56 pm
content: Quote from: Kjelt on April 09, 2015, 07:39:01 amI suspect that he wants to have some sort of endstop switch, not something that the user is actually supposed to actuate. If I understood it right, the user triggers the "ON" switch to cycle the machine and the "OFF" switch is actuated by the mechanism. And the electronics must ensure that the device actually stops when the "OFF" switch is hit, regardless of any bouncing or that the user is holding the "ON" down. Oh and it needs to be able to cycle again when the "ON" is actuated again after stopping.To me this is fairly complex and a job for a state machine. It would be a good challenge to do in discrete parts, but not really economical, IMO. the circuit will be quite complicated, hard to modify and take much more space than a small microcontroller - even an 8 pin ATTiny25 or the PIC10 series ($0.40/piece) can do something like this easily.

author: Kjelt
author_rank: Super Contributor
timestamp: April 10, 2015, 10:28:20 pm
content: A flipflop like the hef4013 costing $0,40 can do this.Make data high and the user on button to clock in.Each press of the button clocks the flipflop to set.Use the off switch on the reset input always overruling even when on button is pressed since the clock is edge triggered and done.But he does not want to use an ic which is bullocks with these requirements.

author: Ian.M
author_rank: Super Contributor
timestamp: April 11, 2015, 02:22:23 am
content: Certainly the easiest option is a low pin count microcontroller.Obviously it can also be done in logic, with two flipflops, one for the motor state and the other to reliably debounce the start button, + a gate or two to remove the stop signal from the motor state flipflop reset pin once its been reset to stopped so that the start (clock in a 1) will actually work, and also to provide a POR signal.However for the hell of it I had a go at doing it with discretes in LTSPICE using an Eccles-Jordan bistable.The crud on the left is the supply + two pulse sequences to provide the switch timing for the simulation. Then there's the actual switches (voltage controlled for simulation only) capacitively coupled to the bistable. On the right is a diode coupled RC reset circuit and a Darlington pair to drive the load.Its incredibly fussy about component values. e.g. if the bistable coupling resistors and trigger coupling capacitors have the wrong ratio of values, it doesn't trigger, and if the pullup resistors that recharge the coupling capacitors are too small it false triggers with the opposite action when the switches open. I certainly wouldn't want to build it for real life use!I've attached the LTspice file if anyone else wants to play with it.(strip the .txt extension)

author: janoc
author_rank: Super Contributor
timestamp: April 12, 2015, 01:18:57 pm
content: It could probably be done with a few 555 timers too