Michael D. Rayman
ray...@uakron.edu
University of Akron, Akron, Ohio
A few assumptions:
The switch can be used reliably with low current levels.
The supply voltage is compatible with CMOS gates.
The switch is connected to the input of a non-inverting CMOS gate (or 2
inverting types in series), and this point is connected to +V through a
100K resistor. The input of the gate is connected to the output through
a 0.1uF or greater capacitor. The other end of the switch is grounded.
When the switch is closed, the gate output goes low, forcing the input
low while the capacitor charges, even if the switch bounces open.
Increase the cap value if the bounce time is long. Once the cap has
charged, it has no further effect, and the closed switch determines the
output state. When the switch is opened, the capacitor begins to charge
through the resistor, and the output stays low during the bounce time.
Once bouncing is done and the capacitor has charged, the output goes hi.
Hope this works for you.
--
Gerry
change "not_here" to "lsb"
<The Studio> http://www3.sympatico.ca/lsb <The Studio>
Charlie
http://www.all-electric.com/debounce.htm
It's designed primerilly for debouncing a momentary switch but would
work equally well for a SPST Toggle switch.
Hope this helps.
Be absolutely Icebox.
--
________ _ _
/ ____|| | // AEK C/o
/ /| |____ | |// 11 Henley Beach Road _-_|\
/ __ ____|| < Henley Beach / \
/ / | |____ | \ \ South Australia 5022 \_.-*_/
/ / |______|| |\ \ v
All Electric Kitchen http://www.all-electric.com
Get AEK's latest CD, Elementary Urban Sanity. Out now. Available from
http://bounce.to/transcom or Thru A different Drum in the US.
For a single pole switch, the historic method is to series the
switch with a 1 or 2K resistor driving an appropriatly sized
capacitor connect to ground. The RC time constant should
approximate 10x the swith bounce rate.
A better method is to latch the switch status on it's first
closure, then AND the switch with a one-shot set to at least
5 times the switch-bound settling time. This prevents multiple
hits from a single switch depression. The down-side of this
is that it requires additional logic.
The best method of all, providing your system has an embedded
micro-processor, is to periodically sample (poll) the switch, then
determine if the switch is open or closed based upon your own
de-bounce criteria.
Hope this helps.
Harry C.
Of course, this nice, slow rise time will upset some digital
inputs and so should be fed into something that expects that
sort of input (e.g., something with hysteresis)
>A better method is to latch the switch status on it's first
>closure, then AND the switch with a one-shot set to at least
Well, if you have a one shot available and aren't looking for the
DC *state* of the switch but, rather, just to detect that it
was *pressed* (for example), just let the switch trigger the
one shot. Set the time constant of a *retriggerable* one
shot to the *period* of the switches bounce frequency. If
it is *non* retriggerable, set it to the maximum bounce time
expected (+ epsilon)
>5 times the switch-bound settling time. This prevents multiple
>hits from a single switch depression. The down-side of this
>is that it requires additional logic.
>
>The best method of all, providing your system has an embedded
>micro-processor, is to periodically sample (poll) the switch, then
>determine if the switch is open or closed based upon your own
>de-bounce criteria.
--don
Name one digital input that would be so affected.
:
: >A better method is to latch the switch status on it's first
: >closure, then AND the switch with a one-shot set to at least
:
: Well, if you have a one shot available and aren't looking for the
: DC *state* of the switch
Huh? Most switches have only two states, opened and closed. Only a
perverse engineer would be looking for the d.c. state (potential)
of a switch. ;->
: but, rather, just to detect that it
: was *pressed* (for example), just let the switch trigger the
: one shot.
Sounds good, but those with experience will tell you that this
opens the door for problems. The fact is, most one-shots don't
respond well or predictably to repeated inputs. This is why
one-shot filters are traditionally used only in latching
configurations.
: Set the time constant of a *retriggerable* one
: shot to the *period* of the switches bounce frequency.
In so doing, you negate the presence of the one-shot, so
why bother?
: If
: it is *non* retriggerable, set it to the maximum bounce time
: expected (+ epsilon)
This is what, of course, what is always done, as per my quote
below:
: >5 times the switch-bound settling time. This prevents multiple
: >hits from a single switch depression. The down-side of this
: >is that it requires additional logic.
: >The best method of all, providing your system has an embedded
: >micro-processor, is to periodically sample (poll) the switch, then
: >determine if the switch is open or closed based upon your own
: >de-bounce criteria.
Harry C.
The input to *any* standard TTL gate, the input to any unbuffered
CMOS gate, ... by my count, I just named a few *hundred*!
>: >A better method is to latch the switch status on it's first
>: >closure, then AND the switch with a one-shot set to at least
>:
>: Well, if you have a one shot available and aren't looking for the
>: DC *state* of the switch
>
>Huh? Most switches have only two states, opened and closed. Only a
>perverse engineer would be looking for the d.c. state (potential)
>of a switch. ;->
If you carefully reread what I wrote, it shouldn't be hard to deduce that
I was suggesting that if the original querant was only looking for
a "pushbutton event" and *not* looking at the "current state" of
the switch, the one-shot suggestion I made works fine. In many
applications, the *state* of a switch isn't important but, rather,
the *transitions* are (often only one *particular* transition like
a button press!)
I don't think it takes a rocket scientist to understand the use
of "DC" in this context -- as in "0 Hz" as in "current time-invariant
state", etc.
By contrast, the one-shot solution I suggest actss as a discriminator...
throwing away *all* "DC" from the system.
>: but, rather, just to detect that it
>: was *pressed* (for example), just let the switch trigger the
>: one shot.
>
>Sounds good, but those with experience will tell you that this
Gee, as one of those "with experience" (20+ years) I wouldn;t
say that! :>
>opens the door for problems. The fact is, most one-shots don't
>respond well or predictably to repeated inputs. This is why
>one-shot filters are traditionally used only in latching
>configurations.
Actually, one shots are *rarely* used in good designs since any
sort of RC timing is to be suspect.
>: Set the time constant of a *retriggerable* one
>: shot to the *period* of the switches bounce frequency.
>
>In so doing, you negate the presence of the one-shot, so
>why bother?
Not at all. There is a big difference between how a
retriggerable and a NONretriggerable one-shot function
in the presence of multiple triggers. The solution I
gave here (assuming you opt for a one-shot -- *or* a digital
or software implementation of the same concept!) is correct.
>: If
>: it is *non* retriggerable, set it to the maximum bounce time
>: expected (+ epsilon)
>
>This is what, of course, what is always done, as per my quote
>below:
I've never seen a one-shot used to debounce a switch. It's
an expensive solution (only two per package) and requires
just as many external components as an RC/RRC/RCD/etc. feeding
a gate with hystersis (if you're fluent with one-shots,
you'd note that one advantage of my one shot solution was that
it exploits the hysteresis presnt on some one-shot trigger
inputs)
>: >5 times the switch-bound settling time. This prevents multiple
>: >hits from a single switch depression. The down-side of this
>: >is that it requires additional logic.
>
>: >The best method of all, providing your system has an embedded
>: >micro-processor, is to periodically sample (poll) the switch, then
>: >determine if the switch is open or closed based upon your own
>: >de-bounce criteria.
--don
Harry H Conover wrote:
>
> Michael D. Rayman (ray...@uakron.edu) wrote:
> : Does anyone out there know a relatively simple way to debounce an SPST
> : momemtary pushbutton switch? I know how to debounce an SPDT switch
> : easily. All it takes is two NAND gates and a few resistors, but I want
> : to debounce an SPST switch. I would greatly appreciate ANY kind of
> : feedback whether a referral to a web site, an email address, or a
> : solution. Thank you for your time.
> :
>
> For a single pole switch, the historic method is to series the
> switch with a 1 or 2K resistor driving an appropriatly sized
> capacitor connect to ground. The RC time constant should
> approximate 10x the swith bounce rate.
>
> A better method is to latch the switch status on it's first
> closure, then AND the switch with a one-shot set to at least
> 5 times the switch-bound settling time. This prevents multiple
> hits from a single switch depression. The down-side of this
> is that it requires additional logic.
>
> The best method of all, providing your system has an embedded
> micro-processor, is to periodically sample (poll) the switch, then
> determine if the switch is open or closed based upon your own
> de-bounce criteria.
>
> OK,I'll bite, why not use a schmitt trigger? They are cheap and readily
> available in all logic types and in inverting and non-inverting flavors,
> for a REALLY(read cheap)noisy switch you might want to have a small cap
> on the input. I've used this method on push-button switches with good
> results.
> John
You need a cap!
--- sam : Sci.Electronics.Repair FAQ: http://www.repairfaq.org/
Usually latest (ASCII): http://www.pacwest.net/byron13/sammenu.htm
Lasers: http://www.misty.com/~don/lasersam.html
> Name one digital input that would be so affected.
Don is correct. While most logic inputs are not affected (in that case
you don't really need debouncing anyway) , clock inputs (where you
definitely do need debouncing) that do not have schmitt trigger inputs
have maximum rise and fall time specs. For example, the MC14013 has a
15usec max rise and fall time on a 5v supply. As well, your noise immunity
goes to zero as the input approaches the threshold, this is not a good
thing to do. If the clock input happens to be a schmitt trigger type, your
method is fine.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany "The Journey is the reward"
sp...@interlog.com
Fax:(905) 332-4270 (small micro system devt hw/sw + mfg)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
To illustrate, get yourself a plain vanilla gate and tie the
output to something *fast* that is sensitive to edges -- e.g.
a counter. Toggle/press your debounced switch *once* and
wonder why the counter advances N counts (the counter must be
*very* fast since the output of a TTL gate will oscillate
around 100MHz during that brief, "critical region".
For more "Fun with Science", try the same test on an unbuffered
CMOS gate (CD4000U series) and note how wonderfully linear it
is as the input slowly slews through the transition region. :>
--don
I have used this in a high RF noise area and filtered the gate with a
047uf cap on both side of the
4.7kohm resistor, but those are probably not needed in most circuits.
Please let me know if you have any questions.
I have a question.
Doesn't the SCR fire again when you open the pushbutton? I have
always believed that for a properly debounced switch there is exactly
one low to high transition and one high to low transition for each
depression and release of the switch. This means that you have to
take care of the multiple closures upon depressing the switch and upon
releasing the switch.
Regards,
_______________________________________________________________________
|Dick Hagerman, P.E. | Electronic Product Design |
|REH-TEK,Inc. |Analog, Digital, Embedded Controllers |
|Qualityby Design |"Everything is deeply intertwingled"Tom DeMarco|
_______________________________________________________________________
I think you have found a flaw in my circuit ( or maybe not ) If you hold
the switch closed
longer than the charge time to reach the minimum holding current and then
release the switch
the SCR will open and any noise could cause it to fire again, However the
cap is charged so if
the SCR did fire the charged cap wouldn't allow much current to flow,
probably not enough to
trigger a TTL device. I think the resistor across the 1uf cap has to be
large enough to keep the
charge on the cap until the noise from the switch opening is gone.
Hey thanks for the interest, I would appreciate any more info you could
share on the
operation of this circuit.
Mike
Please let me know if I didn't describe this well enough to be understood.
Dick Hagerman <reh...@netacc.net> wrote in article
<3526a915...@news.supernews.com>...