Signal-Noise Ratio

Introduction to Data Conversion
EE174 – SJSU
Tan Nguyen
Vocabulary
• ADC (Analog-to-Digital Converter): converts an analog signal (voltage/current) to a digital value
• DAC (Digital-to-Analog Converter): converts a digital value to an analog value (voltage/current)
• Sample period: for ADC, time between each conversion
• Typically, samples are taken at a fixed rate
• VFS / Vref (Full scale or Reference Voltage): Analog signal varies between 0 and Vref, or between +/-Vref
• Resolution: Number of bits used for conversion (8 bits, 10 bits, 12 bits, 16 bits, etc).
• Conversion Time: The time it takes for a analog-to-digital conversion
• Quantization is the process of converting a continuous range of values into a finite range of discreet
values. This is a function of ADC, which create a series of digital values to represent the original analog
signal.
• Differential Nonlinearity (DNL) error is the difference between an actual step width (for an ADC) or
step height (for a DAC) and the ideal value of 1 LSB.
• Integral Nonlinearity (INL) error is the deviation of the values on the actual transfer function from a
straight line.
• Effective Number Of Bits (ENOB) is a measure of the dynamic performance of an ADC.
Data Conversion System
• Real world signals are analog (temp, pressure, position, sound, light, speed, etc):
• Continuous time and continuous amplitude
• DSP can only process:
• Discrete time and discrete amplitude
• Digital data conversion system requires ADC and DAC.
• The ADC process utilizes sampling and quantization of the continuous analog signal.
• ADC converts an input analog value to an output digital representation.
• ADC is operated at a rate of fS samples per second. Anti-alias filter is used to avoid
any aliasing phenomena.
• ADCs usually require the input be held constant during the conversion process,
indicating that the ADC must be preceded by an Sample-and-Hold Amplifier (SHA)
to freeze the band-limited signal just prior to each conversion.
Because ADC is commonly
• The digital data is processed by a microprocessor and output to
a DAC.
• DAC is usually operated at the same rate fS as the ADC
• When the application demands, it is equipped with appropriate
circuitry to remove any output glitches arising in connection
with input code changes. The resulting staircase-like signal is
finally passed through a smoothing filter to ease the effects of
quantization noise.
needed, most modern
microcontrollers has
an in-built ADC unit.
ADC Process
There are two related steps in A-to-D conversion:
Sampling and holding:
The analogue signal is extracted, usually at regularly spaced time instants.
The samples have real values.
Quantization and Encoding:
The samples are quantized to discrete levels.
Each sample is represented as a digital value.
Sampling
Sampling is the process of recording an analog signal at regular discrete moments of time. The sampling rate fs is the
number of samples per second.
The time interval between samples is called the sampling interval Ts=1/fs.
In this example, v(t)=cos(2πft) is sampled with
sampling interval Ts=T/3 to produce the following v[n].
v[n] = cos(2πfnTs)
= cos(2πfnT/3)
= cos(2πn3)
by substituting t=nTs
since Ts=T/3
since T=1/f
This expression for v[n] evaluates to the
sample values as shown below.
The samples are shown as the sequence
v[n] indexed by integer values of n.
Sampling
If a sinusoidal signal is sampled with a high sampling rate, the original signal can be recovered exactly by connecting
the samples together in a smooth way (called ideal low pass filtering). In contrast, if a sinusoidal signal is sampled
with a low sampling rate, the samples may be too infrequent to recover the original signal.
The signal v(t)=cos(2πft) is sampled uniformly with 4 sampling intervals within every
3 signal periods. Therefore, 4Ts=3T and the sampling rate fs=(4/3)f.
Notice that a different sinusoid cos(2πft/3) with lower frequency f/3 also fits these
samples.
Attempting to recover v(t)=cos(2πft) by ideal low pass filtering instead produces
cos(2πft/3) since the latter has a lower frequency.
So, the sampling rate fs=(4/3)f is insufficient to recover v(t)from the samples.
The question that arises is: for which values of sampling rate fs can we sample and then perfectly recover a
sinusoidal signal v(t) = cos(2πft)?
Nyquist-Shannon Sampling Theorem
The Nyquist-Shannon Sampling Theorem states that the sampling rate for exact recovery of a signal composed of a
sum of sinusoids is larger than twice the maximum frequency of the signal.
This rate is called the Nyquist sampling rate fNyquist.
fs > fNyquist = 2fmax
Example 1: Given the signal v(t) = 7 + 5cos(2π440t) + 3sin(2π880t)  the sampling rate fs > fNyquist= 2(880)=1760 Hz.
Example 2: Given the signal v(t) = 5 sin(2π50t) is sampled at fs = 40 Hz, what signal can be recovered after sampled?
Solution: v[n] = 5 cos(2πn 50/40) = 5 cos(2πn(1.25)) = 5 cos(2πn(1 + 0.25)) = 5 cos(2πn(0.25)) = 5 cos(0.5πn)
Recovering signal: vr(t) = 5 cos(0.5π 40t) = 5 cos(2π 10t)  Sampling rate less than Nyquist rate results in original
signal is not recovered known as aliasing phenomena
Analog-to-Digital Converter (ADC)
• ADC converts an input analog value to an output digital representation.
• ADC is operated at a rate of fS samples per second. Anti-alias filter is used
to avoid any aliasing phenomena.
• ADCs usually require the input be held constant during the conversion
process, indicating that the ADC must be preceded by an Sample-andHold Amplifier (SHA) to freeze the band-limited signal just prior to each
conversion.
ADC Process
Sampling & Hold
• Measuring analog signals
at uniform time intervals
• Ideally twice as fast as what
we are sampling
Continuous Signal
• Digital system works with
discrete states
• Taking samples from each
location
• Reflects sampled and hold
signal
• Digital approximation
t
ADC Process
Sampling & Hold
• Measuring analog signals at
uniform time intervals
• Ideally twice as fast as what we
are sampling
• Digital system works with
discrete states
• Taking samples from each
location
• Reflects sampled and hold
signal
• Digital approximation
t
ADC Process
Sampling & Hold
• Measuring analog signals at
uniform time intervals
• Ideally twice as fast as what we
are sampling
• Digital system works with discrete
states
• Taking a sample from each
location
t
• Reflects sampled and
hold signal
• Digital approximation
ADC Process
Sampling & Hold
• Measuring analog signals at
uniform time intervals
• Ideally twice as fast as what we
are sampling
• Digital system works with discrete
states
• Taking samples from each
location
• Reflects sampled and hold signal
• Digital approximation
t
Sample and hold: The output only
changes at periodic instants of time. The
independent variable now takes values
in a discrete set
ADC Process
Quantization & Coding
Quantization error
• Use original analog signal
• Apply 2 bit coding
• Use original analog signal
• Apply 3 bit coding
Better representation of input information with additional bits
Quantizing: Partitioning
the reference signal range
into a number of discrete
quanta, then matching
the input signal to the
correct quantum.
• Encoding: Assigning a
unique digital code to
each quantum, then
allocating the digital code
to the input signal.
A 5 kHz Sine Wave sampled by a 3-bit versus a 16-bit ADC
Improve the accuracy in ADC
• Increase the sampling rate which increases the maximum frequency that can be measured.
• Increase the resolution which improves the accuracy in measuring the amplitude of the analog signal.
ADC Characteristics
• An ideal ADC:
Output
code
• Accepts analog input in the form of either voltage or current
• Produces digital output either in serial or parallel form
N = # of bits
2N − 1
VFS= Full scale output = Vref – 1 LSB = Vref 2N
V
𝑸 = min. resolvable input  1 LSB = 2ref
N
• Resolution:
• Resolution is the smallest input voltage change a digitizer can
capture
• Resolution of a N-bit ADC is defined as
Q=
Vref
2N
• ADC Equations:
where Vref = (Vref+ - Vref-).
If Vref- = 0 V, Vref = Vref+
Given Vin = input voltage, Vref = VFS, N = number of bits of precision.
V
output_code
Output_code = V in x 2N or Vin =
x Vref
2N
ref
Quantization Noise Model
• When an ADC converts a continuous signal into a discrete digital representation, there is a range of input values
that produces the same output. That range is called quantum (Q) and is equivalent to the Least Significant Bit
(LSB). The difference between input and output is called the quantization error.
• Therefore, the quantization error can be between ±Q/2.
Ideal ADC transfer
function
Ideal 3-bit ADC Quantization Noise
• Any value of the error is equally likely, so it has a
uniform distribution ranging from −Q/2 to +Q/2.
Then, this error can be considered a quantization
noise with RMS:
Signal-Noise Ratio (SNR) relates to N-bits in digital presentation
Assuming an input sinusoidal with peak-to-peak amplitude Vref, where Vref is the reference voltage of an N-bit ADC
(therefore, occupying the full-scale of the ADC), its RMS value is
To calculate the Signal-Noise Ratio, we divide the RMS of the input signal by the RMS of the quantization noise:
SNR = 6.02 x N + 1.76 (dB)
This SNR equation generalizes to any system using a digital representation.
ADC : Parameters
Number of bits N: The higher is the number of bits, the more precise is the digital output.
Quantisation error Eq: The average difference between the analogue input and the quantized value. The
quantization error of an ideal ADC is half of the step size.
Sample time Tsample: A sampling capacitor must be charged for a duration of Tsample before conversion taking place.
Conversion time Tconv: Time taken to convert the voltage on the sampling capacitor to a digital output.
Examples
1) Given Vref = 10V, N=12, and Vin = 9V. Find: (a) the resolution Q (1 LSB), (b) the output_code, (c) the quantization
noise vqn, (d) the SNR.
Solutions:
(a) A 12 bit ADC has a resolution of 212 = 4,096. Therefore, our best resolution is 1 part out of 4,096, or 0.0244% of
the full scale or 10V / 212 = 2.44 mV
V
9
(b) Output_ code = V in x 2N = 10 x 4096 = 368610 = 0xE66
FS
(c) vqn =
= 0.704 mV
(d) SNR = 6.02 x N + 1.76 = 6.02 x 12 + 1.76 = 74 dB
2) Given an input voltage Vin = 9V with Vref = 10V. Determine minimum bits (N) would be required to have less than ±
0.5% quantization error?
Q
V
Known: Absolute quantization error |QE| (in mV ) = ± . And, Q = ref
.
2
2N
Solution:
|𝑄𝐸|
Q
=
0.5%
=
0.005

|QE|
=
9000
mV
x
0.005
=
45
mV
=
9000 𝑚𝑉
2  Q = 90 mV/bit (LSB)
V
N = Vref = 10,000 mV ≈ 111
Q = 90 mV/bit = 2ref

2
N
90 mV
90 mV
log 111
N=
≈ 6.8  so minimum N = 8 because 7-bit DAC not available. Note: Higher N will also work but added
log 2
cost.
Examples
3) Given Vref = 10V, and a 10-bit A/D output code is 0x12A.
a) What is the ADC input voltage?
b) If the input voltage is Vin = 2.915 V, what is the output code?
c) What is the input voltage range that yield an output code of 0x005?
Solution:
1 LSB = Q = 10V / 210 = 0.00976 V = 9.76 mV  Q/2 = 4.88 mV
a) Vin = output_code / 2N * Vref = (0x12A) / 210 x 5 V = 298/1024 x 10 V
= 2.91015 V = 2910.15 mV (ADC Vin)
b) For the output code 0x12A, the input voltage range is 2910.15 ± Q/2 or
2905.27 mV < V0x12A < 2915.03 mV
So for Vin = 2.915 V the out put code is also 0x12A
c) The ideal input voltage to produce output code 5 is
V0x005 = 5 x 9.76 mV = 48.8 mV
The range for output code 0x005 is 48.8 ± 4.88 mV or
43.92 mV < V0x005 < 53.68 mV
Digital-to-Analog Converter (DAC)
• The digital data is processed by a microprocessor and output to a DAC.
• DAC is usually operated at the same rate fS as the ADC
• When the application demands, it is equipped with appropriate circuitry to remove any
output glitches arising in connection with input code changes. The resulting staircase-like
signal is finally passed through a smoothing filter to ease the effects of quantization noise.
DAC Characteristics
• An ideal DAC:
• Accepts digital input b1- bN
• Produces either analog output voltage or current
N = # of bits
V
Q = min. step size  1 LSB = 2ref
N
• LSB and MSB:
• LSB and MSB of a N-bit DAC is defined as
LSB =
Vref
2N
where Vref = (Vref+ - Vref-)
V
MSB = 2ref
If Vref- = 0 V, Vref = Vref+
V
N = log2 Qref  Resolution
• DAC Equations:
Given Vout = output voltage, Vref, N = number of bits of precision
V
input_code
Input_code = Vout x 2N or Vout =
x Vref
N
2
ref
V
Vout_max= Vref – Q = Vref – 1 LSB = Vref ( 1 – 2ref
N)
Example DAC Computations
1) Given N=3, Vref= 1.6V.
a) Find the LSB or Q value.
b) Find the MSB value.
c) Find the maximum output Vout_max
d) Find the output value Vout when the input code = 1012
Solution:
V
1.6 V
a) LSB = Q = 2ref
=
3
8 = 0.2V
V
1.6 V
b) MSB = ref =
= 0.8V
2
2
c) Vout_max = Vref – Q = 1.6 – 0.2 = 1.4V
d) Vout = Q (b1x22 + b2x21 + b3x20) = 0.2V (1x22 + 0x21 + 1x20) = 0.2V x 5 = 1V
2) Given Vref = 4V and an 8-bit DAC.
a) If the output voltage is 2.345 V, what is the DAC input code?
b) If the output voltage is 2.357 V, what is the DAC input code?
c) What conclusion can you draw from a) and b)?
Solution:
V
2.345
a) Input code = V in x 2N = 4 x 28 = 150.08 or 15010 = 0x96 (DAC input code)
ref
Vin
2.357
b) Input code = V x 2N = 4 x 28 = 150.85 or 15010 = 0x96 (DAC input code)
ref
c) Both output voltage differences are in the range of input_code of 0x96.
Example DAC Computations
3) A design requires step size or LSB = 0.002 V and the reference voltage Vref = 1.6V.
a) Determine the minimum resolution N.
b) Find the MSB value.
c) Find the maximum output Vout_max
d) Find the input code for the output voltage Vout = 0.799V
Solution:
V
1.6 V
a) N = log2 Qref = log2 0.002 = log2(800) = 9.64  N = 10 is minimum requirement
V
1.6 V
b) MSB = 2ref = 2 = 0.8V
c) Vout_max = VFS – Q = 1.6 – 0.002 = 1.598V
V
0.799
d) Input_code = Vout x 2N = 1.6 x 1024 = 511.36  Input_code = 51210 or 0x800
ref
Some Data Sheet Examples
References:
http://www.ni.com/white-paper/4806/en/
http://inst.eecs.berkeley.edu/~ee247/fa10/files07/lectures/L11_2_f10.pdf
http://194.81.104.27/~brian/DSP/ADC_notes.pdf
http://ume.gatech.edu/mechatronics_course/ADC_F08.pdf
ume.gatech.edu/mechatronics_course/ADC_F10.pptx
http://astro.temple.edu/~silage/Chapter8MS.pdf
http://www.embedded.com/design/configurable-systems/4025078/Understanding-analog-to-digital-converterspecifications
ume.gatech.edu/mechatronics_course/ADC_F12.pptx
http://www.elin.ttu.ee/~olev/lect2.pdf
http://my.ece.msstate.edu/faculty/reese/ece3724_pic16/lectures/adcdac.pdf
http://www.mediacollege.com/glossary/q/quantization.html
http://www.ti.com/lit/an/slaa013/slaa013.pdf
http://www.ti.com/europe/downloads/Key%20Parameters.pdf
https://courses.engr.illinois.edu/ece110/content/courseNotes/files/?samplingAndQuantization
http://www.onmyphd.com/?p=quantization.noise.snr
http://masteringelectronicsdesign.com/an-adc-and-dac-least-significant-bit-lsb/