Electronic Instrumentation: Experiment 6 - Digital Switching
Electronic Instrumentation: Experiment 6 - Digital Switching
Electronic Instrumentation: Experiment 6 - Digital Switching
Electronic Instrumentation
Experiment 6 -- Digital Switching
Part A: Transistor Switches
Part B: Comparators and Schmitt Triggers
Part C: Digital Switching
Part D: Switching a Relay
Part A: Transistors
Analog Circuits vs. Digital Circuits
Bipolar Junction Transistors
Transistor Characteristics
Using Transistors as Switches
2
Analog Circuits vs. Digital Circuits
An analog signal is an
electric signal whose
value varies
continuously over time.
3
• A binary signal, the most common digital signal, is a signal
that can take only one of two discrete values and is
therefore characterized by transitions between two states.
4
• In binary voltage waveforms, these values are represented
by two voltage levels.
• In TTL convention, these values are nominally 5V and
0V, respectively.
• Note that in a binary waveform, knowledge of the
transition between one state and another is equivalent to
knowledge of the state. Thus, digital logic circuits can
operate by detecting transitions between voltage levels.
The transitions are called edges and can be positive (f0 to
f1) or negative (f1 to f0).
5
Bipolar Junction Transistors
The bipolar junction transistor
(BJT) is the salient invention
that led to the electronic age,
integrated circuits, and
ultimately the entire digital
world. The transistor is the
principal active device in
electrical circuits.
6
There are two types of B
BJTs, npn and pnp,
and the three layers npn
are called collector transistor
(C), base (B), and
emitter (E). E
C
All current
directions are
reversed from
the npn-type to
the pnp-type.
VC VCE > 0 VC
VCE < 0
VBE < 0 VBE > 0
IC IC
IB IB
- +
VB VB VCE
-VCE +
- -
+ VBE -
-VBE +
IE
IE
pnp BJT VE
npn BJT
VE VCE VC VE
Apply voltage LOW
to base to turn ON VBE VB VE Apply voltage HIGH
to base to turn ON
I E IC I B
9
Characteristics of Transistors
Cutoff Region
• Not enough voltage at B for the diode to turn on.
• No current flows from C to E and the voltage at C is Vcc.
Saturation Region
• The voltage at B exceeds 0.7 volts, the diode turns on and the
maximum amount of current flows from C to E.
• The voltage drop from C to E in this region is about 0.2V but we
often assume it is zero in this class.
Active Region
• As voltage at B increases, the diode begins to turn on and small
amounts of current start to flow through into the doped region. A
larger current proportional to IB, flows from C to E.
• As the diode goes from the cutoff region to the saturation region,
the voltage from C to E gradually decreases from Vcc to 0.2V.
IC I B 10 1000
10
Diode Model of the npn BJT
The diode is controlled by the
voltage at B.
IC = βIB
VBE = 0.7 V
IC
IE
IC
IB 1
0.9 0.999
10 1000
Remove the part of the circuit that controls the switch and
consider two possible cases:
13
Using the transistor as a switch
14
Building logic gates with transistors
Input Output
0 1
1 0
15
Part B: Comparators and Schmitt Triggers
Op-Amp Comparators
Model of a Schmitt Trigger
16
Comparators and Schmitt Triggers
• In this section we will use op-amps to
create binary signals.
• Comparators are the simplest way to
create a binary signal with an op-amp.
They take advantage of the very high
gain of the chip to force it to saturate
either high (VS+) or low (VS-) creating
two (binary) states.
• Schmitt Triggers are a modified version
of a comparator which uses a voltage
divider to improve the performance of
the comparator in the presence of noise.
17
Op-Amp Comparators
• The prototype of op-amp switching circuits is the
op-amp comparator.
• The circuit does not employ feedback.
Vout A V V
18
• Because of the large gain that characterizes open-
loop performance of the op-amp (A > 105), any
small difference between the input voltages will
cause large outputs; the op-amp will go into
saturation at either extreme, according the voltage
supply values and the polarity of the voltage
difference.
• One can take advantage of this property to
generate switching waveforms.
• Consider the following.
Non-inverting Op-Amp Comparator
V cos t
19
• The comparator is perhaps the simplest form of an
analog-to-digital converter, i.e., a circuit that
converts a continuous waveform to discrete values.
The comparator output consists of only two
discrete levels.
Input and Output of Non-Inverting Comparator
V = 1 volt
20
• It is possible to construct an inverting comparator
by connecting the non-inverting terminal to ground
and connecting the input to the inverting terminal.
Input and Output of Inverting Comparator
21
• Comparator with Offset
• A simple modification of the comparator circuit
consists of connecting a fixed reference voltage
to one of the input terminals; the effect of the
reference voltage is to raise or lower the voltage
level at which the comparator will switch from
one extreme to the other.
22
• Below is the waveform of a comparator with a reference
voltage of 0.6 V and an input voltage of sin(ωt).
23
• Another useful interpretation of the op-amp
comparator can be obtained by considering its
input-output transfer characteristic.
Non-Inverting Zero-Reference
(no offset) Comparator
often called a
zero-crossing comparator
24
• Shown below is the transfer characteristic for a
comparator of the inverting type with a nonzero
reference voltage.
25
Comparator Response to Noisy Inputs
26
Schmitt Trigger Model
• One very effective way of
improving the performance of
the comparator is by
introducing positive feedback.
Positive feedback can increase
the switching speed of the
comparator and provide noise
immunity at the same time.
• The voltage range over which
the signal does not switch is
called the hysteresis (In this
case, h=2d) Can you explain how this works?
27
• In effect, the Schmitt trigger provides a noise
rejection range equal to ± Vsat [R2 / (R2 + R1)]
within which the comparator cannot switch.
• Thus if the noise amplitude is contained within this
range, the Schmitt trigger will prevent multiple
triggering.
28
• If it is desired to switch about a voltage other than
zero, a reference voltage can also be connected to
the non-inverting terminal. In this case, d+ is not
equal to d-, and the hysteresis is given by h=d+ + d-
Switching levels for the Schmitt Trigger are:
R2 R1
Vin Vsat Vref
R 2 R1 R 2 R1
positive-going transition
R2 R1
Vin Vsat Vref
R 2 R1 R 2 R1
negative-going transition
29
How to determine switching levels
vout vref vR 2 vR1 v vref vR 2
vR1
R1
vout vref
R1 R 2
vR 2
R2
vout vref
R1 R 2
We are always comparing the input to the voltage at v+
vR 2
R2
Vsat vref v vref
R2
Vsat vref
R1 R 2 R1 R 2
Example: If vref=1V and Vsat=15V or -15V, then
R2 R2
Vsat 15V v 1V (15 1) vin 1V 14
R1 R 2 R1 R 2
R2 R2
Vsat 15V v 1V (15 1) vin 1V 16
R1 R 2 R1 R 230
Part C: Digital Switching
Digital Chips
Inverting Digital Chips
Simulating Noise
Using Inverters to control a transistor
31
Digital Chips
4.0V
2.0V
0V
0s 100us 200us 300us 400us 500us 600us
V(U1A:A)
Time 34
Using Inverters to control a Transistor
R5 1k
U4A R6 Q2 V
1 2 R4
7414 Q2N2222 1k
1k
V2
5v
V1
V 0 R2 1k
0
0 U3A R3 Q1 V
1 2
R1
7404 Q2N2222
1k 1k
0
Two identical circuits in parallel.
One uses a Schmitt trigger inverter and the other an inverter.
(If you copy and paste, components cannot have identical names.)
35
Part D: Switching a Relay
Relays
Relay Switching Circuit
36
Relays