# Trigger pulse from a push button

Discussion in 'Electronic Basics' started by Rikard Bosnjakovic, Mar 23, 2005.

1. ### Rikard BosnjakovicGuest

Greetings

I've built a clock-circuit (a 74LS192 is the heart in it) that works
well. Except for one thing, I need a (manual) trigger pulse for it to
work 100%. I've been googling and asking around a couple of friends, and
this far I've got two solutions for creating a pulse with a mechanical
switch.

Solution 1:

Using a two-state button, connect it to a SR-latch and connect the
Q-output to the pulse-trigger on the 74LS192. The SR will filter away
the noise from the button. Tested with two switches, and it works.

Solution 2:

Using an RC-filter with a Schmitt-trigger, R=10kohm and C=5uF:

+V
|
\
/ 2R | \
\ | \
/ | \
/ R | | ____\
+---/ ---/\/\--+---------| / / +----
| | | _/_/ /
\ ----- C | /
----- | /
| | /
\

Schematic sent to me by a friend. Untested, but he assured me "it will
work".

Problems with solution 1: I only have one-state buttons, so I cannot
make the latch switch properly.

Problems with solution 2: I don't have any Schmitt-triggers. I have
ordered a couple of Schmitt-triggers now and they will probably arrive
in a week or two.

But since I'm a beginner in electronics, I'm getting frustrated at
waiting for components to arrive so I tried to brainstorm myself and my
breadboard to see if I couldn't build a pulse with the components I have
at home (one-state buttons, resistors, diodes, capacitors, tons of
ordinary AND/OR/NAND/etc-gates).

I've got very little knowledge (I'm still learning), but somehow I was
convinced that this small construction would work as a pulse-trigger:

/
+ ---/ ----||---- ->

But it didn't. This made me learn that capacitors doesn't load up fully
before releasing the current to the circuit, which I wrongly obviously

So, to end this post and trying to settle my frustration before my new
components arrives, is it possible to shoot a pulse with the components
I'm having at home (stated above)?

If anyone could fill me in about the capacitors I miss knowledge of I

--
Rikard Bosnjakovic http://bos.hack.org/cv/

charged \$250 for network traffic and computing time. By extracting
address from this message or its header, you agree to these terms.

2. ### Rikard BosnjakovicGuest

That Schmitt-trigger ascii-schematic had tabs in it. Sorry. This should
be a working one:

+V
|
\
/ 2R | \
\ | \
/ | \
/ R | | ____\
+---/ ---/\/\--+---------| / / +----
| | | _/_/ /
\ ----- C | /
----- | /
| | /
\

--
Rikard Bosnjakovic http://bos.hack.org/cv/

charged \$250 for network traffic and computing time. By extracting
address from this message or its header, you agree to these terms.

3. ### Lord GarthGuest

If you have any 4050 CMOS buffers, you can easily have 6 debounce circuits.

4. ### John SmithGuest

http://www.play-hookey.com/digital/experiments/rtl_schmitt.html

5. ### Fred BloggsGuest

The 555 makes for a good general-purpose switch debouncer. The two
inputs TRIG and THRESH switch at 1/3Vcc and 2/3Vcc respectively with
TRIG making OUT high when pulled below its threshold and THRESH making
output low when pulled above its threshold. So if you use the circuit
below, switch closure pulls the node voltage below TRIG threshold
causing the output to go high immediately and it stays that way until
switch release. Then when switch opens, capacitor charges up through R
towards Vcc and triggers THRESH when it reaches 2/3Vcc causing output to
go low and stay there. The equation for the time it takes to charge C
from 0 to 2/3Vcc is 1.1*R*C- therefore, in order to debounce the 555
output, this charge time must exceed worst case switch bounce. Making
1.1*R*C~50ms will do it most of the time. Using C=0.22uF and R=220K is
close enough, making 1.1*R*C=53ms. The 555 always puts out a logic
compatible pulse and this will work just fine with edge triggered TTL.

View in a fixed-width font such as Courier.

..
..
.. VCC
.. |
.. R |
.. +---[220K]-----+---+
.. | | |
.. | +-------------LM555
.. * | | RST VCC |
.. R | | |
.. +---[100]------+----+-----|TRIG |
.. | | | | OUT |----> PULSE
.. | | +-----|THRESH |
.. | | | |
.. |o | | |
.. -| === | |
.. |o 0.22U | CTL GND |
.. | | +-----------------+
.. | | N/C |
.. | | |
.. +--------------+---------------------+
.. |
.. ---
.. ///
..
..
..
..
.. * added to limit discharge current thru switch
..
..
..
..
..
.. |
.. OPEN +------- ------
.. | || |
.. | || |
.. | || |
.. SWITCH | || |
.. | || |
.. | || |
.. CLOSE + ---------- o o o -
.. |
.. --------------------------------------
.. -> | | <-
.. 50ms delay
.. bounce
.. interval -> | | <-
.. |
.. Vcc+ ----------- o o o --------
.. | | |
.. | | |
.. | | |
.. PULSE | | |
.. | | |
.. | | |
.. 0V+------- ---
.. |
.. --------------------------------------
..
.. time-->
..
..
..
..

6. ### John FieldsGuest

---
The reason the circuit didn't work was because you were charging the
capacitor with the switch, but never discharging it, so the best you
could do would be to get one pulse out of it; the first. The right
way to wire it up if you want a positive pulse out of it is like this:

+V>----> |
S1 |
O--+--[C1]---+-------+------>OUT
| | |K
[R1] [R2] [DIODE]
| | |
GND>--------+---------+-------+------>GND
--
What happens is that when the switch is made, the fast rising edge of
the waveform appearing across R1 will be differentiated by the
capacitor and will appear across R2. However, if the arm of the
switch continues to remain connected to +V the capacitor will charge
up to +V and the voltage across R2 will drop to zero volts because the
voltage on the input of the cap isn't changing, and DC can't get
through a capacitor. When the switch is released, or if it bounces,
the end of the capacitor connected to R1 will discharge from +V to 0V,
and, since the end of the cap connected to R2 was sitting at zero
volts, that end of the cap will go _negative_ when the cap discharges,
because that's the direction the other end of the cap went. That
negative pulse will be clamped to about -0.7V by the diode, and the
'K' denotes the diode's cathode.

When the switch is made, a positive spike with a voltage of +V will
appear instantaneously across R2, and as long as S1 stays made, the
spike will start to decay and will reach +V/3 in one "time constant",
which is the product of R2 and C1. So, if you wanted a pulse that
would rise to +V and then fall to one-third of +V in, say, a
millisecond, you'd choose the values of R2 and C1 to make that happen.

Let's say you had a 1µF capacitor laying around and you wanted a 1ms
pulse. Then, since:

T = RC,

you could rearrange it and write:

T 1 E-3 second
R = --- = -------------- = 1000 ohms

and that would be the resistance you'd need.

But... there's a problem in that you will _always_ have the switch
contacts bouncing around when they make and break, with the result
that instead of a nice neat single pulse coming out of C1 you'll have
a lot of garbage which will enventually settle down, but which will
cause a lot of clocks to be counted up if you're trying to use the
circuit to generate clocks for a counter. What to do? Debounce the
switch, and since you've got some logic laying around, you can do
this:

+V>----> |
S1 |
O
|
+--[1N4148>]--+----A
| | Y------>OUT
+---[1kR]-----+----B
| |
[100kR] [0.1µF]
| |
GND>-----+-------------+-------------->GND

ABY is a gate, an AND or an OR if you want a positive-going output
when you press the switch and negative-going when you release it, a
NAND or a NOR if you want the opposite.

what happens is that when you press the switch the cap charges up in a
few microseconds (probably when the contacts first touch) through the
diode, but it takes about a tenth of a second for the cap to
discharge through the resistors when the switch is released, so as
soon as you press the switch "Y" goes high, but it won't go low until
100 milliseconds after you release the switch. That way it debounces
both the make _and_ the break.

7. ### Rich GriseGuest

One problem I have is not knowing what you have on hand or can get in a
shop just up the street. You can do this with a comparator or a couple of
transistors. The gate circuit John Fields suggested will work well too, as
long as it's a CMOS gate. TTL family inputs will almost float high, and
don't take much of a pullup, but you have to pull them down pretty
decisively; so you'd want the switch to ground, and maybe 4K7 to 10K to
+Vcc and to the input - in other words, kinda turn his circuit upside down
and sink current rather than sourcing voltage. But only for TTL-style
inputs.

Good Luck!
Rich

....

9. ### John FieldsGuest

---
This is better, since there's no need for the diode:

+V>----> |
S1 |
O
|
+----[1kR]----+----A
| | Y------>OUT
| +----B
| |
[1MR] [0.1µF]
| |
GND>-----+-------------+-------------->GND