Analog-to-Digital Conversion
In questa pagina 6
Digitization of a signal
The analog-to-digital conversion process follows three fundamental steps:
- Sampling: discretization of the time variable, performed by the Sample-and-Hold Amplifier (SHA).
- Quantization: discretization of the amplitude interval of the signal, performed by the Analog-to-Digital Converter (ADC).
- Coding: definition of a unique bit sequence for each quantization level, performed by the encoder.
Key parameters:
- maximum sampling rate, in sample/s;
- number of bits used to encode the quantized values, the resolution.
The two parameters are related: generally, as one increases the other decreases. (Sampling and aliasing issues are in Signal Acquisition - Sampling, Conditioning and FilteringAcquiring a signal means conditioning it, sampling it uniformly at Fs at least twice the (filtered) bandwidth to avoid aliasing, quantizing it and, when needed, reconstructing it by interpolation.Signal Acquisition - Sampling, Conditioning and Filtering → and Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →.)
Quantization
The quantizer is an ideal element that converts a continuous interval of possible input values into a finite set of output levels
where is the total number of used levels. Each element is a quantization level. The operation converts a continuous value into a discrete value . The input-output relationship is derived by dividing the continuous interval (where the input may vary) into sub-intervals , each associated with one level .
In the analysis the input is normalized with respect to the input range, taken as for a bipolar converter (positive and negative values in an interval symmetric about zero) or for a unipolar one (positive values only).
The quantization characteristic is a piecewise-defined function defined in with values in :
(: value of a generic sample in the continuous domain; : its quantized value, corresponding to level .)
The threshold levels (transition levels) are, ideally, the input values at which the output passes from one level to the adjacent one. The input range is typically wider than the range between the two extreme thresholds; its maximum value is the full-scale value .
Uniform quantization
ADCs mostly implement a uniform law: all levels are equally spaced. The quantization step is the distance between two adjacent levels. With bits and a bipolar converter:
Depending on the position of the thresholds one distinguishes quantization with rounding and with truncation.
Uniform quantization with rounding (bipolar):
- output values: with ;
- threshold levels: with ;
- quantization law: for .
The input-output characteristic is a staircase around the straight line : inside the linear region the steps follow the line, outside it (beyond the extreme thresholds) lie two saturation regions where the output stays constant.
Coding
The value of the quantization levels is generally encoded in binary: with digits one can encode up to levels. Specifying the number of bits of a converter is therefore equivalent to giving its resolution.
Example of the slide, ( levels), bipolar, with the normalized level:
| level | binary (offset) | two's complement | |
|---|---|---|---|
| 111 | 011 | ||
| 110 | 010 | ||
| 101 | 001 | ||
| 100 | 000 | ||
| 011 | 111 | ||
| 010 | 110 | ||
| 001 | 101 | ||
| 000 | 100 |
Formally, coding is a mapping with . The level , of value , is mapped to the number written in binary with digits: , , . If the quantized value coincides with , the coding rule assigns the binary word of bits, . Decoding is the inverse operation, , from the word back to .
Sample-and-Hold Amplifier
Whatever the conversion technique, the input variation during the conversion time must be at least smaller than the quantization error, i.e. half the quantization step, to avoid conversion errors on the least significant bit. The SHA samples the signal in a very short time and then keeps the voltage at the ADC input constant during the whole conversion.
Basic circuit: input , a switch controlled by a control circuit, a capacitor to ground, output across the capacitor.
- SAMPLE mode: the output exactly reproduces the input , usually with unity gain.
- HOLD mode: the output keeps the value it had when the transition occurred, until the next sample command. In this interval the ADC after the SHA performs the conversion.
- The capacitor is the temporary memory (hold). The slide plot shows the output as a staircase: segments marked S (sample) and H (hold) alternate within the sampling interval .
Issues
In the circuit with signal source with resistance on the input side and ADC input resistance on the output side, the SHA must reproduce the input value without uncertainty and with zero transition time, and maintain the output for a virtually infinite time.
- Sample phase: must charge to . For fast charging the time constant , hence the capacitance , must be reduced. Fully operational, the SHA is a low-pass filter with cut-off frequency
which must be sufficiently higher than the input signal bandwidth: , and so , must be small.
- Hold phase: to keep the capacitor voltage constant the time constant must be large, so must be high.
These requirements conflict. The slide solution uses two buffer amplifiers (voltage followers): the input amplifier reduces the source resistance seen by the capacitor when the switch is closed; the output amplifier makes the load resistance seen by the SHA very high. The circuit is: to a follower, then the switch driven by , capacitor to ground, then a second follower giving .
Types of ADC
| type | typical use | conversion time | maximum resolution | notes |
|---|---|---|---|---|
| Successive approximation | microcontrollers | order of s | 16-18 bit | general use in acquisition systems up to medium frequencies (some MHz) |
| Flash | oscilloscopes | order of ns | 8-10 bit | general use up to high frequencies (GHz range) |
| Integrating | multimeters | order of ms | 18-20 bit |
Flash ADC
- Based on a parallel comparison between the analog input and all the threshold voltages of the characteristic.
- The bits of the output word are obtained, at least theoretically, all at the same time: very high conversion speed.
- Comparisons are made by comparators in parallel; the thresholds come from a voltage divider.
- The comparator outputs give a "thermometer" code of : output 1 if , 0 if .
- The 7 binary comparator outputs are converted by a digital encoder into a 3-bit word.
Slide circuit (): a resistor ladder between and with resistors (top), (six in the middle), (bottom); seven comparators each compare with a tap of the ladder, with thresholds
| comparator | |||||||
|---|---|---|---|---|---|---|---|
| threshold |
and the coding block outputs for levels to .
Successive-approximation ADC
The result is determined by a single comparator that sequentially determines each bit of the output word. The technique consists of subsequent comparisons between the unknown input and the voltage generated at the output of a Digital-to-Analog Converter (DAC), proportional to the reference according to the output code :
A control logic varies based on the comparison until the correct final value is reached.
Block diagram: comparator ( input , input from the DAC) feeding a Control block with SOC (Start of Conversion) input and EOC (End of Conversion) output; a Register clocked by a Clock holds the bits and drives the DAC.
Procedure:
- Start Of Conversion (SOC): all bits are 0 except the most significant bit, set to 1.
- The register value goes to the DAC: .
- Comparison:
- : the MSB stays 1 and the next lower bit is set to 1, giving ;
- : the MSB is set to 0 and the next lower bit is set to 1, giving .
- The process ends when all bits in the register have been verified.
- End Of Conversion (EOC).
Slide example: . The trial values of are (first, at ), then , then , and finally : the final . (These values correspond to , i.e. 4 bits; the number of bits is not stated on the slide.)
Properties:
- At the end of the conversion the difference between and is smaller than the quantization step .
- Each bit check takes the same time , so the conversion duration is .
- Accuracy depends on: the noise generated in the internal components (especially the comparator), the stability over time of the reference voltage , the DAC accuracy.
Integrating converters
The slide only gives their typical figures (multimeters, conversion time of the order of ms, resolution up to 18-20 bit); no operating principle is shown.
Quantization error
- Granular error (quantization error in general): belongs to the input range of the ADC.
- Overload error: exceeds the full-scale values.
For the granular error
The greater the number of bits, the smaller the error. The plot of is a sawtooth between in the granular region and a linearly growing error in the two saturation regions.
Real converters
- A change in the value of the internal reference gives a proportional change in the step : gain error. (Slide plot: 3-bit characteristic with 0 to 8 V input, ideal vs real, the real staircase has a smaller slope; codes 000 to 111.)
- Non-uniformity of the quantization step gives deviations of the individual thresholds , hence a non-uniform characteristic: non-linearity error. (Slide plot with thresholds lying on a curve instead of the ideal line.)
Statistical model
The quantized signal can be written
The two terms are not independent, but for a sequence of samples the effect is in most cases "on average independent" of the non-quantized samples . It is realistic to treat as a sequence of independent random variables with the same probability density, i.e. is a white noise uniformly distributed in :
| statistic | value |
|---|---|
| mean | |
| variance | |
| correlation () |
(The slide writes both factors with the index ; the correlation condition is .) The quantizer is thus modelled as the signal going through unchanged plus an added error giving : a simple random number generator added to the samples represents the quantized signal sufficiently realistically.
See also Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop → for sensor accuracy, precision, resolution and quantization.
Versione ripasso
- A/D = sampling (SHA, time) + quantization (ADC, amplitude) + coding (encoder, bit words). Key parameters: maximum sampling rate (sample/s) and resolution (bits); one grows as the other falls. Sampling and aliasing: Signal Acquisition - Sampling, Conditioning and FilteringAcquiring a signal means conditioning it, sampling it uniformly at Fs at least twice the (filtered) bandwidth to avoid aliasing, quantizing it and, when needed, reconstructing it by interpolation.Signal Acquisition - Sampling, Conditioning and Filtering →, Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →.
- Quantizer: a continuous interval mapped to levels , , with thresholds . , , . Full-scale value . Normalized input range: bipolar , unipolar .
- Uniform law: (bipolar), with .
- Uniform rounding (bipolar): levels , ; thresholds ; law for . Staircase around , with saturation outside the extreme thresholds.
- Coding : level becomes the binary word of on bits (offset binary or two's complement). Decoding is . Specifying means specifying the resolution.
- SHA: SAMPLE mode ; HOLD mode keeps the value on while the ADC converts.
- Sample phase: must be small, so must be well above the signal bandwidth ( small).
- Hold phase: must be large ( large).
- Fix: input follower lowers the source resistance seen by ; output follower makes the load seen by the SHA very high.
- Input variation during must stay below the quantization error, i.e. half a step.
- Types of ADC:
- successive approximation: microcontrollers, s, 16-18 bit, up to some MHz;
- flash: oscilloscopes, ns, 8-10 bit, up to GHz;
- integrating: multimeters, ms, 18-20 bit.
- Flash: comparators in parallel on a resistor ladder give a thermometer code; a digital encoder gives the -bit word (all bits at once). Example : seven comparators at thresholds (listed in the body).
- Successive approximation: one comparator plus a DAC, .
- Procedure: SOC sets the MSB to 1 and the other bits to 0; the DAC gives ; if the bit stays 1, otherwise it is reset to 0; the next bit is set to 1; repeat down to the LSB; then EOC.
- Each bit takes time , so .
- Slide example: , trial values , , , (final , with ).
- At the end is below . Accuracy depends on comparator noise, stability of and DAC accuracy.
- Quantization error: .
- Granular error (inside the range): ; more bits, smaller error.
- Overload error: input beyond full scale, error grows linearly.
- Real converters: a change of the internal reference changes proportionally, giving a gain error; non-uniform steps move the thresholds , giving a non-linearity error.
- Statistical model: ; treat as white noise uniform in , independent of the samples:
- ;
- ;
- for .
- Typical errors: confusing (levels) with (bits); forgetting that successive-approximation time grows with the bits; making large in the sample phase (it must be small there); taking the granular error bound as instead of .
Teoria collegata
- Function Generators and AWG
- Course Overview and Measurement Fundamentals
- Electrical Measurements - Voltmeter and Multimeter
- Instrumentation and Measurement Technologies
- Lab 8 - Analog Output and Sensors with Arduino
- Measurement Systems - Architecture and Operating Principles
- Signal Acquisition - Sampling, Conditioning and Filtering
- The Oscilloscope