From: Jasen Betts on

+5v
+-----------------------------+----
| ____|________
+--o_ | |
-_ 11| 74hc595 |
-o--+-------------[| |
| |____________|
+--o === 100nF |
| | |
0v+----------+------------------+


I've been told the left part of the ciecuit is a good way to debounce
a switch but I'm seing on the outputs what appears to be contact bounce.

the the switch is a mini microswitch
there are several 1uF MLCCs across the supply
construction is on solderless breadboard

adding an active debounce using a 555 seems to solve it

can anyone explain what's going on?
From: Rich Grise on
On Tue, 01 Dec 2009 13:23:57 -0600, Tim Wescott wrote:
> On Tue, 01 Dec 2009 10:48:18 +0000, IanM wrote:
>
>> Jasen Betts wrote:
>>> +5v
>>> +-----------------------------+----
>>> | ____|________ +--o_ |
>>> |
>>> -_ 11| 74hc595 |
>>> -o--+-------------[| |
>>> | |____________|
>>> +--o === 100nF |
>>> | | |
>>> 0v+----------+------------------+
>>>
>>>
>>> I've been told the left part of the ciecuit is a good way to debounce a
>>> switch but I'm seing on the outputs what appears to be contact bounce.
>>>
>>> the the switch is a mini microswitch
>>> there are several 1uF MLCCs across the supply construction is on
>>> solderless breadboard
>>>
>>> adding an active debounce using a 555 seems to solve it
>>>
>>> can anyone explain what's going on?
>> Yep. but Jack G. Ganssle does it much better. Read
>> <http://www.ganssle.com/debouncing.pdf>
>> ...
>> Lastly the classic SPDT switch debouncing circuit uses a SR flipflop.
>> Either pick a flipflop with active low set and reset inputs, e.g. 7474
>> and tie all other inputs to their inactive state so the D type function
>> is diabled and you are left with just SR or wire a quad 2 input NAND
>> gate as a flipflop. Either give you two debouncers in one 14 pin chip.
>> The moving contact goes to ground, the fixed contacts go to /S and /R
>> with 1K to 10K pullups to +5V. Guaranteed to toggle cleanly and have
>> good switch life.
>>
>> The *preferred* debouncer for multiple individual buttons however is a
>> Schmitt input buffer, a SPST switch and a R.R-C-R debouncer. (The
>> switch grounds where the . is) which has one more resistor, (between the
>> capacitor and the input) than Ganssle's fig.2 circuit to provide some
>> ESD protection. Gansle recommends a 74xx14 and I see no reason to
>> question that. You get more debounced inputs per chip and can use a
>> wider range of cheaper switches. If you do a lot of breadboarding it
>> would be worth building a set of debounced buttons on veroboard to avoid
>> the hassle of assembling them each time.
>
> Note that if you're feeding a microprocessor you may as well debounce in
> software, unless you just plain like using up board space.

I've done this, and it worked like a champ. It was a raw keyboard with
about 64X spst contacts - wiring the 8X8 matrix was very tedious. I
debounced for about 10 mS, and wrote a 16-key rollover. I was very proud.
I used it on my TV typewriter. :-)

Cheers!
Rich

From: stratus46 on
On Dec 1, 1:36 pm, Rich Grise <richgr...(a)example.net> wrote:
> On Tue, 01 Dec 2009 13:23:57 -0600, Tim Wescott wrote:
> > On Tue, 01 Dec 2009 10:48:18 +0000, IanM wrote:
>
> >> Jasen Betts wrote:
> >>>   +5v
> >>>     +-----------------------------+----
> >>>     |                         ____|________ +--o_                     |
> >>>                |
> >>>          -_                 11| 74hc595    |
> >>>       -o--+-------------[|            |
> >>>           |              |____________|
> >>>     +--o      === 100nF           |
> >>>     |          |                  |
> >>>   0v+----------+------------------+
>
> >>> I've been told the left part of the ciecuit is a good way to debounce a
> >>> switch but I'm seing on the outputs what appears to be contact bounce..
>
> >>> the the switch is a mini microswitch
> >>> there are several 1uF MLCCs across the supply construction is on
> >>> solderless breadboard
>
> >>> adding an active debounce using a 555 seems to solve it
>
> >>> can anyone explain what's going on?
> >> Yep.  but Jack G. Ganssle  does it much better. Read
> >> <http://www.ganssle.com/debouncing.pdf>
> >> ...
> >> Lastly the classic SPDT switch debouncing circuit uses a SR flipflop.
> >> Either pick a flipflop with active low set and reset inputs, e.g. 7474
> >> and tie all other inputs to their inactive state so the D type function
> >> is diabled and you are left with just SR or wire a quad 2 input NAND
> >> gate as a flipflop. Either give you two debouncers in one 14 pin chip.
> >> The moving contact goes to ground,  the fixed contacts go to /S and /R
> >> with 1K to 10K pullups to +5V.  Guaranteed to toggle cleanly and have
> >> good switch life.
>
> >> The *preferred* debouncer for multiple individual buttons however is a
> >> Schmitt input buffer, a SPST switch and a R.R-C-R debouncer.  (The
> >> switch grounds where the . is) which has one more resistor, (between the
> >> capacitor and the input) than Ganssle's fig.2 circuit to provide some
> >> ESD protection.  Gansle recommends a 74xx14 and I see no reason to
> >> question that. You get more debounced inputs per chip and can use a
> >> wider range of cheaper switches. If you do a lot of breadboarding it
> >> would be worth building a set of debounced buttons on veroboard to avoid
> >> the hassle of assembling them each time.
>
> > Note that if you're feeding a microprocessor you may as well debounce in
> > software, unless you just plain like using up board space.
>
> I've done this, and it worked like a champ. It was a raw keyboard with
> about 64X spst contacts - wiring the 8X8 matrix was very tedious. I
> debounced for about 10 mS, and wrote a 16-key rollover. I was very proud.
> I used it on my TV typewriter. :-)
>
> Cheers!
> Rich

Used dual 8x8 matrices on my MIDI pipe organ many years ago with NC /
NO contacts to measure the 'fly time' and derive velocity. It was true
N key rollover. Can't be missing notes in a performance. Contact
debounce was looking for 3 consecutive scans (at 3kHz) of the new
value. Worked very well.


From: Jon Kirwan on
On Tue, 01 Dec 2009 19:45:21 -0800, John Larkin
<jjlarkin(a)highNOTlandTHIStechnologyPART.com> wrote:

><snip>
>If you sample the switch state every, say, 20 milliseconds, and act on
>what you see, there's no need to debounce at all.

I am generally able to tell when, and usually am annoyed by, equipment
sampling that way.

Jon
From: Jon Kirwan on
On Tue, 01 Dec 2009 13:23:57 -0600, Tim Wescott <tim(a)seemywebsite.com>
wrote:

><snip>
>Note that if you're feeding a microprocessor you may as well debounce in
>software, unless you just plain like using up board space.

Just to support this comment, I do this all the time with software and
very successfully. I use 4-8ms sampling periods and a simple state
machine that takes 3 samples to settle. (For hardware, there are
things like the MC14490 hex debouncer.)

I find debounced key events that take longer than 25ms to be annoying
and increasingly so, very quickly. Snappy and consistently responsive
is what I hope and look for.

I haven't studied it, but I would suppose that there are switch
waveforms that would flummox any one specific software algorithm and
where a general, well-designed hardware solution would work more
broadly. Hardware is s-space and software is z-space. (So, if one
knows, a priori, the sampling rate and phase of the software and its
method it may be always possible to draw a seemingly realistic pattern
that will provably screw up the software.) But I've never encountered
a problem that a good software approach doesn't solve well.

Jon