Press same button 3 times to on an led

Thread Starter

MrsssSu

Joined Sep 28, 2021
266
Dear all, I am looking for a circuit that can on an led by pressing the same button for 3 times?





Thank you for reading and have a nice day:)
 

MrSalts

Joined Apr 2, 2020
2,767
Dear all, I am looking for a circuit that can on an led by pressing the same button for 3 times?





Thank you for reading and have a nice day:)
Doing this with a counter and an AND gate will be one option. A fourth press will turn it off. Then three more presses will turn it on.

Or, you can use a decade counter (CD4017) and connect reset to the Q4 output. Connect your LED to output Q0 (with a resistor in series. You'll need to debounce your switch, obviously.
 

Ed

Joined Sep 1, 2021
15
Probably overkill, but...
If you use a tiny arduino-like board (they're ridiculously cheap&small now), then the firmware can do the debouncing and also deal with the timing of the button. For example... if the button is depressed less than 3x what do you do? Should that time out if all three button presses don't occur within some window of time?
 

Ya’akov

Joined Jan 27, 2019
9,131
Probably overkill, but...
If you use a tiny arduino-like board (they're ridiculously cheap&small now), then the firmware can do the debouncing and also deal with the timing of the button. For example... if the button is depressed less than 3x what do you do? Should that time out if all three button presses don't occur within some window of time?
Welcome to AAC.

The ATTinyXX (85, 13, etc.) would be.a great solution if the person was already programming MCUs for some other reason. But in this case it introduces complexity that is probably not worth dealing with.

If the TS is already using Arduino tools, it’s certainly worth considering but I would probably not use a development board and instead just program the MCU itself and put it on a small board for the project.
 

BobTPH

Joined Jun 5, 2013
8,938
What happens if you press it two times, then wait an hour and press it a third time?

How do you turn it off?
 

MrChips

Joined Oct 2, 2009
30,794
What happens if you press it two times, then wait an hour and press it a third time?

How do you turn it off?
Exactly. Has the TS thoroughly worked through all the possible scenarios?
In other words, what are the complete specifications?
 

Thread Starter

MrsssSu

Joined Sep 28, 2021
266
What happens if you press it two times, then wait an hour and press it a third time?

How do you turn it off?
Hi sir, thanks for replying. Well, I think CD4017 or CD4022 Johnson counter with some logic gates are good for my case. And after the led lights up, I can just reset everything by disconnect and reconnect power supply, thus, it should be working properly for the next cycle :)
 

BobTPH

Joined Jun 5, 2013
8,938
Hi sir, thanks for replying. Well, I think CD4017 or CD4022 Johnson counter with some logic gates are good for my case. And after the led lights up, I can just reset everything by disconnect and reconnect power supply, thus, it should be working properly for the next cycle :)
How does that answer my first question?

And what happens with a fourth press?
 

WBahn

Joined Mar 31, 2012
30,045
Hi sir, thanks for replying. Well, I think CD4017 or CD4022 Johnson counter with some logic gates are good for my case. And after the led lights up, I can just reset everything by disconnect and reconnect power supply, thus, it should be working properly for the next cycle :)
This means that you need to have a suitable power-on reset to ensure that everything starts up the way you want it to.

Also, be sure that you properly debounce your switches, otherwise the first switch may be seen by your circuit as about a dozen pushes.
 
Top