# Sampling, Digital Devices Data Acquisition by xvi11400

VIEWS: 27 PAGES: 27

• pg 1
```									                ME 310
Chapter 7 - Digital Methods

Sampling, Digital Devices
& Data Acquisition

ME 310 - Instrumentation

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Digital Sampling and Conversion

Mechanical Engineering
University of Kentucky

1
ME 310
Chapter 7 - Digital Methods

Introduction to the Digital World
• What is a digital signal and what differentiates it from
other signals?
– All electronic signals (and thus circuits) are either analog or
digital. Both are voltage (or current) signals. (See Chap. 1 & 2
slides for examples.)
• An analog signal is continuous; i.e., infinitely divisible
into smaller and smaller parts.
• A digital signal is quantized; i.e., the information is
divided into discrete quantities of a finite size.
• Up to c. 1950, prior to the advent of the transistor (and
thereafter the computer) all signals were essentially analog.
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Analog versus Digital Numbers
• Since analog numbers are continuous, there are an infinite
number of values between any two readings.
– Between 12.7 and 12.8 there exists 12.71, 12.75, 12.762572, etc.
• In a digital system, the values are limited to the smallest
digital increment.
– If 0.1 is the smallest increment, then there are no values between
12.7 and 12.8.
– Thus, any digital system can be represented by integer values
alone by proper scaling; 12.7 and 12.8 become 127 and 128 (×10),
respectively. Since the system is represented by integers alone, no
real values exist between 127 and 128.

Mechanical Engineering
University of Kentucky

2
ME 310
Chapter 7 - Digital Methods

Binary Representation
• Digital information is transmitted using binary; each
number is made up of a pre-determined quantity of bits
and 8 bits make a byte.
• Every bit has a value of 0 or 1; either off or on.
• Examples of a 4-bit number are 0000, 1111, and 1101.
Logic 1 (5 V), high

Logic 0 (0 V), low
1     1       0       1

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Binary Ranges
• The total number of possible values in a digital system is
given by 2N where N is the number of bits in each number.
N          1        4          8       16            32

Total         2       16      256     65,536        4x109

Min           0        0          0       0              0

Max           1       15      255     65,533         Big!

• Alternatively, one can use the range -total/2 to total/2-1.
Mechanical Engineering
University of Kentucky

3
ME 310
Chapter 7 - Digital Methods

Counting in Binary
• What is the decimal (base 10) equivalent of 1101?
– (1 * 2^3) + (1 * 2^2) + (0 * 2^1) + (1 * 2^0) = 8 + 4 + 0 + 1 = 13

•      0 =        0                              •   8 =     1000
1-bit
•      1 =        1                              •   9 =     1001
2-bit
•      2 =       10                              • 10 =      1010
•      3 =       11                              • 11 =      1011
3-bit                             4-bit
•      4 =     100                               • 12 =      1100
•      5 =     101                               • 13 =      1101
•      6 =     110                               • 14 =      1110
•      7 =     111                               • 15 =      1111

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Digital Measurements
• Why use digital signals?
converting to digital?
• Computers are digital - signal measurement can be easily
automated for recording, analysis and process control.
• A single system can handle different types of input; e.g.,
temperature, pressure, force, etc.
• Digital signals are noise-resistant; increased accuracy.
to error than analog gages.

Mechanical Engineering
University of Kentucky

4
ME 310
Chapter 7 - Digital Methods

Digital Conversion
• The analog signal of the measuring input must be
converted to a digital signal for the digital system
– Analog-to-digital (A/D) converter.
• Likewise, digital output can be converted into an
equivalent analog signal.
– Digital-to-analog (D/A) converter.
A/D
V                                                                       V
D/A

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Digital Conversion
• To convert an analog signal from a device, one needs
Correct cabling          A/D converter (internal or external)
Input
+                                  +
Signal

Computer                           Software

+

Mechanical Engineering
University of Kentucky

5
ME 310
Chapter 7 - Digital Methods

Resolution
• The resolution, Q, of a A/D converter is determined by the
input range (for example, -10 V to +10 V) and the number
of bits.
Q = ΔVFS
2N
• Thus, a -10 to +10 V range has a voltage resolution of 78
mV, 4.8 mV, or 0.3 mV for a 8-bit (28=256), 12-bit
€
(212=4096), or 16-bit (216=65,536) converter, respectively.
(These are typical bit depths of standard A/D converters.)

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Quantization Error
• The finite resolution of an A/D converter results in a fixed
error in the measurement since the actual analog signal will
almost always fall somewhere between two bit values.
• This is called quantization error and can be estimated by

uq = εV 2

• The error can only be reduced by using more bits.

€
Mechanical Engineering
University of Kentucky

6
ME 310
Chapter 7 - Digital Methods

Problem 7.14
• A 12-bit A/D has full scale range of E=5 V and an
accuracy of 0.03% full scale. Estimate (i) quantization
error; (ii) total error; (iii) relative uncertainty.
The quantization error is determined by FSR and depth:
Q = 5V /212 = 1.2 mV
eQ = ±Q /2 = ±0.6 mV
The maximum possible error is the sum of all errors:
€
emax = eQ + eaccuracy = 0.6 + 5(0.0003) = 2.1 mV
The probable error is given by the relative uncertainty:
€
2    2
uE = ± eQ + eaccuracy = ± 0.6 + 5(0.0003) = ±1.6 mV
€
Mechanical Engineering
University of Kentucky

€

ME 310
Chapter 7 - Digital Methods

Saturation
• The upper and lower bounds of A/D converters limit the
range of input values that can be converted.
• If the signal falls outside this range, it is saturated.

saturation

V                                    V

t                                          t
• If a signal becomes saturated, it must be appropriately
conditioned before conversion from analog to digital.
Mechanical Engineering
University of Kentucky

7
ME 310
Chapter 7 - Digital Methods

Sampling
• The sampling rate is the rate at which the analog signal is
converted to a digital record.
• Each converter has a hardware determined maximum
sampling rate.
• Typical values are in the 1 kHz (1000 samples/second) to
100 MHz (100,000,000 samples/second) range.
• Any analog signal which varies with a frequency greater
(or even equal) than the sampling cannot be accurately
measured. The signal is undersampled and aliasing may
result.

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Aliasing Example (cf. 7.1, 7.2)
• Aliasing occurs not only in
acquiring data in an experiment,
but can also occur in creating
data in a simulation
• Say we wish to simulate a sine
wave; in MATLAB, type
»x=[0:6:100]
»y=sin(x)
»plot(x,y,'bs-')

• We get something that looks
like a sine wave, right?

Mechanical Engineering
University of Kentucky

8
ME 310
Chapter 7 - Digital Methods

Aliasing Example (cont.)
• Since we are already familiar
with the behavior of a sine
wave, we can immediately tell
that this is wrong
• Try plotting using finer step
sizes, increasing the resolution
»x=[0:5:100]
»y=sin(x)
»plot(x,y,’ro-')

»x=[0:1:100]
»y=sin(x)
»plot(x,y,’gd-')
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Aliasing (cont.)
• In each of these cases, we have
undersampled the signal
• The frequency is determined by
the period, f=1/T=1/2π
• As a first guess, determine step
size by dividing the period by 10,
or ~0.6
»x=[0:0.1:100]
»y=sin(x)
»plot(x,y,'bs-')
• Here we used a finer resolution
to get more detail

Mechanical Engineering
University of Kentucky

9
ME 310
Chapter 7 - Digital Methods

Sampling Rate & Nyquist Frequency
• The sampling rate is determined by the time interval
between samples, δt
fs = 1
δt
• The sampling theorem states that to accurately represent
the measured signal, the sampling rate should be at least
of
twice that€ the highest frequency in the signal
f s = 2 f N > 2 f signal
• fN is known as the Nyquist frequency

€                                       Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Determining Alias Frequencies
• As mentioned, if fs is too low, aliasing occurs -
misinterpretation of these frequencies as “real” signals or
frequencies are called alias frequencies
• Using a Fourier series representation of the signal, one can
show that the frequencies f and f+m/δt are
indistinguishable, where m is an integer
• The phase of the alias signal will vary from in-phase to
out-of-phase as one goes from one alias frequency to the
next (see the folding diagram, Fig. 7.3)

Mechanical Engineering
University of Kentucky

10
ME 310
Chapter 7 - Digital Methods

Fold-Back Diagram
• The observed alias frequency and the phase relation can be
determined from the fold-back diagram
Out-
of-p
hase
3fN
ase
In-ph
2fN      Out-
of-p
hase
0                       fN
• Frequency content that is at frequencies above fN will
appear as alias frequencies less than fN; Ii.e., superimposed
(folded back) and appear as lower frequencies
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Problem 7.4
• Find the alias frequency that results from sampling the
signal f1 at sampling frequency fs                     3fN

• f1=60 Hz, fs=90 Hz                            2fN
– Nyquist frequency is fN=fs/2=45 Hz
0                    fN
– The ratio f/fN=1.33
– From Figure 7.3, a ratio of 1.33 corresponds to a “measured”
frequency of 0.67fN
– Thus, fmeasured=0.67fN=30 Hz and is out-of-phase with the original
signal

Mechanical Engineering
University of Kentucky

11
ME 310
Chapter 7 - Digital Methods

Further Aliasing Issues
• Aliasing also crops up when examining frequencies in
phase space (spectra)
• Cutting of a periodic signal either with too few periods or
truncating it out-of-phase will produce (or “leak”) multiple
spikes in the spectrum plot (see Fig. 7.4)
• This can be solved by taking many periods (at least 10)
and starting and stopping the data set at the same point in
the period
• One can also use anti-aliasing filters or windows to help
alleviate these problems

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Calibration
• Since the analog signal is measured in volts and we really
want to look at the signal in some real units (K, Pa, N, lb,
etc.), we need to calibrate the signal during the conversion
process.
• This requires using some known inputs on the device –
another instrument is usually required if a calibration
signal is not available.
Calibration curve
V                    A/D     V

quantity
Mechanical Engineering
University of Kentucky

12
ME 310
Chapter 7 - Digital Methods

In Class Demo
• DAQ System
Computer
Force             External
transducer         A/D converter

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Digital Circuits

Mechanical Engineering
University of Kentucky

13
ME 310
Chapter 7 - Digital Methods

Digital Circuits
• Digital circuits can be used for a number of applications,
including control and signal conditioning.
• A digital circuit uses high and low voltages to indicate if
the control is on or off.
on                             5V

off                                      off               0V

• Typical values are 0 to 5 V. For example, if 0 < V < 2.5 V,
the control is off. If 2.5 V < V < 5 V, the control is on.
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Mechanical Digital Circuits
• Digital circuits don’t have to be
electronic (though almost all
are) they can be mechanical as
well (see Babbage’s difference
engine to the right, c. 1833, it
could keep 32 decimal places)
• The last mechanical computer
was Harvard-IBM Mark I,
completed in 1944. It kept 23
of 72 counters, and could do a
multiply in six seconds.
Mechanical Engineering
University of Kentucky

14
ME 310
Chapter 7 - Digital Methods

Electronic Digital Circuits
• Electronic digital circuits                Vacuum tube
include
– Vacuum tubes
– Relays
– Magnetic cores or amplifiers
– Superconducting junctions
– Transistors

Superconducting
Josephson junction
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Transistors
• A transistor is a simple circuit that can produce high or low
output from high or low input.
• The exact relationship between the input and output (or
multiple inputs and outputs) depends on the transistor
design.
• Transistors are the most basic element of CPU design -
they determine the overall processing power.

Mechanical Engineering
University of Kentucky

15
ME 310
Chapter 7 - Digital Methods

The First Transistor
• First transistor developed in
1947 by Bardeen, Brattain, and
Shockley at Bell Labs (later
awarded Nobel prize for
discovery)
• Associates later developed IC
chip and formed Intel
• Less than a decade later, all
computers used transistors
relays, for example) for logic,
and later for memory

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Transistor Operation

Arrow indicates
direction of current

Mechanical Engineering
University of Kentucky

16
ME 310
Chapter 7 - Digital Methods

Moore’s Law
• 8086 (c. 1974) computed in 8-
• Pentium (1993) computes in 32-
bits and has 3,000,000
transistors
• P4 (2001) computers in 32-bits
and has 42,000,000 transistors

TI’s First Transistor
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

IC Chips
• Transistors have been combined
with other electronic elements
such as resistors and diodes to
make more complex digital
circuits - these have been
combined into single devices
called integrated circuit or IC
chips.
• Each IC chip consists of several
logic units along with input
power (+5 V) and ground.

Mechanical Engineering
University of Kentucky

17
ME 310
Chapter 7 - Digital Methods

Logic Units
• Logic units are devices which produce high or low output
for given input conditions.
• The basic logic units are the inverter (which flips the
signal) and the AND, OR, NAND, and NOR gates.
• These can all be combined in a single IC chip to perform a
one function or serve as a single platform to perform a
single type of operation for different parts of a circuit.
• The input-output relation of a logic unit or gate can be
determined from a logic or truth table.

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

The Inverter
• Inverts signal; low (0) ⇒ high (1) or high (1) ⇒ low (0).
• It has one input and one output.

A           Q

A                           Q             0           1

1           0

Mechanical Engineering
University of Kentucky

18
ME 310
Chapter 7 - Digital Methods

The AND Gate
• Both inputs must be high to yield a high output.

A    B        Q

0    0        0
A                             Q
1    0        0
B
0    1        0

1    1        1

• AND gates can have more than 2 inputs as well.

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

The NAND Gate
• The opposite of the AND gate.
A    B        Q

0    0        1
A                             Q
1    0        1
B
0    1        1

1    1        0

• A single NAND gate contains 4 transistors, 3 resistors, a
Mechanical Engineering
University of Kentucky

19
ME 310
Chapter 7 - Digital Methods

OR and XOR Gates
• OR gate is high if either input is high.
A   B        Q

0   0        0
A                                 Q
1   0        1
B
0   1        1

1   1        1

• Exclusive OR (XOR) is high only if either output is high,
but not both.
Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

IC Families
• Various logic units can be combined so that a IC can
perform a single function.
• Families of IC chips have been created that have special
characteristics; the most common of these is the TTL
family (transistor-transistor logic).
• Some sample TTL chips include
– 7400    quad 2-input NAND gate
– 7408    quad 2-input AND gate
– 7430    8-input NAND gate
– 7474    dual D-edge-triggered flip-flop
Mechanical Engineering
University of Kentucky

20
ME 310
Chapter 7 - Digital Methods

7408 TTL

TTL Voltage
Power

4 2-input AND gates               TTL Ground

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

7430 TTL
• 8-input NAND gate; VCC max is 5.25 V, min is 4.75 V

Mechanical Engineering
University of Kentucky

21
ME 310
Chapter 7 - Digital Methods

7474 TTL
• The flip-flop; used to store 1 bit of information for later
use; very important for CPUs.          A   B    Q Q’
A                             Q
1       1      1      0

1       1      0      1

0       1      1      0
Q’
1       0      0      1
B
– If A and B are opposite of one another, then Q follows A and Q' is the inverse of Q.
– If both A and B are switched to 1 simultaneously, then the circuit remembers what
was previously presented on A and B.

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

7474 D-Type Flip-Flop

Mechanical Engineering
University of Kentucky

22
ME 310
Chapter 7 - Digital Methods

Sample IC Circuits
• Counter
• Frequency meter
• Timer
– Most commonly used is the 555.
• Multiplexer

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Frequency Meter
• Counts how many times a signal pulses per second (Hz).
1/2 Hz square wave
5 MHz crystal-         Cascade of seven
controlled             divide by 10
oscillator               IC chips

Event
counter                                  Input signal

Mechanical Engineering
University of Kentucky

23
ME 310
Chapter 7 - Digital Methods

TTL Frequency Divider

A 7474 flip-flop and a 7400
NAND Gate

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

CMOS Logic Families
• The complementary metal oxide semiconductor family
(CMOS) has equivalents to most of the TTL chips.
• CMOS chips are much lower in power requirements
(drawing about 1 mA) and operate with a wide range of
supply voltages (typically 3 to 18 volts).
• The CMOS model number will have a C in the middle of
it, e.g., the 74C04 is the CMOS equivalent to the TTL
7404. A big drawback is extreme sensitivity to static
electricity - they must be carefully protected from static
discharges.

Mechanical Engineering
University of Kentucky

24
ME 310
Chapter 7 - Digital Methods

• Test
• Expect to see
– Normal and student-t tables
– Propagation of error
– Simple filters (passive, active)
– Low-pass, high-pass, band-pass filters
– DAQ systems (issues related to A/D, D/A conversion)

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Mechanical Engineering
University of Kentucky

25
ME 310
Chapter 7 - Digital Methods

Analog versus Digital
• Any signal is either a digital or analog signal – the
difference is obvious in their appearance.
Analog (continuous)              Digital (discrete)

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Analog versus Digital Examples
• Most any type of measurement can be digitized – let’s
look at time and temperature, for example.
– While the change in the height of the
discrete units - we can guess at a more
accurate reading but are limited to the tick-
marks for accurate measurements.

Mercury thermometer

Mechanical Engineering
University of Kentucky

26
ME 310
Chapter 7 - Digital Methods

Analog versus Digital Examples
• Thermocouple
– The thermocouple provides a continuous (analog) signal into the
meter, which is digitized and displayed on a LCD panel.

12.8

Analog signal            Digitized signal             Digital

Mechanical Engineering
University of Kentucky

ME 310
Chapter 7 - Digital Methods

Analog versus Digital Examples
• Timekeeping is another example.
– Time can be measured and displayed in either analog or digital
fashion.
– Time displays usually (but not always!) indicate if the system is
keeping track of time digitally or analog, but beware - an analog
display may sweep seconds using discretized ticks!.

Mechanical Engineering
University of Kentucky

27

```
To top