You are on page 1of 50

ENG3640

Microcomputer Interfacing
Week #8
Data Acquisition Systems
Part (B)
2
Topics
Sensors
Signal Conditioning
Analog to Digital Converters
Sample and Hold Circuit



ENG3640 Fall 2012
3
Resources
Huang, Chapter 12, Sections
12.1 12.6 Signal Conditioning Circuits
ENG3640 Fall 2012
4
Sensors and Signal Conditioning
Real
World
Measurand
Transducer
(sensors)
Analog
Mux
Signal
Conditioning
Sample and
Hold Circuit
A/D
Conv
MCU
D/A
Conv
Actuator
ENG3640 Fall 2012
Transducers
Transducer
* a device that converts a primary form of energy into a corresponding signal
with a different energy form
4 Primary Energy Forms: mechanical, thermal, electromagnetic, optical,
chemical, etc.
* take form of a sensor or an actuator
Sensor (e.g., thermometer)
* a device that detects/measures a signal or stimulus
* acquires information from the real world
Actuator (e.g., heater)
* a device that generates a signal or stimulus

real
world
sensor
actuator
intelligent
feedback
system
5 ENG3640 Fall 2012
6
Sensors
Sensors connect the
digital world to the analog
real world
1. Position Based Sensors
2. Force Sensors
3. Temperature Sensors
4. Light Intensity Sensors
5. Pressure Sensors
6. Humidity Sensors
7. .
ENG3640 Fall 2012
7
Transducers: General Term
Transducers convert variable processes such as
pressure, temperature, humidity e.t.c., into electrical
signals such as voltage or current. It consists of:
1. Input interface element provides
Improved coupling between measurand s(t) and sensor
(matching function)
Protection to the sensor from undesirable environmental
effects
Conversion of s(t) to another physical variable s
1
(t)
required by a sensor.
2. Sensor
3. Output interface element
Input
Interface
Element
Sensor
Output
Interface
Element
S(t) X(t) S
1
(t)
ENG3640 Fall 2012
8
Shaft Angle With Potentiometer
Applications:
O Accelerator pedal position
O Steering wheel angle

Voltage V
s
changes because of the
change in resistance
Simple application of Ohms law V = I x R
Shaft angle proportional to voltage V
s
O Outputs the angular position of the shaft

ENG3640 Fall 2012
9
Linear Variable Displacement
Transformer (LVDT)
Moving iron core changes
properties of transformer
O Iron core position changes
primary/secondary voltage ratio
O Difference in phase is measured
and transformed to a voltage
Voltage measured is
proportional to distance
moved.
Applications:
O Fluid level and flow
O Deflection of Beams
ENG3640 Fall 2012
10
Strain Gauge: Force Measurement
Resistance varies with the
amount of stretching
(strain)
O Flexure can be measured with a
strain gauge
O Force can also be measured
The change in resistance is
detected by measuring the
voltage change in a
Wheatstone bridge.
ENG3640 Fall 2012
Passive Sensor Readout Circuit
Photodiode Circuits




Thermistor Half-Bridge
voltage divider
one element varies

Wheatstone Bridge
R3 = resistive sensor
R4 is matched to nominal value of R3
If R
1
= R
2
, V
out-nominal
= 0
V
out
varies as R
3
changes
VCC
R1+R4
11 ENG3640 Fall 2012
12
Temperature: Thermocouples
Outputs a voltage that is related to temp at the tip of the probe
O Seebeck effect: current will flow through a junction of dissimilar metals if
there is a temperature difference
The voltage produced is very minute (milli-volts)
The relationship between voltage and temperature is non linear
O Varies from 6 uV/C to 90 uV/C
ENG3640 Fall 2012
Temperature Sensor Options
Resistance Temperature Detectors (RTDs)
Platinum, Nickel, Copper metals are typically used
positive temperature coefficients
Thermistors (thermally sensitive resistor)
formed from semiconductor materials, not metals
often composite of a ceramic and a metallic oxide (Mn, Co, Cu or Fe)
typically have negative temperature coefficients
Thermocouples
based on the Seebeck effect: dissimilar metals at diff. temps. signal
13 ENG3640 Fall 2012
14
Phototransistor: Light Detection
Current through external
resistor varies with light
intensity
Can be used to detect
light levels or movement
Sensitive to different
colors or wavelengths of
light

ENG3640 Fall 2012
15
Output Transducers: Actuators
Some common actuators include
solenoids, relays, (triacs, SCRs
switch ac currents).
An increasing analog signal at the
gate of the MOSFET increases the
amount of current drawn through
the dc motor shunt field (field
control).
A relay is an electromagnetic
switch with a coil and one or more
contacts.
O Applying voltage to the coil will
cause open contacts to close and
vise versa.
A solenoid is like a relay but moves
a mechanical cylinder instead of
electrical contacts.
ENG3640 Fall 2012
16
Example
A Temp sensor has a measurement range of -10 to
140C. The output range is -2.5 to +5V. The sensor is
connected to an 8-bit A/D. Indicate the offset, span,
step size and resolution. Also what is the digital
output of the A/D if the temp is +10C?
SOLUTION:
1. Offset -2.5V, -10C
2. Span 5 (-2.5V) = 7.5 V, 140C (-10) = 150C
3. Step Size 7.5/2
8
= 29mv, 150/2
8
= 0.59C
4. Resolution 29mv at 8-bit
To find the digital output of A/D we have to solve the
following equation (assuming relationship is linear!)
Analog number = m x measurement + K
ENG3640 Fall 2012
17
Cont .. Example
1. 5v = 140C x m + K
2. -2.5v = -10C x m + K
Subtract 2 from 1
7.5v = 150 C x m
m = 7.5V/150C
m 0.05V/C
Solve for K:
140C x (0.05V/C) + K = 5V
K -2V
Analog output 10C x 0.05V/C 2V = -1.5V
Digital Number = (Analog Number Offset)/Step Size
Digital output -1.5V (-2.5V)/29mv = (34.8)
10
== (22)
16
ENG3640 Fall 2012
18
Signal Conditioning
Raw sensor outputs are not always suitable for A/D
conversion.
Signal conditioning circuits typically amplify the raw
signal from the sensor (i.e. thermocouple)
Signal conditioning also provides:
1. buffering,
2. filtering,
3. offset shifting
Most signal conditioning circuits employ operational
amplifiers
ENG3640 Fall 2012
19
The Inverting/Non-Inverting Amplifiers
ENG3640 Fall 2012
20
Voltage Scaling
There are situations in which the transducer output
voltage are in the range of 0 ~ V
Z
, where V
Z
< V
DD
.
Because V
Z
sometimes can be much smaller than V
DD
,
the A/D converter cannot take advantage of the available
full dynamic range, and therefore conversion results can
be very inaccurate.
A voltage scaling circuit can be used to improve the
accuracy because it allows the A/D converter to utilize its
full range.
Example:
Suppose the transducer output voltage ranges from 0V to 100mV.
Design a circuit to scale this range to 0~5V.
ENG3640 Fall 2012
21
Voltage Scaling Circuit

A
V
= 1 + (R2/R1) = (5V/0.1V) = 50

R2/R1 = 49

Choose R1 = 6.8K,
Then R2 = 330K.
The R2/R1 ratio is 48.53. Error is smaller within 0.3%.
V
OUT
+
V
IN
R1
R2
OP AMP
Figure 10.4 A voltage scaler
A
V
=
R1 + R2
R1
= 1 +
R1
R2
10.2
ENG3640 Fall 2012
22
The Unity-Gain Buffer or Voltage Follower
Signal conditioning can also provide buffering
O so that the sensor signal is not affected by anything else
connected to the circuit (i.e. minimize loading high input
impedance and low output impedance)
V
IN
V
OUT
V
1
R
1
R
2
R
f
-
(10.3)
R
f
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
IN
= -
(a) Summing circuit
V
OUT
V
1
V
IN
= V
IN
(10-4)
(b) Inverting voltage follower
V
IN
V
1
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
OUT
V
OUT
-
(10-5)
R
f
R
1
R
2
R
f
= V
1
V
IN
(c) Level shifter and scaler
Figure 10.5 Level shifting and scaling circuit
voltage follower
V
M
V
M
= - V
IN
22 ENG3640 Fall 2012
23
Voltage Shifting-Scaling Circuit
There are transducers whose outputs are in the range of
V
1
~V
2
instead of 0V~VDD
O (V
1
can be negative and V
2
can be smaller than V
DD
)
The accuracy of A/D conversion can be improved by
using a circuit that shifts and scales the transducer
output so that it falls in the full range of 0V~V
DD
.
A Level Shifting/Scaling Circuit would consist of:
I. A summing circuit
II. Inverting voltage follower

ENG3640 Fall 2012
24
V
IN
V
OUT
V
1
R
1
R
2
R
f
-
(10.3)
R
f
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
IN
= -
(a) Summing circuit
V
OUT
V
1
V
IN
= V
IN
(10-4)
(b) Inverting voltage follower
V
IN
V
1
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
OUT
V
OUT
-
(10-5)
R
f
R
1
R
2
R
f
= V
1
V
IN
(c) Level shifter and scaler
Figure 10.5 Level shifting and scaling circuit
voltage follower
V
M
V
M
= - V
IN
By choosing
Appropriate values
For V
1
and the
Resistors, the
Desired voltage
Shifting and scaling
Can be achieved.
V
IN
V
OUT
V
1
R
1
R
2
R
f
-
(10.3)
R
f
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
IN
= -
(a) Summing circuit
V
OUT
V
1
V
IN
= V
IN
(10-4)
(b) Inverting voltage follower
V
IN
V
1
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
OUT
V
OUT
-
(10-5)
R
f
R
1
R
2
R
f
= V
1
V
IN
(c) Level shifter and scaler
Figure 10.5 Level shifting and scaling circuit
voltage follower
V
M
V
M
= - V
IN
V
IN
V
OUT
V
1
R
1
R
2
R
f
-
(10.3)
R
f
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
IN
= -
(a) Summing circuit
V
OUT
V
1
V
IN
= V
IN
(10-4)
(b) Inverting voltage follower
V
IN
V
1
R
1
R
2
R
f
-
+
+12 V
- 12 V
74
1
-
+
+12 V
- 12 V
74
1
R
0
R
0
V
OUT
V
OUT
-
(10-5)
R
f
R
1
R
2
R
f
= V
1
V
IN
(c) Level shifter and scaler
Figure 10.5 Level shifting and scaling circuit
voltage follower
V
M
V
M
= - V
IN
24
25
Example Choose the appropriate values of resistors and the
adjusting voltage so that voltage shifting/scaling circuit can
shift the voltage from 1.5V ~ 3.5V to 0V ~ 5V.

Solution:

0 = -1.5 (R
f
/R
1
) (R
f
/R
2
) V
1

5 = 3.5 (R
f
/R
1
) (R
f
/R
2
) V
1


By choosing V
1
= - 12V and R
f
= R
1
= R
0
= 15KW, R
2
is
solved to be 120KW.
Voltage Shifting/Scaling Circuit
ENG3640 Fall 2012
26
A Difference Amplifier.
Use superposition to
perform analysis
If (R
4
= R
2
), (R
3
= R
1
) then
V
o
= R
2
/R
1
(V
2
V
1
)
Can be used to shift offset
ENG3640 Fall 2012
27
Integrator/Differentiator
ENG3640 Fall 2012
28
Analog-to-Digital Converters: Types
A/D converters are classified according to several
characteristics
+ Resolution (number of bits) typically 8 bits to 24 bits
+ Speed (number of samples per second) several
samples/sec to several billion samples/sec
+ Accuracy how much error there is in the conversion
Classification
- Staircase ADC
- Successive Approximation Converters
O Tracking ADC
O Flash A/D Converters
O Integrating A/D Converters
ENG3640 Fall 2012
29
Flash A/D: Comparators
A Flash A/D utilizes comparators and encoders.
A comparator compares two voltage values on its two
inputs.
If the input on the + input is greater than the voltage
on the input, the output will be logic high
29 ENG3640 Fall 2012
30
Flash A/D: Encoders
+What if D3 and D4 both high?
+Solution?
30 ENG3640 Fall 2012
31
Flash A/D: Priority Encoder
Example: 4-to-2 line encoder
O Chooses the input with highest priority
O An extra output V could be used to validate output

31 ENG3640 Fall 2012
32
Priority Encoder with Valid
32 ENG3640 Fall 2012
33
Flash (Parallel) A/D Converter
Flash A/D converters can sample
at several billion samples/sec
A flash A/D Converter is the
simplest to understand.
It compares an input voltage V
in

to a large number of reference
voltages
An n-bit flash uses 2
n
1
comparators!!!
The output is determined by
which of the two reference
voltages the input signal is
between.
Each succeeding comparator
switches from a low output to a
high level as the analog input
increases by q.
The largest flash A/D converter is
8-bits (255 comparators!)
3-bit A/D Converter
P
r
i
o
r
i
t
y

E
n
c
o
d
e
r

ENG3640 Fall 2012
34
Integrating A/D Converters

One of the lowest cost A/D Converters (often
used in digital voltmeters)
Slow used if parameter being measured is
changing slowly (i.e., temperature)
Has an advantage in noisy environments (noise
rejection capability)
Types:
O Single Slope Integrator
O Dual Slope Integrator

ENG3640 Fall 2012
35
The Dual-Slope A/D Conversion Method
S
2
is closed to discharge the capacitor
S
1
switches between V
A
and V
REF
O During the 1
st
period, converter integrates input signal V
A
for fixed time (T1)
O During 2
nd
period input is connected to V
REF
of opposite polarity so integration
proceeds to zero during variable time (T2)
The counter will count during T2 representing input signal
ENG3640 Fall 2012
36
The Dual-Slope A/D Conversion Method
The limited integration period results in normal-mode noise
rejection only when the integration period is equal to one or more
periods of the noise signal.
The time integral of this noise over integer multiples of the noise
period is ZERO.
At 60Hz minimum signal integrate time is 16.7 ms
ENG3640 Fall 2012
37
Binary Weighted DAC
The binary weighted DAC covered earlier is used for small word size
systems. Why?
Two major problems
1. The large resistor spread required for large word sizes
i.e. R
0
= 2R
1
= 4R
2
= 8R
3
.
2. Problem with large resistor spread is difficulty of IC Fabrication
3. If value of LSB is inaccurate or drifts slightly due to temp change leads to an
output error that is larger than 1 LSB
Solution?


ENG3640 Fall 2012
38
Inverted R-2R Ladder Circuit
Is used to solve the
problem of resistor
spread and minimize
drift problem in DACs
with large value of N.
- The spread of
resistance value for
the ladder is now
only a 2:1 spread.
ENG3640 Fall 2012
39
Inverted R-2R Ladder: Analysis
MSB
LSB
I
0
= V
REF
/R?
I
1
= V
REF
/2R
I
1
will split in half in second node I
2
= I
1
/2 V
REF
/4R
Each succeeding vertical resistor has a value of current flow equal to half
that of previous
I
1
= 2 I
2
= 4 I
3
= = 2
N-1
I
N
Thus as in binary weighted resistive network, the currents controlled by
the switches are binary weighted.
I
0
2R//2R = R
ENG3640 Fall 2012
40
The Glitch Problem in DACS
A Significant problem occurring in DACs is that of glitching.
Certain systems that are driven by a DAC ignore the glitches such as
DC motors (do not respond to these sharp transients)
Bits of the code do not change simultaneously
Solution?
Use a Sample/Hold circuit
ENG3640 Fall 2012
41
Sample and Hold Circuit
Practical Circuit?
ENG3640 Fall 2012
42
Sample and Hold Circuit: Practical Circuit
S/H circuit is a high quality capacitor and semiconductor switch.
If analog signal changes rapidly during conversion (errors may be
introduce)
S/H reduces these errors by quickly sampling the signal and holding it
STEADY while A/D converts
O Buffer amplifier (voltage follower) has high input impedance to decrease the
discharge of the capacitor.
O S
1
, closes during sampling period allows input signal to charge C
h
O S
1
, opens up again leaving capacitor charged to the value of analog input
signal.
ENG3640 Fall 2012
43
Sample and Hold Circuit: When is it required?
A S/H is required if: The analog input changes more than one resolution
during the conversion time.
O Let dz/dt be the rate of change (max slope) of the ADC input voltage
O Let
Z
be the ADC resolution
O Let T
c
be the ADC conversion time.
A S/H is required if dz/dt . T
c
> 0.5
Z

43 ENG3640 Fall 2012
44
Sample and Hold Circuit: Example
Assume we want to design a system to measure heart sounds, x. The
useful range of y (output of microphone) is from -10 to +10mV. The
desired resolution
Y
, is 0.1mV. The maximum dy/dt is 2 V/s. What is
the ADC conversion required to eliminate the need for a S/H?


Signal
Processing
ADC
Microphone
x
y
Z n
I. dy/dt x T
c
<= 0.5
Y
II. T
C
= (0.5
Y
)/(dy/dt)
III. T
C
= (0.5 x 0.0001 V) / 2 V/s = 25 seconds.
44 ENG3640 Fall 2012
45
Signal Sampling Rate
The rate at which you sample a signal depends
on how rapidly the signal is changing.
O If you sample a signal too slowly, the information about
the signal may be inaccurate.
To get full information about a signal you must
sample more than twice the highest frequency in
the signal (Nyquist Criteria)
O Practical systems typically use a sampling rate of at
least four times the highest frequency in the signal.
ENG3640 Fall 2012
46
Sampling
A 1,050 Hz signal sampled at 500 Hz looks like a
50 Hz signal.
ENG3640 Fall 2012
47
Summary
There are two errors introduced by the sampling
process:
O Voltage quantization due to finite word size of ADC
O Time quantization caused by the finite discrete
sampling interval
Use a binary weighted DAC when resolution
required is small, else use a ladder type DAC
A sample and hold circuit should be used when
signal is changing fast for ADC or if you want to
avoid glitch problems in DAC.
Flash ADC are fastest but expensive (use only if
speed is of importance).
A successive approximation based ADC is
suitable for most applications.

ENG3640 Fall 2012
48 ENG3640 Fall 2012
49
Successive Approximation A/D
Is based on intelligent trial-and-error method
Requires N clock periods for N-bit converter.
ENG3640 Fall 2012
50
I V & V I
I
in
R
V
out
= -I
in
.R
V
in
R
L
I
out
= V
in
/R
1
R
1
ENG3640 Fall 2012

You might also like