You are on page 1of 27

ĐẠI HỌC QUỐC GIA TP.

HỒ CHÍ MINH
TRƯỜNG ĐẠI HỌC BÁCH KHOA
KHOA ĐIỆN-ĐIỆN TỬ
BỘ MÔN KỸ THUẬT ĐIỆN TỬ

Embedded System Design


Analog interface-Analog to Digital
Converter

1
1. ADC
• ADC stands for Analog to Digital Conversion

A Comparator is a circuit which compares an analog input voltage with a


reference voltage and determines which is larger, returning a 1-bit number

An Analog to Digital converter [AD or ADC] is a circuit which accepts an


analog input signal (usually a voltage) and produces a corresponding
multi-bit number at the output.

Comparator A/D Converter

Vin0 Vref
0
0
Vin1 1
Vin
0
Clock 1

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 2


ADC Transfer Function

What is the size of 1 LSB?

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 3


Question
• Give a 8 bits ADC, with Vref‐ = 0V, Vref+=5V. 
a) Calculate the ADC output value if Vin = 
4V.
b) If the ADC output value is 0xFF, what is 
the input voltage.
c) Calculate the quantization error.

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 4


ADC Transfer Function

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 5


Non ideal ADC
•The ideal output from an A/D 
converter is a stair‐step function 
(see right)
– Ideal worst case error in 
Nominal Quantized
conversion is  1/2 bit. 1101 value + 1/2 LSB

– Missing codes or the  1100
imperfections where  1011
increasing voltage does not  1010
result in the next step being  1001

Output Code

Output Code
output are described as non‐ 1000
monotonicity. 0111
1 LSB
– Errors in A/D conversion may  0110
be significant particularly if  0101
the full range of the analog  0100
Missing Code
signal is significantly less than  0011
the range of the analog input  0010
of the A/D. 0001
0000
-10 V Input Voltage 10 V

Bộ môn Kỹ Thuật Điện Tử - ĐHBK 6


A/D – Flash Conversion
•A multi‐level voltage divider is 
used to set voltage levels over  1V
3R Comparators
the complete range of  13/16 V +
conversion. 2R
-

•A comparator is used at each  11/16 V +
2R
level to determine whether the  -

voltage is lower or higher than  9/16 V +
2R
the level. -

•The series of comparator  7/16 V +
2R Encoder 3
outputs are encoded to a  -

binary number in digital logic  5/16 V +
2R
(an encoder) -
3/16 V +
2R
-
1/16 V +
R
-

Vin
Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 7
ADC Transfer Function
•The ideal output from an A/D 
converter is a stair‐step function 
(see right)
– Ideal worst case error in 
conversion is  1/2 bit.
– Missing codes or the 
imperfections where 
increasing voltage does not 
result in the next step being 
output are described as non‐
monotonicity.
– Errors in A/D conversion may 
be significant particularly if 
the full range of the analog 
signal is significantly less than 
the range of the analog input 
of the A/D.

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 8


ADC Basic Functionality

Bộ môn Kỹ Thuật Điện Tử - ĐHBKEmbedded Systems


Chapter 3 8-9 9
Digital value

time

• A waveform is sampled at a constant rate – every t
– Each such sample represents the instantaneous amplitude at the instant of sampling
– “At 37 ms, the input is 1.91341914513451451234311… V”
– Sampling converts a continuous time signal to a discrete time signal
• The sample can now be quantized (converted) into a digital value
– Quantization represents a continuous (analog) value with the closest discrete (digital) 
value
– “The sampled input voltage of 1.91341914513451451234311… V is best represented by 
the code 0x018, since it is in the range of 1.901 to 1.9980 V which corresponds to code 
0x018.”

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 10


Sampling problem
• Nyquist criterion
– Fsample >= 2 * Fmax frequency component
– Frequency components above ½ Fsample are aliased, distort 
measured signal
• Nyquist and the real world
– This theorem assumes we have a perfect filter with “brick 
wall” roll‐off
– Real world filters have more gentle roll‐off
– Inexpensive filters are even worse (e.g. first order filter is 20 
dB/decade, aka 6 dB/octave)
– So we have to choose a sampling frequency high enough 
that our filter attenuates aliasing components adequately
Bộ môn Kỹ Thuật Điện Tử - ĐHBKEmbedded Systems
Chapter 3 8-11 11
Diagram of typical ADC application

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 12


ADC pin impedance

If the hold capacitor is fully discharged, the minimum input impedance is RADC.
As the hold capacitor starts to charge, the current flowing into the pin will reduce.
If the hold capacitor is charged to a level equal to the external voltage there will
be only minimal charging current flowing into the analog input

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 13


Analog multiplexer

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 14


Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 15
Sample and hold

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 16


Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 17
If your application does not use the ADC, you must connect these pins as follows:
VDDA must be connected to VDD, and VSSA must be connected to the VSS of
the microcontroller
Make sure that VAREF is not greater than VDD. There is a protection diode from
VAREF to VDD.
Similarly VSSA should not be less than or greater than VSS. There are protection
diodes connected back-to-back between VSSA and VSS

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 18


REFERENCE VOLTAGE
value =((Analog input voltage)/(VREF+ - VREF-) * 2N
where n = number of bits of ADC digital output.
The reference voltage is the maximum input voltage that can be converted by the
ADC.
VREF is the reference voltage for the ADC

Question:

A circuit use 10 bits ADC with VREF+=5V, VREF-=0V to measure input voltage
and display the value to LCD.
Because of error on the VREF+ regulator, the real value of VREF+ is 4.8V. If we
put a 4V to Vin, what is the display value on the LCD?

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 19


Noise in analog input signal

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 20


Effect of source impedance on internal sampling

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 21


Effect of input capacitance

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 22


OP‐AMP buffer

Output impedance of the OPAMP is low, therefore we can increase the


sampling rate

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 23


Dynamic gain
The dynamic range is defined as the ratio between the largest and smallest values
that the ADC can reliably measure

It is important to match the ADC Dynamic range to the maximum signal


amplitude for best accuracy.
Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 24
Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 25
Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 26
Question
A RTD has this characteristic:

Sensor Resistance at 0oC = 100 ohms


Change in Resistance/ oC = 0.385 ohms
Sense current to excite Sensor= 1mA
Temperature range = 0 to 500 oC

a) We want to use it to measure temperature from 0 to 500oC, and the


resolution is 0.1oC. What is the dynamic range of the system.
b) The ADC should have how many bits resolution?
c) The current flow through the RTD is 1mA. What is the range of voltage on
the RTD?
d) The ADC has Vref+ = 5V, Vref- = 0V. What is the gain of the amplifier we
need to use to amplify the voltage of the RTD?
e) With the gain of 17, how many resolution bits the ADC should have?

Bộ môn Kỹ Thuật Điện Tử - ĐHBK Chapter 3 27

You might also like