Instructables

Use a Momentary or Tactile Switch as a Pushbutton Switch.

Picture of Use a Momentary or Tactile Switch as a Pushbutton Switch.
Just a Moment
Tactile switches (a specific type of momentary switch) are everywhere and they are especially popular on DIY  electronics and microcontroller boards because they are well suited to act as a boot option or reset switch.  Particularly, momentary switches are switches that don't save their state when you depress the switch.  That is, when you push the switch (and while you have the switch depressed) the circuit is ON, but once you let off the switch it reverts back to OFF.


In this micro-instructable, I will show you how to convert those ubiquitous tactile and general momentary switches into pushbutton switches that toggle and save their state.  It's very easy and extremely straight forward so you can implement it immediately in your designs if you're interested in doing so.
 
Remove these adsRemove these ads by Signing Up

Step 1: Get Yer Switches

Picture of Get Yer Switches
The most obvious part of the necessary components is a momentary switch.  Go grab one, or two, or a handful if you're OCD and can't decide.  There are lots of different kinds of momentary switches from panel switches, to PCB tactile switches, to toggle momentary switches.  I have collected several different kinds in the picture below. 

In this instructable, I'm going to use tactile switches.  There's just something wholly satisfying about the force required to activate the switch and the crisp *click* you get is quite rewarding.  Feel free to use whatever switches you have around.  If you haven't scoped the video, check it out now.  I have setup two tactile switches. One in a normal configuration with an LED and requisite resistor on the high side, and then driving to ground on the other.  It does what you would expect when you press the button: the nice little blue LED comes on and stays on for as long as you hold the switch down, then immediately goes off when the switch is depressed.

The second switch is attached to a MC14027 J-K flip-flop IC, as well as having two LED's attached to the flip-flops.  Turn the page and learn about flip-flops!

lysergd12 days ago

Hey can anyone help I'm trying to make a simple on on off circuit using 1 small button what I need is first click led1 on second click led1 off led2 on third click led2 off please help :) Thanks.

matys2922 months ago

Hello i got chip HCF4027BE. When i connect it like your circuit only 1 led is ON. When i push button it doesn't work. It's possible that pins of chips are on sorted otherway? That's datasheet of my chip: http://pdf.datasheetarchive.com/datasheetsmain/Databooks-4/Book615-2788.pdf

diywannaber3 months ago

Wouldn't it be simpler and cheaper to just use a push button switch that locks on to the state instead of a momentary one and then the whole flip flop implemented using an IC.

nevdull (author)  diywannaber3 months ago
hi,
You ask would it be simpler? Yes, most definitely an integrated solution would be simpler. Cheaper? I'm not sure. Switches can be quite expensive. Your mileage may vary.
Cheers!
w4op10 months ago

Will this circuit always start up in the OFF state when power is first applied- or can it be modified to do so- perhaps with an R-C on the SET input?

Thanks,

Dale

tpark411 months ago

Hey, I know this is an old guide, but I found it very useful, took the idea and made a push-button 4 mode switcher for an RGB LED! But now that all my logic is done, I found that my flip-flop is only rated for 2mA at 5V, when my LED can pull up to 70mA! Should I use a transistor to use the flip flop output to switch a larger power supply, or should I find a more heavy duty flip flop? Please help me out!

anglin1 year ago
hi a newbee here , how do i open the files
nevdull (author)  anglin1 year ago
Hi. The schematic and board file were created in Eagle CAD, so you'll need that to open/edit them. There is a free version you can use. Just google 'eagle cad' for the download.
ElPablo1 year ago
Thank you so much for this circuit. I've been looking for examples of using the 4027 but they've been hard to find. I do have one question though... If I connect LED2 the way it's shown in the schematic it doesn't work as expected... if I reverse the polarity and connect it just like LED1 (Pin 2 -> 1K Resistor -> LED2 -> GND) it works perfectly .
Now I suspect that I may have messed something else up since I new to this but I've double-checked and everything else seems to be ok. Any ideas?
nevdull (author)  ElPablo1 year ago
Hi! Thanks for the kind words. About your problem....hmmm, that is odd. It ostensibly shouldn't be able to work since Q and !Q are orthogonal and complementary (that is, when one is sourcing the other is sinking). Could you possibly have your LED2 connected into the *other* Q output of the second J-K flipflop on the IC?
pletchman2 years ago
Question. I've found some really nice momentary switches but wanted to know if they can be used for my needs. Basically I am looking for an On-On-Off switch. I have a drawer with low level LED lighting and full LED lighting. I want to be able to have a single button that if pressed once turns on the red LEDS -- press it again it turns on the white LEDs (thereby also turning off red LEDs) -- press it again and both sets of LEDs are turned off. How do I accomplish this the most easily? I've found basic little ON-ON-OFF switches but like some of the nicer illuminated momentary switches. Thanks in advance for your expertise
nevdull (author)  pletchman2 years ago
I'm not sure how you wold do this with an "on-on-off" switch as I've never seen those before. One possible option could be using a momentary switch connected to a counter IC (say, a 4017 decade counter) with the appropriate string of LEDs connected to the appropriate output of the counter. With each clock transition (ie button press) the outputs will go high in sequence.

Just a thought.

Good luck!
dailodai783 years ago
HI, I've always wanted to make a pushbutton switch from a tactile switch but I don't know anything about the IC circuits. I'm a bit clueless when it comes that. If possible, can you upload a better picture of the wiring diagram and explain what you used in creating the pushbutton circuit (besides the tactile switches and LED lights)?
EZELab3 years ago
Thanks for this circuit, could you explain how to connect a 5V relay ?
nevdull (author)  EZELab3 years ago
Just hook the output of the flip-flop into the trigger lead of the relay and connect your relay's other side to whatever you're wanting to control in the normal way you would any relay. Make sure your relay's excitory level (the voltage level that triggers the relay) works for the level of voltage you're pushing out of your flip-flop.
EZELab nevdull3 years ago
The out put is very low, cant i connect a transistor or something to the out put that pass the ( - ) to the relay, and the other relay pin to ( + ). like the circuit i attached, this one i found on the internet, buy never worked for me !
Yours worked perfect ! but just missing the relay connection :)

I Think we need a good transistor that just passes the negative to the relay !
LED ON OFF 4027--.PNG
nevdull (author)  EZELab3 years ago
Maybe put the relay where the LED would be in your schematic and run the output into the base of the transistor. Maybe that would work for you?
verdastel4 years ago
This is a very useful instructable, thanks a lot for sharing!
nevdull (author)  verdastel4 years ago
Thanks a lot!
xVirus4 years ago
can I put a relay instead of a led
nevdull (author)  xVirus4 years ago
yep you sure can, just ensure the excitory level on the relay works with your Vcc.
jeff-o4 years ago
Fantastic info! In a situation where you aren't using a microcontroller, this is just the thing for implementing a non-momentary switch.
nevdull (author)  jeff-o4 years ago
Thanks jeff-o! I appreciate the kind words!