Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Analog/Digital and Sampling
Alexander Nelson
October 7, 2019
University of Arkansas - Department of Computer Science and Computer Engineering
Analog
Signals in the real world are analog signals
Process them as digital signals
Analog – Continuous in time and amplitude
Digital – Discrete in time and amplitude
1
Conversion
To work with sensor data, analog signals must be converted to
digital
Analog to Digital Conversion (A to D)2
Sampling
Sampling – Converting Analog to Digital Values
Sample – Single Measurement in time
Nyquist Rate – Minimum rate at which periodic signal can be
sampled without introducing aliasing errors
3
Sampling
Green – Analog signal Blue – Digital samples 4
Error Sources
Measurement Error – Instantaneous value measurement error
e.g. Voltage measurement within ± 0.05V
Quantization Error – Difference between measured value and
discrete value
Aliasing Errors – Missing signals by sampling too slowly
5
Digital Representation
How do you represent a real number in a given number of bits?
6
Digital Representation
Quantization – representing a real number in a given number of
bits?
Choosing Quantization Levels:
• Assume you want to represent 0V-5V given a 10-bit value
• 0V = 0b0; 5V = 0b1111111111 = 1023
• How much is each bit worth?
7
Digital Representation
Quantization – representing a real number in a given number of
bits?
Choosing Quantization Levels:
• Assume you want to represent 0V-5V given a 10-bit value
• 0V = 0b0; 5V = 0b1111111111 = 1023
• 5V ÷ 1023 ≈ 0.00488V – LSB
• LSB ∗ 512 = 2.502V – MSB
Any measurement difference from a multiple of 0.00488 is
quantization error
8
Quantization Error Example
Assume a 10-bit ADC measuring a 0-5V signal:
A sample is measured when instantaneous value is 2.83V
Assume measurement error is 0
What is the quantization error?
9
Quantization Error Example
Assume a 10-bit ADC measuring a 0-5V signal:
A sample is measured when instantaneous value is 2.83V
Assume measurement error is 0
What is the quantization error?
2.83V ÷ 5V = 0.566
0.566 ∗ 1023 = 579.018 – 579 is the ADC value
0.018× 0.00488V (LSB) ≈ 0.000088V
10
Sampling Theorem
Bridge between continuous-time and discrete-time signals (i.e.
analog and digital)
Meaning that Analog→Digital→Analog can reproduce the original
signal
11
Shannon’s Theorem
“If a function x(t) contains no frequencies higher than B hertz, it
is completely determined by giving its ordinates at a series of
points spaced 1/(2B) seconds apart.”
If a sampling rate is 2 times faster than fastest analog signal, the
original signal can be reconstructed from the sampled signal
12
Aliasing Error
1
1http://www.bb-elec.com/Learning-Center/All-White-Papers/Data-
Aquisition-and-IO/The-Fine-Art-of-Analog-Signal-Sampling.aspx
13
Analog to Digital Converters
Analog to Digital Converter – A2D/ADC/(A/D), A to D – Device
to convert physical quantity (voltage) to a discrete (digital) value
Multiple types of ADC architectures:
• Parallel/Serial stages
• Single/Multiple conversion steps
• One or more clock cycles
Each architecture has trade-offs
e.g. Power/size/speed/accuracy/etc...
14
ADC Features
15
ADC Circuit
16
Successive Approximation ADC
2
2By White Flye - Own work, CC BY-SA 2.5,
https://commons.wikimedia.org/w/index.php?curid=37953205 17
Successive Approximation ADC
Components:
• Successive Approximation Register
• Digital to Analog Converter
• Comparator
• Sample and Hold Amplifier
18
Sample and Hold
For serialized ADC circuits, the S/H circuit is important
Composed of two amplifiers, a switch, and a hold capacitor
19
Sample and Hold
Sample and hold maintains
voltage for a length of time
Top: Samples at given time
Bottom: Samples held until start
of next sample
20
Sample and Hold
“Hold” command sent → switch is opened
Hc maintains the voltage on output terminal
Charge on output terminal should change < 1 LSB during
conversion
Hc should have low leakage and dielectric absorption
21
Digital to Analog Converter (DAC)
Convert a digital value to an analog voltage
Different methods:
• Pulse Width Modulation with low pass filter
• Oversampling/Interpolating DACs (sigma-delta)
• Binary-weighted DAC (switched resistor, switched capacitor,
switched current source)
• Successive-Approximation/Cyclic DAC
22
PWM DAC
More filtering = better approximation, longer settle time
23
Analog Comparator
Circuit that produces a digital signal determining which of two
inputs is higher
V0 =
1 V+ ≥ V−
0 V+ < V−
In other words: Voltage out = Vdd if analog input greater than
reference; GND if input less than reference
24
Analog Comparator
3
3By Rakesh310 - Own work, CC BY-SA 4.0,
https://commons.wikimedia.org/w/index.php?curid=63899027
25
Successive Approximation Algorithm
Algorithm:
1. Compare against half of
range
2. Continue narrowing until
limited by LSB
3. Error upper bounded by 1LSB
• Assuming value just less
than next LSB, and no
nearest bit comparison
26
Successive Approximation Timing
Assuming DAC can obtain stable comparison voltage in < 1 cycle
How many clock cycles to convert Successive Approximation for a
10-bit ADC?
27
Successive Approximation Timing
Assuming DAC can obtain stable comparison voltage in < 1 cycle
How many clock cycles to convert Successive Approximation for a
10-bit ADC?
Binary Search Tree – N-bit conversion takes N-steps
e.g. 10-bit ADC = 10 clock cycles
28
What about 16 bits?
29