Adc Dac
Adc Dac
Prabal Dutta
University of Michigan
Some slides adapted from Mark Brehob, Jonathan Hui & Steve Reinhardt
1
Announcements
• Group Projects
– Research projects: let me know if interested
– Time to find group members
– Brainstorm project ideas!
2
Outline
• Announcements
• Sampling
• ADC
• DAC
3
We live in an analog world
4
Transducers convert one
form of energy into another
• Transducers
– Allow us to convert physical phenomena to a voltage
potential in a well-defined way.
A transducer is a device that converts one type of energy to another. The conversion can be to/from
electrical, electro-mechanical, electromagnetic, photonic, photovoltaic, or any other form of energy.
While the term transducer commonly implies use as a sensor/detector, any device which converts energy
can be considered a transducer. – Wikipedia. 5
Convert light to voltage with a CdS photocell
• Force • Acceleration
– strain gauges - foil, – MEMS
conductive ink – Pendulum
– conductive rubber • Monitoring
– rheostatic fluids – Battery-level
• Piezorestive (needs bridge) • voltage
– piezoelectric films – Motor current
– capacitive force • Stall/velocity
• Charge source – Temperature
• Sound • Voltage/Current Source
– Microphones • Field
• Both current and charge – Antenna
versions
– Magnetic
– Sonar
• Hall effect
• Usually Piezoelectric
• Flux Gate
• Position
• Location
– microswitches
– Permittivity
– shaft encoders
– Dielectric
– gyros
• What we want
Physical Engineering
Phenomena Units
8
Representing an analog signal digitally
f (x) Counts
Voltage (discrete)
(continuous)
f sampled (x)
t
TS 9
Choosing the range
• Fixed # of bits (e.g. 8-bit ADC)
• Span a particular input voltage range
• What do the sample values represent?
– Some fraction within the range of values
What range to use?
Vr Vr
Vr Vr
t t
Range Too Small Range Too Big
Vr
Vr
t
Ideal Range
10
Choosing the granularity
• Resolution
– Number of discrete values that
represent a range of analog values
– MSP430: 12-bit ADC
• 4096 values
• Range / 4096 = Step
Larger range less info / bit
• Quantization Error
– How far off discrete value is from
actual
– ½ LSB Range / 8192
Larger range larger error
11
Choosing the sample rate
f (x)
f sampled (x)
t 12
Shannon-Nyquist sampling theorem
f samples 2 f max
• Example:
– Humans can process audio signals 20 Hz – 20 KHz
– Audio CDs: sampled at 44.1 KHz
13
Converting between voltages,
ADC counts, and engineering units
Vr
Vin
N ADC
Vr
t
14
A note about sampling and arithmetic*
15
Try it out for yourself…
$ cat arithmetic.c
#include <stdio.h>
int main() {
$ gcc arithmetic.c
$ ./a.out
vtemp: 0.000000
tempc: -277.746490
16
Use anti-aliasing filters on ADC inputs to
ensure that Shannon-Nyquist is satisfied
• Aliasing
– Different frequencies are indistinguishable when they
are sampled.
17
Designing the anti-aliasing filter
• Note
is in radians
= 2f
• Exercise: Say you want the half-power point to
be at 30Hz and you have a 0.1 μF capacitor.
How big of a resistor should you use?
18
Do I really need to condition my input signal?
19
Oversampling
20
Oversampling a 1-bit ADC w/ noise & dithering (cont)
Voltage Count
uniformly “upper edge”
distributed of the box
random noise
±250 mV
1
Vthresh = 500 mV
N1 = 11
500 mV
375 mV
N0 = 32
500 mV
Vrand =
0 mV
Note:
N1 is the # of ADC counts that = 1 over the sampling window
N0 is the # of ADC counts that = 0 over the sampling window
21
Oversampling a 1-bit ADC w/ noise & dithering (cont)
• Dithering
– Quantization errors can
result in large-scale patterns
that don’t accurately
describe the analog signal
– Oversample and dither
– Introduce random (white)
noise to randomize the
quantization error.
24
How do ADCs and DACs work?
• DAC
– DAC #1: Voltage Divider
– DAC #2: R/2R Ladder
• ADC
– ADC #1: Flash
– ADC #2: Single-Slope Integration
– ADC #3: Successive Approximate (SAR)
25
DAC #1: Voltage Divider
Din • Fast
Vref
2
• Size (transistors, switches)?
• Accuracy?
2-to-4 decoder • Monotonicity?
R
R Vout
26
DAC #2: R/2R Ladder
Vref
R R R 2R
2R 2R 2R 2R
Iout
D3 (MSB) D2 D1 D0 (LSB)
• Size?
• Accuracy?
• Monotonicity? (Consider 0111 -> 1000)
27
DAC output signal conditioning
28
ADC #1: Flash Converter
Vref Vin
priority
encoder
R +
_ 3
R +
_ 2 2
Dout
R +
_ 1
R
Vcc 0
29
ADC #1: Flash Converter Example
Vin _
+ done
Vcc
I C
EN*
n-bit counter
CLK
• Start: Reset counter, discharge C.
• Charge C at fixed current I until Vc > Vin . How should C, I, n,
and CLK (fCLK) be related?
• Final counter value is Dout.
• Conversion may take several milliseconds.
• Good differential linearity.
• Absolute linearity depends on precision of C, I, and clock.
31
ADC #3: Successive Approximation (SAR)
The integral nonlinearity (INL) is the deviation of an ADC's transfer function from a straight line.
This line is often a best-fit line among the points in the plot but can also be a line that connects
the highest and lowest data points, or endpoints. INL is determined by measuring the voltage
at which all code transitions occur and comparing them to the ideal. The difference between
the ideal voltage levels at which code transitions occur and the actual voltage is the INL error,
expressed in LSBs. INL error at any given point in an ADC's transfer function is the accumulation
of all DNL errors of all previous (or lower) ADC codes, hence it's called integral nonlinearity.
Differential nonlinearity
DNL is the worst cases variation of actual step size vs. ideal step size.
full-scale error is the difference between the ideal code transition to the highest
output code and the actual transition to the output code when the offset error is zero.
Errors