Does anyone know how I can use a push button like an on off switch in hardware

No code, i need to do this in hardware only. I cannot find this anywhere on the internet or even my radio shack little electronics kit book. Its like the simplest thing because all kinds of devices use em but they usually use code because of a microcontroller, on my project It would be to expensive for a micro and all the other stuff, plus im limited on space and doing through hole at the moment, been trying to breadboard this out and nothing is working, the only way ive gotten it to work is with a 555 timer, but ive been told it has a bad parasitic draw so a 9v battery wouldnt last long running 5-10 LEDs.

If anyone can help me out id be very appreciative. Thank you guys.

BTW i did search the forums the best I could

You need to buy a switch that does this. Like this one.

Use a button with a maintained contact instead of a momentary contact.

You need to buy a switch that does this. Like this one.

From the product page for that switch:

This is a really satisfying switch.

Wow! So many words, so little information! :astonished:

As said so often here, this:


is not suitable for powering Arduino projects. Use a six cell AA battery carrier such as this:

I think what you want is this:

D flip-flop (CD4013)
If you’re just using a p.b. for a clock then configure a D flip-flop as Divide-by-2
If you’re trying to turn another circuit on/off (i.e. toggle it) then add a transistor to the f/2 output to actuate a relay.

runaway_pancake:
D flip-flop (CD4013)
If you're just using a p.b. for a clock then configure a D flip-flop as Divide-by-2
If you're trying to turn another circuit on/off (i.e. toggle it) then add a transistor to the f/2 output to actuate a relay.

yeah, thats what i was talking about, do you have an example diagram or anything?

By the way the latching buttons are too expensive to put in each one once I get this set up since im probably not selling any thing i make, basically light up bracelets or name tag, or a necklace ect.. thats why im trying to keep it compact not use a micro and ill probably end up powering it with a lithium ion battery or something im just talking using a 9v for now

OK, well, while the flip-flop (D, or J-K, various options) sounds clever, there are problems. The first one is "de-bounce". While with a pushbutton connected to a LED, it may seem that the LED simply follows the pushbutton (and indeed it does), what is actually happening is that as you press the button, it intermittently makes and breaks contact many times before it settles and if you feed that to a flip-flop, it dutifully counts each of these contacts and - as per the diagram - divides by two so that whether the circuit ends up switched on or off depends on just how many times the contact bounces - odd or even.

So you need to provide additional circuitry to deal with this. And you require a pull-up resistor for the button.

Secondly, your flip-flop cannot output enough current to operate your other devices and multiple LEDs. So you need one or more switching transistors or FETs. More components!

If however, you use a microcontroller to do the whole function including your flashing, it can be put into sleep mode drawing very little current indeed, use its internal clock so you need no extra clock components, use its internal pull-up for the button input, so you end up with the microcontroller, a button, LEDs and the resistors for the LEDs. You win on the space aspect, and keep the component count right down.

That is why everyone uses microcontrollers!

I suggest you google toggle pushbutton. I found a number of candidates with that search.

JohnRob:
I suggest you google toggle pushbutton. I found a number of candidates with that search.

I already suggested that, but it turns out he does not want one.

Quick googling reveals some on-off controller chips: On-Off Controllers - STMicroelectronics

There’s an example of this in the Arduino playground - partvof this site

Most of those commercial devices that do this actually have a microcontroller in a power-down-sleep state, woken by the switch button press, and debounced in software. There also exist dedicated ICs that turn momentary push into on/off and draw incredibly small amount of power when not in use.