Background
Sometimes
when experimenting with or testing digital logic circuits a manual switching
function is needed to momentarily take an input 'high' and then return to 'low'
state. This could be to simulate a logic change on a digital input, or to act
as a switch on one input of a dual gate device to enable another input to pass
through the gate. See below for examples:
Manual
input toggle high/low to simulate logic level change:
Manual
gating to enable another input through the circuit:
However,
using manual switches can produce unreliable and unpredictable results due to
switch bounce.
Research
Using
the example of the manual switch de-bounce circuit at labbookpages I
experimented with various component values to produce a push switch circuit
capable of generating a single pulse approximately 0.275 seconds (approximately
250mS). This time period was sufficient for a number of experiments I wanted to
try involving detecting logic level changes. This time period was also useful
when I was testing the use of a clock signal to pass through counting circuitry
at a relatively slow speed.
The
circuit below comprises a switching and timing function, and in combination
with a Schmitt Trigger device (IC4584) produces reliable, repeatable and good
quality pulses. In essence a Schmitt Trigger is used to 'square up' slowly
changing waveforms or inputs, and is ideally suited to providing a clean and
sharp switched output in response to the relatively slowly changing input
conditions in the circuit below.
Switch & Timer
Operation
In the circuit above, when power is applied capacitor C1
charges via R1 and D1. When sufficient voltage is present on the inverting
Schmitt Trigger IC1 input, the output will be 0V (logic 0).
When switch SW1 is pressed C1 discharges via R2, the voltage
on IC1 input will be near to 0V, therefore IC1 output will be +V (logic 1). The output remains at +V until SW1 is released
and C1 charges to the voltage needed for the Schmitt Trigger to switch it's
output to 0V.
With a momentary press of SW1 and using the combination of
R1, R2 and C1 above, the generated pulse length is 275mS.
Using some alternative values of C1 produces pulse lengths:
4.7uF = pulse
duration 860mS
9.4uF = pulse duration 1300ms
For more information on the operation of this circuit see
labbookpages.co.uk
For clarity purposes in all circuit examples I have not
included the positive or negative connections from each integrated circuit to
+V and 0V. Each IC datasheet provides pin-out descriptions and numbering.
Switch & Timer with external interface and indicator
With additional components I modified the original circuit
above to provide buffered outputs to drive external logic circuits and a visual
pulse indicator. The 4584 Schmitt Trigger (IC1) can supply up to 10mA on each
output which maybe inadequate to directly drive external logic circuitry and an
LED. I used the non-inverting hex buffer 4050 (IC2) to provide two outputs as
shown below. I prefer to provide buffering when interfacing to potentially
unknown logic inputs and LEDs to help prevent damage occurring. R3 prevents
unnecessarily high current flow. C1 provides power supply decoupling to prevent
power supply 'noise' causing any erratic circuit operation. I have successfully
tested and used this circuit powered at 3.3v and 5v which makes it very useful
to interface with single input TTL, CMOS, Raspberry Pi and Arduino based
circuitry. Additional buffering of the 4050 output is necessary if driving
multiple circuits.
Components
R1 100kΩ 1/4w
R2 4.7kΩ 1/4w
R3 2.2kΩ 1/4w
C1 100nF
C2 3uF
D1 1N914 (or similar general purpose low voltage
diode)
D2 Red Led
IC1 4584 Schmitt Trigger (6 channels)
IC2 4050 Hex buffer (6 channels)
References:
Decoupling
Switch
bounce
IC 4584
Schmitt Trigger datasheet
IC 4050 Hex
buffer datasheet
No comments:
Post a Comment