Are there buttons that don't require debouncing in software?

Hi,

I got an application where the button press needs to be highly reliable, and rather than depending on debouncing in my own code, I wonder if there are off the shelf devices that'll enable the button function without the need for user debouncing code.

Thanks

You can use 2 two input NAND gates and a toggling switch. That produces a glitch free, none bouncing signal.

Look for Hall Effect (keyboard) Switches.

You can use 2 two input NAND gates and a toggling switch. That produces a glitch free, none bouncing signal.

Really? Do you have a schematic? NAND gates are pretty fast so I would expect the bouncing to pass-through. In most applications you don't have to debounce a toggle switch. :wink:

Sometimes (most of the time?) a capacitor will work. But, I think the sure-fire way to do it in hardware is with a capacitor and Schmitt trigger.

In some applications debouncing isn't necessary. For example, if you press a button to start a sequence/process that takes some time (say, you press a button to start your car) then a little bounce doesn't hurt anything. Or if the button-press halts a process or breaks-out of a loop, you don't need to debounce.

DVDdoug:
Really? Do you have a schematic? NAND gates are pretty fast so I would expect the bouncing to pass-through.

Approach #1 here: Switch Debouncing

(Edit to link picture from article)

paulwece:
I got an application where the button press needs to be highly reliable, and rather than depending on debouncing in my own code,

Software debouncing can be as simple as waiting a minimum short interval (say 50 millisecs) between successive reads of the switch.

...R

How to post a picture? I have no URL....

Connect one of the inputs of the NAND to the output of the other NAND. Add pullups to the 2 not connected inputs. Add the switch to the 2 pulled up inputs. Bounce free!

Thanks Delta_G!

Here is the wiring of my none bouncing circuitry, used many times.

Robin2:
Software debouncing can be as simple as waiting a minimum short interval (say 50 millisecs) between successive reads of the switch.

...R

50ms
Yes, this is what I always do, never had to use anything else.

Use a millis() type delay timer to get your 50ms.

@Delta_G
A good site should be intuitive and make it easy to find such a so often used function. Jumping into Google to use Forum... I think it is a bad mark for Forum. Google is often like a library just after an eartquake, a big mess.

However, Your link below was great! Thanks!

paulwece:
I got an application where the button press needs to be highly reliable, and rather than depending on debouncing in my own code, I wonder if there are off the shelf devices that'll enable the button function without the need for user debouncing code.

Why would debouncing in software be less reliable than in hardware?

Pieter

There are a few debounce chips -sorry forgot the numbers - most if not all seem to be surface mount - I researched it last year and have misplaced my notes - needing to write special coded for each button really annoys me - the industrial stuff I worked on had the debounce in hardware and it was very nice and easy

Specify what You mean by "higly reliable"!

The interesting thing is, your actually making the system less reliable by using hardware debounce due to more points of failure.

What exactly happens to your application when a button bounce on/off multiple times when pressed?

“The interesting thing is, your actually making the system less reliable by using hardware debounce due to more points of failure.”

The actual percentage is 0.00000000000000000000001% less reliable.

The above percentage makes as much sense as your statement.

Need to establish something important. Someone already mentioned this earlier in the thread, but may have been missed. Many beginners seem to believe "if I have a button, I need to debounce it, or the circuit will not be reliable". In many situations, debouncing is not needed at all and serves no purpose at all. Beginners are often unable to distinguish this. Is this one of those situations? We need more detail from the OP.

Really true. If an action lasting longer then some 50mS is to be started the bounces, retriggers, will not cause any harm. The first trigger starts it all and ought to be reliable.

saildude:
needing to write special coded for each button really annoys me

I don't think that's a good argument. Just create a class for debouncing buttons.
For example: Projects/Arduino/LEDs, Buttons, etc./PushButton-debounce/PushButton-debounce.ino at master · tttapa/Projects · GitHub

I would characterise it like this: does pressing the button always result in the circuit being in the same state "X" afterwards? Or could the button press result in the state being "X" or "Y" or a wider choice of states? If the state after the press is always the same, debouncing is not required.

For example, a circuit where a button marked "on/off" turns on or off a particular function within the circuit. Here, debouncing is required. Pressing the button does not always result in the same state.

But if there are two buttons, one marked "on" and the other marked "off", then no debouncing is required. The "on" button always results in the "on" state, so it does not need debouncing. Same for the "off" button.

Scanning switches every 50ms is more than likely all that’s necessary.

No need to debounce each switch, just wait 50ms.

However, with an input connected to a switch you might want to validate a minimum time.
In environments where there might be pickup from nearby components our input might see a short noise spike.
This can usually be handled by looking for the switch needing to be held for a minimum time period that makes sense, example ~20ms.
It would be a good guess that this situation will never be experienced in a hobby environment.

You would of course need to be careful when safety is concerned such as, starting a 100Hp motor, operating an elevator or turning on an electric fence, ouch ??? .