The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Push ON/Push OFF with a momentary switch

Im looking for a circuit, simple if possible, to use a momentary switch for a Push ON/Push OFF use.
Steve_y78

Posts: 8
Joined: Thu Jan 03, 2013 12:04 am

Re: Push ON/Push OFF with a momentary switch

forgot to mention... This would be for a 12v system
Steve_y78

Posts: 8
Joined: Thu Jan 03, 2013 12:04 am

Re: Push ON/Push OFF with a momentary switch

There are switches that act that way. That would be a simple circuit: 1 switch! They are a little hard to search for since no one seems to agree what that switch function is called. You didn't give all the specs on your load but here is one switch I found:

http://www.digikey.com/product-search/e ... 09?k=7104d
Zener

Posts: 2452
Joined: Sat Feb 21, 2009 1:38 am

Re: Push ON/Push OFF with a momentary switch

Here's a circuit I use:

It requires Schmitt trigger inverters, but works well.

The two inverters are arranged as a flip flop. Each one's output connects to the other one's input, and the signal gets inverted twice as it goes around the loop. Each inverter holds the other in its current state.

When the switch is open, the cap charges to whatever voltage is at the output of the upper inverter. When you close the switch, that voltage gets shorted to the upper inverter's input. By definition, that voltage will be the opposite of what was at the upper inverter's input before the switch closed, so closing the switch moves the flip flop to the opposite state.

It's kind of hard to see from the diagram, but when you close the switch, the two 1M resistors form a voltage divider between the outputs of the inverters. No matter which state the flip flop is in, the voltage at the center of that divider will be VCC/2. As long as you hold the switch closed, the cap's voltage will move toward VCC/2.

VCC/2 falls in a Schmitt inverter's hysteresis band, so holding the cap at that level doesn't do anything to the flip flop. When you release the switch, the cap will charge the rest of the way to the upper inverter's output voltage, and the whole thing will be ready to happen again.

Not only does the circuit toggle the output between HIGH and LOW each time you press the button, it also debounces the switch. The make-and-break connections of switch noise only happen while the cap is charging toward VCC/2, and the Schmitt triggers ignore everything that happens during that time.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

Posts: 8531
Joined: Thu Feb 11, 2010 1:51 pm

Re: Push ON/Push OFF with a momentary switch

While it's always great to examine all alternatives, simple is better, so I vote for the "push-on, push-off" switch.

Just for the sake of learning, however...

I would like to point out that the published Schmidt Trigger inverter circuit has a potentially problematic characteristic, depending on the OP's system. Such a circuit will wake up in an indeterminate state when power is first applied. With discrete logic circuits, a POR (power-on reset) circuit, usually in the form of an RC differentiator, is used to apply a momentary pulse to a logic gate input in order to ensure this doesn't happen.

An enhanced version of your circuit can be made using a 74LS132 chip, which is a quad 2-input NOR gate with Schmitt trigger inputs. The extra input gives you the flexibility to add a POR differentiator. If interest is there, I will post a circuit, but I don't have time right this second.

In any case, have fun with your project!
EasternStarGeek

Posts: 309
Joined: Mon Dec 13, 2010 12:39 pm
Location: Upper Eastern Tennessee

Re: Push ON/Push OFF with a momentary switch

While it's always great to examine all alternatives, simple is better, so I vote for the "push-on, push-off" switch.

Just for the sake of learning, however...

I would like to point out that the published Schmidt Trigger inverter circuit has a potentially problematic characteristic, depending on the OP's system. Such a circuit will wake up in an indeterminate state when power is first applied. With discrete logic circuits, a POR (power-on reset) circuit, usually in the form of an RC differentiator, is used to apply a momentary pulse to a logic gate input in order to ensure this doesn't happen.

An enhanced version of your circuit can be made using a 74LS132 chip, which is a quad 2-input NOR gate with Schmitt trigger inputs. The extra input gives you the flexibility to add a POR differentiator. If interest is there, I will post a circuit, but I don't have time right this second.

In any case, have fun with your project!

Interest is peaked. would like to see that when you get the chance.
Steve_y78

Posts: 8
Joined: Thu Jan 03, 2013 12:04 am