Download as pdf or txt
Download as pdf or txt
You are on page 1of 110

Digital Signal

Conditioning
DR. SEYED HAMED HASHEMI SOHI
ME220
INSTRUMENTATION AND PRECISION ENGINEERING
Digital Signal Conditioning:

 Review of Digital Electronics


 Digital Electronics Circuits
 Digital-to-Analog Converters (DACs)
 Analog-to-Digital Converters (ADCs)
Review of Digital Electronics

 Digital Logic
 Fractional Binary Numbers,
 Boolean Algebra
Digital Logic

 Digital logic is the representation of signals and


sequences of a digital circuit through numbers.
 Basis for digital computing and provides a
fundamental understanding on how circuits and
hardware communicate within a computer
 Typically embedded into most electronic devices,
including calculators, computers, video games,
and watches.
 Utilized by many careers that work with computers
and technology, such as engineers and repair
technicians.
Binary Counting
• In the binary system, each digit represents an increasing power
of 2, with the rightmost digit representing 20, the next
representing 21, then 22, and so on. The equivalent decimal
representation of a binary number is sum of the powers of 2
which each digit represents. For example, the binary number
100101 is converted to decimal form as follows:

• 1001012 = [ ( 1 ) × 25 ] + [ ( 0 ) × 24 ] + [ ( 0 ) × 23 ] + [ ( 1 ) ×
22 ] + [ ( 0 ) × 21 ] + [ ( 1 ) × 20 ]

1001012 = [ 1 × 32 ] + [ 0 × 16 ] + [ 0 × 8 ] + [ 1 × 4 ] + [ 0 × 2 ] +
[1×1]

1001012 = 3710
Fractional Binary Counting

 Fractions in binary arithmetic terminate only if 2 is the only prime


factor in the denominator.

 1/3 = .010101..., this means: 1/3 = 0 × 2−1 + 1 × 2−2 + 0 × 2−3 + 1 × 2−4 +


... = 0.3125 + ...
 An exact value cannot be found with a sum of a finite number of
inverse powers of two, the zeros and ones in the binary
representation of 1/3 alternate forever.
Fractional Binary Counting
Boolean Algebra

 Boolean algebra is a mathematical system for the


manipulation of variables that can have one of two
values.
 In formal logic, these values are “true” and “false.”
 In digital systems, these values are “on” and “off,” 1 and 0, or “high”
and “low.”

 Boolean expressions are created by performing


operations on Boolean variables.
 Common Boolean operators include AND, OR, and NOT.
Boolean Algebra 9

 A Boolean operator can be completely


described using a truth table.
 The truth table for the Boolean operators
AND and OR are shown at the right.
 The AND operator is also known as a
Boolean product. The OR operator is the
Boolean sum.
Boolean Algebra 10

 The truth table for the Boolean NOT


operator is shown at the right.
 The NOT operation is most often
designated by an overbar. It is
sometimes indicated by a prime mark
( ‘ ) or an “elbow” ().
Boolean Algebra 11
 A Boolean function has:
• At least one Boolean variable,
• At least one Boolean operator, and
• At least one input from the set {0,1}.

 It produces an output that is also a member of the set


{0,1}.

Now you know why the binary numbering


system is so handy in digital systems.
Boolean Algebra 12

 The truth table for the Boolean


function:

is shown at the right.


 To make evaluation of the
Boolean function easier, the
truth table contains extra
(shaded) columns to hold
evaluations of subparts of the
function.
Boolean Algebra 13
 As with common arithmetic,
Boolean operations have rules
of precedence.
 The NOT operator has highest
priority, followed by AND and
then OR.
 This is how we chose the
(shaded) function subparts in
our table.
Boolean Algebra 14
 Digital computers contain circuits that implement Boolean
functions.
 The simpler that we can make a Boolean function, the
smaller the circuit that will result.
 Simpler circuits are cheaper to build, consume less power, and run faster
than complex circuits.

 With this in mind, we always want to reduce our Boolean


functions to their simplest form.
 There are a number of Boolean identities that help us to
do this.
Boolean Algebra 15
 Most Boolean identities have an AND (product) form as
well as an OR (sum) form. We give our identities using
both forms. Our first group is rather intuitive:
Boolean Algebra 16
 Our second group of Boolean identities should be familiar
to you from your study of algebra:
Boolean Algebra 17
 Our last group of Boolean identities are perhaps the most
useful.
 If you have studied set theory or formal logic, these laws are
also familiar to you.
Boolean Algebra 18
 We can use Boolean identities to simplify the function:
as follows:
Boolean Algebra 19
 Sometimes it is more economical to build a circuit
using the complement of a function (and
complementing its result) than it is to implement the
function directly.
 DeMorgan’s law provides an easy way of finding the
complement of a Boolean function.
 Recall DeMorgan’s law states:
Boolean Algebra 20
 DeMorgan’s law can be extended to any number of variables.
 Replace each variable by its complement and change all
ANDs to ORs and all ORs to ANDs.
 Thus, we find the the complement of:

is:
Boolean Algebra 21
 We have looked at Boolean functions in abstract terms.
 In this section, we see that Boolean functions are
implemented in digital computer circuits called gates.
 A gate is an electronic device that produces a result based on
two or more input values.
 In reality, gates consist of one to six transistors, but digital designers think of
them as a single unit.
 Integrated circuits contain collections of gates suited to a particular
purpose.
Boolean Algebra 22
 The three simplest gates are the AND, OR, and NOT gates.

 They correspond directly to their respective Boolean


operations, as you can see by their truth tables.
Boolean Algebra 23
 Another very useful gate is the exclusive OR (XOR) gate.
 The output of the XOR operation is true only when the
values of the inputs differ.

Note the special symbol 


for the XOR operation.
Boolean Algebra 24
 NAND and NOR are two
very important gates.
Their symbols and truth
tables are shown at the
right.
Boolean Algebra 25
 NAND and NOR are known
as universal gates because
they are inexpensive to
manufacture and any
Boolean function can be
constructed using only
NAND or only NOR gates.
Boolean Algebra 26
 Gates can have multiple inputs and more than one
output.
 A second output can be provided for the complement of the
operation.
 We’ll see more of this later.
Boolean Algebra 27
 The main thing to remember is that combinations of
gates implement Boolean functions.
 The circuit below implements the Boolean function:

We simplify our Boolean expressions


so that we can create simpler circuits.
Digital Electronics Circuits

 Comparator
 Converter
Digital Comparator

 The Digital Comparator is another very useful combinational logic


circuit used to compare the value of two binary digits

 Digital or Binary Comparators are made up from


standard AND, NOR and NOT gates that compare the digital signals
present at their input terminals and produce an output depending
upon the condition of those inputs..
Digital Comparator

 Compare binary numbers and determine whether the value of


input A is greater than, smaller than or equal to the value at
input B etc.

 The digital comparator accomplishes this using several logic gates


that operate on the principles of Boolean Algebra.
Digital Comparator

 There are two main types of Digital Comparator available and these
are.
1. Identity Comparator – an Identity Comparator is a digital
comparator with only one output terminal for when A = B, either A = B =
1 (HIGH) or A = B = 0 (LOW)

2. Magnitude Comparator – a Magnitude Comparator is a digital


comparator which has three output terminals, one each for equality, A
= B greater than, A > B and less than A < B
Digital Comparator

 1-bit Digital Comparator Circuit


 Circuit does not distinguish between
either two “0” or two “1”‘s as an
output A = B is produced when they
are both equal, either A = B = “0” or A
= B = “1”
 The output condition for A =
B resembles that of a commonly
available logic gate, the Exclusive-
NOR or Ex-NOR function
(equivalence) on each of the n-
bits giving: Q = A ⊕ B

Digital Comparator Truth Table


Digital Converters

 Digital-to-Analog Converters (DACs)


 Analog-to-Digital Converters (ADCs)
Digital-to-Analog Converters
(DACs)
 A DAC is a Digital to Analog converter. It converts a binary digital
number into an analog representation, most commonly voltage
though current is also used sometimes.
Representing Numbers in Computer Systems
Introduction

 Each binary number sampled by the DAC corresponds to a different


output level.
Typical Output

 DACs capture and hold a number, convert it to a physical signal,


and hold that value for a given sample interval. This is known as a
zero-order hold and results in a piecewise constant output.

Output typical of a real, practical due


Ideally Sampled Signal
to sample & hold
What is DAC?
DAC Configuration

 Assume the analogue signal is voltage


Type of DAC Circuits

 Resistor-Strings
 N-Bit Binary Weighted Resistors
 R-2R Resistor Ladder
Resistor-Strings DAC
Resistor-Strings DAC
Resistor-Strings DAC
Binary Weighted Resistor

 Utilizes a summing op-amp circuit


 Weighted resistors are used to distinguish each bit from the most
significant to the least significant
 Transistors are used to switch between Vref and ground (bit high or
low)
Binary Weighted Resistor

 Assume Ideal Op-amp Vref

 No current into op-amp R


 Virtual ground at inverting 2R I Rf

input 4R
- Vout
 Vout= -IRf
+
2nR
Binary Weighted Resistor
Vref
Voltages V1 through Vn are
either Vref if corresponding bit is V1
high or ground if R
corresponding bit is low V2 2R I Rf

V1 is most significant bit V3 4R


- Vout
Vn is least significant bit +
Vn 2n-1R

MSB

LSB
 V1 V2 V3 Vn 
Vout = − IRf = − Rf  + + +  n -1 
 R 2R 4R 2 R
N-Bit Binary Weighted Resistors
N-Bit Binary Weighted Resistors
N-Bit Binary Weighted Resistors
N-Bit Binary Weighted Resistors
N-Bit Binary Weighted Resistors
R-2R Resistor Ladder
Binary Weighted Resistor

 Advantages
 Simple Construction/Analysis
Fast Conversion
 Disadvantages
 Requires large range of resistors (2000:1 for 12-bit
DAC) with necessary high precision for low resistors
 Requires low switch resistances in transistors
 Can be expensive. Therefore, usually limited to 8-bit
resolution.
R-2R Resistor Ladder

Each bit corresponds


to a switch:

If the bit is high or 1,


the corresponding
switch is connected to
the inverting input of
the op-amp.

If the bit is low or 0, the


corresponding switch
is connected to ground.
R-2R Ladder
V3
Vref V1 V2 V3
Ideal Op-amp

2R 2R

Req =
(2 R )(2 R )
=R
(2 R + 2 R )
R-2R Ladder

Vref V1 V2 V3 V2 V3

R R

 R  1
V3 =   2
V = V2
 R+R 2
I
Likewise,
1
V2 = V1
Vout 2
1
V1 = Vref
2
Vout = − IR
R-2R Ladder
Results:
Vref V1 V2 V3 1 1 1
V3 = Vref , V2 = Vref , V1 = Vref
8 4 2

 Vref Vref Vref Vref 


Vout = − R b3 + b2 + b1 + b0 
 2R 4R 8R 16R 

Where b3 corresponds to bit 3,


b2 to bit 2, etc.
Vout
If bit n is set, bn=1

If bit n is clear, bn=0


R-2R Ladder
For a 4-Bit R-2R Ladder

 1 1 1 1
Vout = −Vref  b3 + b2 + b1 + b0 
 2 4 8 16 
For general n-Bit R-2R Ladder or Binary Weighted Resister DAC

n
1
Vout = −Vref  bn −i i
i =1 2
R-2R Resistor Ladder
R-2R Resistor Ladder
R-2R Resistor Ladder
R-2R Resistor Ladder
R-2R Resistor Ladder
R-2R Resistor Ladder
R-2R Ladder

 Advantages
 Only two resistor values (R and 2R)
 Does not require high precision resistors
 Disadvantage
 Lower conversion speed than binary weighted DAC
Specifications of DACs

• Resolution
• Speed
• Linearity
• Settling Time
• Reference Voltages
• Errors
Resolution

 Smallest analog increment corresponding to 1 LSB change


 An N-bit resolution can resolve 2N distinct analog levels
 Common DAC has a 8-16 bit resolution

Vref
Resolution = VLSB =
2N
where N = number of bits
Speed

 Rate of conversion of a single digital input to its analog equivalent


 Conversion rate depends on
 clock speed of input signal
 settling time of converter
 When the input changes rapidly, the DAC conversion speed must
be high.
Linearity

 The difference between the desired analog output and the


actual output over the full range of expected values

Analog Output Signal

0000 0001 0010 0011 0100 0101


Digital Input Signal
Linearity

 Ideally, a DAC should produce a linear


relationship between the digital input and
analog output

Linearity (Ideal) Non-Linearity


Analog Output Signal

Analog Output Signal


0000 0001 0010 0011 0100 0101 0000 0001 0010 0011 0100 0101
Digital Input Signal Digital Input Signal
Settling Time

 Time required for the output signal to settle within +/- ½


LSB of its final value after a given change in input scale
 Limited by slew rate of output amplifier
 Ideally, an instantaneous change in analog voltage
would occur when a new binary word enters into DAC
Reference Voltages

 Used to determine how each digital input will be assigned to each


voltage division
 Types:
 Non-multiplier DAC: Vref is fixed
 Multiplier DAC: Vref provided by external source
Types of Errors Associated with DACs

 Gain
 Offset
 Full Scale
 Resolution
 Non-Linearity
 Non-Monotonic
 Settling Time and Overshoot
Gain Error

 Occurs when

.
the slope of

Analog Output
the actual
output
deviates from
the ideal
output

Digital Input

Ideal Output Positive Offset Errorr Negative Offset Error


Offset Error

 Occurs when

.
there is a constant

Analog Output
offset between
the actual output
and the ideal
output

Digital Input

Ideal Output Positive Offset Errorr Negative Offset Error


Full Scale Error

 Occurs when the

.
actual signal has

Analog Output
both gain and
offset errors

Digital Input

Ideal Output Full Scale Error Error


Resolution Error

 Poor representation
of ideal output due to
poor resolution
 Size of voltage
divisions affect the
resolution
Non-Linearity Error

 Occurs when analog output of signal is non-linear


 Two Types
 Differential – analog step-sizes changes with increasing digital input
(measure of largest deviation; between successive bits
 Integral – amount of deviation from a straight line after offset and gain
errors removed; on concurrent bits
Non-Linearity Error, cont.
Non-Monotonic Error

 Occurs when an increase in


digital input results in a
decrease in the analog
output
Settling Time and Overshoot Error

 Settling Time – time required Analog


Output
for the output to fall with in +/- +1/2*VLSB
½ VLSB Ideal
Output
 Overshoot – occurs when
analog output overshoots the -1/2*VLSB

ideal output

Settling Time
Time
Applications

 Digital Motor Control


 Computer Printers
 Sound Equipment (e.g. CD/MP3 Players, etc.)
 Electronic Cruise Control
 Digital Thermostat
Data Handling Systems

 Both data about the physical world and control


 signals sent to interact with the physical world are typically "analog"
or continuously varying quantities.

 In order to use the power of digital electronics, one must convert


from analog to digital form on the experimental measurement end
and convert from digital to analog form on the control or output
end of a laboratory system.
Data Collection and Control
Data Acquisition System
 Computers represent numbers in base 2 (binary).Information in
computers is stored in bi stable devices called flip-flops, which can
have two possible states. One state is defined as "on" and is
assigned a numerical value of 1, and the other state is defined as
"off" and is assigned a numerical value of 0.
 A series of flip-flops are required to represent a number. For
example, the binary number 0101, which corresponds to the
decimal number 5, can be represented in a computer Using four
flip-flops. Each of these flip-flops represents a "bit" of the number.
The left most "1" in the binary number 1001 is the most significant bit
(MSB). The rightmost "l" is the least significant bit (LSB). It is common in
computers to break long binary numbers up into segments of 8 bits,
which are known as bytes.
Representing Numbers in Computer Systems
Analog Signal

 Analog signals:

o Continuous, expressed in decimal system


o No limitation on the
maximum/minimum value
o Can not be processed by computer
Analog data

 All values on the time and amplitude are allowed).


ADC -
Analog Representations of Sound
 Magnified phonograph grooves, viewed from above:

The shape of the grooves encodes the continuously varying


audio signal.
Analog to Digital Recording Chain

 Microphone converts acoustic to electrical energy. It’s a transducer


 . Continuously varying electrical energy is an Analog of the sound pressure wave.
 ADC (Analog to Digital Converter) converts analog to digital electrical signal.
Digital signal transmits binary numbers.
 DAC (Digital to Analog Converter) converts digital signal in computer to analog
for your headphones.
Analog to Digital Conversion

 Instantaneous amplitudes of continuous analog signal, measured at


equally spaced points in time. A series of “snapshots”

A series of “snapshots”
Analog to Digital Overview

 Sampling Rate
 How often analog signal is measured [samples per second, Hz]
 Example: 44,100 Hz
 Sampling Resolution
 [ “sample word length,” “bit depth”] Precision of numbers used for
measurement: the more bits, the higher the resolution.
Sampled Data system

 In
system science, a sampled-data
system is a control system in which a
continuous-time plant is controlled with a
digital device. Under periodic sampling,
the sampled-data system is time-varying
but also periodic; thus, it may be
modeled by a simplified discrete-time
system obtained by discretizing the plant.
Sampling

 Sampling: Numerical evaluate the signal


at discrete distance in time, yk=y(kDt)
 DigitizedSignal: a sequence of numbers
that is an approximation to an analog
signal
 Sampling
time/Period: time duration
between two consecutive samples, Dt
 Sampling rate (Hz): 1/Dt
 Nyquist Frequency: 2fmax
 Sampling theory: fs > Nyquist Frequency
Sampling Rate

 Determines the highest frequency that you can represent with a


digital signal.

 Nyquist Theorem:
 Sampling rate must be at least twice as high as the highest
frequency you want to represent. Capturing just the crest and
trough of a sine wave will represent the wave exactly.
Aliasing

 What happens if sampling rate not high enough?

A high frequency signal

sampled at too low a rate

looks like …
… a lower frequency signal.

That’s called Aliasing Or foldover


. An ADC has a low-pass anti-aliasing filter to prevent this.
Anti-aliasing Filter

 One way of avoiding the problem of aliasing is to apply an


anti-aliasing filter to the signal, prior to the sampling stage, to
remove any frequency components above the "folding" or
Nyquist frequency (half the sampling frequency).
 An anti-aliasing filter is a low-pass filter.
Common Sampling Rates

Most software can handle all these rates.


Quantization

Definition: transformation of a continuous


analog input into a set of discrete output
state
 Coding: the assignment of a digital code
word or number to each output states
# of possible state: N=2n, n is # of bits
 Quantization resolution: Q=(Vmax-Vmin)/N
 Quantization Error: D = f (t ) − f
 k k
N
3-bit Quantization
A 3-bit binary (base 2) number has 23 = 8 values.
4-bit Quantization

 A 4-bit binary number has 24 = 16 values. A better approximation.


Analog-to-Digital Converters
(ADCs)
 Digital-Ramp ADC
 Successive Approximation ADC
 Flash ADC
Digital-Ramp ADC

 Conversion from analog to digital form inherently involves


comparator action where the value of the analog voltage at some
point in time is compared with some standard.

 A common way to do that is to apply the analog voltage to one


terminal of a comparator and trigger a binary counter which drives
a DAC.
Digital-Ramp ADC
Digital-Ramp ADC

 Circuit Operation
 At the start, the counter is cleared to 0
 As the counter counts up with each clock pulse, the Digital to
Analog Converter (DAC) outputs a slightly higher voltage. This
voltage is compared to the input voltage by the comparator.
 If the input voltage is greater than the DAC output, the
comparator's output will be high and the counter will continue
counting normally.
 Eventually, though, the DAC output will exceed the input voltage,
causing the comparator's output to go low. This will be the end of
conversion and counter output is the adc output.
Successive approximation ADC
Successive approximation ADC

 Much faster than the


 digital ramp ADC because it uses
digital logic to converge on the value
closest to the input voltage.

 A comparator and a DAC are used in


the process.
Flash ADC
 It is the fastest type of ADC
available, but requires a
comparator for each value of
output.(63 for 6-bit, 255 for 8-bit,
etc.)

 Such ADCs are available in IC form


up to8-bit and 10-bit flash ADCs
(1023comparators) are planned.

 The encoder logic executes a truth


table to convert the ladder of
inputs to the binary number output.

Illustrated is a 3-bit flash ADC with resolution 1 volt


Flash ADC

 The resistor net and comparators provide an input to the


combinational logic circuit, so the conversion time is just the
propagation delay through the network - it is not limited by the
clock rate or some convergence sequence.

You might also like