Salta al contenuto
Note per Studenti Analog-to-Digital Conversion Report

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 II of possible input values into a finite set of output levels

Q={Qk:0≤k≤B−1}Q = \{Q_k : 0 \le k \le B-1\}

where BB is the total number of used levels. Each element Qk∈QQ_k \in Q is a quantization level. The operation converts a continuous value xcx_c into a discrete value xqx_q. The input-output relationship is derived by dividing the continuous interval II (where the input may vary) into sub-intervals IkI_k, each associated with one level QkQ_k.

In the analysis the input is normalized with respect to the input range, taken as CI=[−1,1)C_I = [-1, 1) for a bipolar converter (positive and negative values in an interval symmetric about zero) or CI=[0,1)C_I = [0,1) for a unipolar one (positive values only).

The quantization characteristic is a piecewise-defined function Q(⋅)Q(\cdot) defined in II with values in QQ:

xq=Q(xc),xc∈I,xq∈Qx_q = Q(x_c), \qquad x_c \in I,\quad x_q \in Q

(xcx_c: value of a generic sample in the continuous domain; xqx_q: its quantized value, corresponding to level QkQ_k.)

The threshold levels (transition levels) TkT_k are, ideally, the B−1B-1 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 XFSX_{FS}.

Uniform quantization

ADCs mostly implement a uniform law: all levels are equally spaced. The quantization step Δ\Delta is the distance between two adjacent levels. With bb bits and a bipolar converter:

Δ=2B=2−(b−1)\Delta = \frac{2}{B} = 2^{-(b-1)}

Depending on the position of the thresholds one distinguishes quantization with rounding and with truncation.

Uniform quantization with rounding (bipolar):

  • output values: Q={−1,−1+Δ,…,−Δ,0,Δ,…,1−Δ}={kΔ}Q=\{-1,-1+\Delta,\dots,-\Delta,0,\Delta,\dots,1-\Delta\}=\{k\Delta\} with −B2≤k≤B2−1-\dfrac{B}{2}\le k\le\dfrac{B}{2}-1;
  • threshold levels: Tk=(k+12)ΔT_k=\left(k+\dfrac12\right)\Delta with −B2≤k≤B2−1-\dfrac{B}{2}\le k\le\dfrac{B}{2}-1;
  • quantization law: xq=Q(xc)=kΔx_q=Q(x_c)=k\Delta for (k−12)Δ≤xc≤(k+12)Δ\left(k-\dfrac12\right)\Delta\le x_c\le\left(k+\dfrac12\right)\Delta.

The input-output characteristic is a staircase around the straight line Q[s]=sQ[s]=s: 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 kk of the quantization levels is generally encoded in binary: with bb digits one can encode up to B=2bB=2^b levels. Specifying the number of bits bb of a converter is therefore equivalent to giving its resolution.

Example of the slide, b=3b=3 (B=8B=8 levels), bipolar, with xq/FSx_q/FS the normalized level:

level xq/FSx_q/FS binary (offset) two's complement
Q+3Q_{+3} 3/43/4 111 011
Q+2Q_{+2} 2/42/4 110 010
Q+1Q_{+1} 1/41/4 101 001
Q+0Q_{+0} 00 100 000
Q−1Q_{-1} −1/4-1/4 011 111
Q−2Q_{-2} −2/4-2/4 010 110
Q−3Q_{-3} −3/4-3/4 001 101
Q−4Q_{-4} −1-1 000 100

Formally, coding is a mapping C:Q→BbC: Q \to \mathbb{B}^b with B={0,1}\mathbb{B}=\{0,1\}. The level QkQ_k, of value k(2/B)k(2/B), is mapped to the number kk written in binary with bb digits: Qk→(k1k2…kb)Q_k \to (k_1k_2\dots k_b), km∈{0,1}k_m\in\{0,1\}, m=1,…,bm=1,\dots,b. If the quantized value xqx_q coincides with QkQ_k, the coding rule assigns the binary word of bb bits, x=C[xq]=(k1k2…kb)x=C[x_q]=(k_1k_2\dots k_b). Decoding is the inverse operation, C−1C^{-1}, from the word back to xq=Qxx_q=Q_x.

Sample-and-Hold Amplifier

Whatever the conversion technique, the input variation during the conversion time TADCT_{ADC} 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 vxv_x, a switch controlled by a control circuit, a capacitor CHC_H to ground, output vyv_y across the capacitor.

  • SAMPLE mode: the output vyv_y exactly reproduces the input vxv_x, 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 CHC_H 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 TsT_s.

Issues

In the circuit with signal source vgv_g with resistance RgR_g on the input side and ADC input resistance RLR_L 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: CHC_H must charge to QH=CHvy(⋅)Q_H = C_H v_y(\cdot). For fast charging the time constant RgCHR_g C_H, hence the capacitance CHC_H, must be reduced. Fully operational, the SHA is a low-pass filter with cut-off frequency

fH=12πRgCHf_H = \frac{1}{2\pi R_g C_H}

which must be sufficiently higher than the input signal bandwidth: RgCHR_gC_H, and so CHC_H, must be small.

  • Hold phase: to keep the capacitor voltage constant the time constant RLCHR_L C_H must be large, so CHC_H must be high.

These requirements conflict. The slide solution uses two buffer amplifiers (voltage followers): the input amplifier reduces the source resistance RSR_S seen by the capacitor when the switch is closed; the output amplifier makes the load resistance RLR_L seen by the SHA very high. The circuit is: vinv_{in} to a follower, then the switch driven by vSv_S, capacitor CC to ground, then a second follower giving voutv_{out}.

Types of ADC

type typical use conversion time maximum resolution notes
Successive approximation microcontrollers order of μ\mus 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 vxv_x and all the B−1B-1 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 TkT_k come from a voltage divider.
  • The comparator outputs give a "thermometer" code of vxv_x: output 1 if vx>Tkv_x > T_k, 0 if vx<Tkv_x<T_k.
  • The 7 binary comparator outputs are converted by a digital encoder into a 3-bit word.

Slide circuit (b=3b=3): a resistor ladder between +VFS+V_{FS} and −VFS-V_{FS} with resistors 3R/23R/2 (top), RR (six in the middle), R/2R/2 (bottom); seven comparators C1…C7C_1\dots C_7 each compare vxv_x with a tap of the ladder, with thresholds

comparator C1C_1 C2C_2 C3C_3 C4C_4 C5C_5 C6C_6 C7C_7
threshold −7Δ/2-7\Delta/2 −5Δ/2-5\Delta/2 −3Δ/2-3\Delta/2 −Δ/2-\Delta/2 +Δ/2+\Delta/2 +3Δ/2+3\Delta/2 +5Δ/2+5\Delta/2

and the coding block outputs b2b1b0b_2b_1b_0 for levels −4-4 to 33.

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 VxV_x and the voltage VxqV_{x_q} generated at the output of a Digital-to-Analog Converter (DAC), proportional to the reference VRV_R according to the output code xqx_q:

Vxq=xq2bVR=xqΔV_{x_q} = \frac{x_q}{2^b}V_R = x_q\Delta

A control logic varies xqx_q based on the comparison until the correct final value is reached.

Block diagram: comparator (++ input vxv_x, −- input VthV_{th} 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 b2b1b0b_2b_1b_0 and drives the DAC.

Procedure:

  1. Start Of Conversion (SOC): all bits are 0 except the most significant bit, set to 1.
  2. The register value goes to the DAC: Vxq=12VRV_{x_q}=\tfrac12 V_R.
  3. Comparison:
    • Vx>VxqV_x > V_{x_q}: the MSB stays 1 and the next lower bit is set to 1, giving Vxq=34VRV_{x_q}=\tfrac34 V_R;
    • Vx<VxqV_x < V_{x_q}: the MSB is set to 0 and the next lower bit is set to 1, giving Vxq=14VRV_{x_q}=\tfrac14 V_R.
  4. The process ends when all bits in the register have been verified.
  5. End Of Conversion (EOC).

Slide example: Vx=11.3ΔV_x = 11.3\Delta. The trial values of VxqV_{x_q} are 8Δ8\Delta (first, at t=0t=0), then 12Δ12\Delta, then 10Δ10\Delta, and finally 11Δ11\Delta: the final Vxq=11ΔV_{x_q}=11\Delta. (These values correspond to VR=16ΔV_R=16\Delta, i.e. 4 bits; the number of bits is not stated on the slide.)

Properties:

  • At the end of the conversion the difference between vxv_x and vxqv_{x_q} is smaller than the quantization step Δ=VR/2b\Delta=V_R/2^b.
  • Each bit check takes the same time TT, so the conversion duration is TADC=bTT_{ADC}=bT.
  • Accuracy depends on: the noise generated in the internal components (especially the comparator), the stability over time of the reference voltage VRV_R, 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

eq(xc)=xq−xc=Q(xc)−xce_q(x_c)=x_q-x_c=Q(x_c)-x_c

  • Granular error (quantization error in general): xcx_c belongs to the input range of the ADC.
  • Overload error: xcx_c exceeds the full-scale values.

For the granular error

−12Δ<eq(xc)<12Δ-\tfrac12\Delta < e_q(x_c) < \tfrac12\Delta

The greater the number of bits, the smaller the error. The plot of Q[s]−sQ[s]-s is a sawtooth between ±Δ/2\pm\Delta/2 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 Δ\Delta: 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 TkT_k, hence a non-uniform characteristic: non-linearity error. (Slide plot with thresholds T1…T7T_1\dots T_7 lying on a curve f(⋅)f(\cdot) instead of the ideal line.)

Statistical model

The quantized signal can be written

xq=xc+eq(xc)x_q = x_c + e_q(x_c)

The two terms are not independent, but for a sequence of samples xq(nTS)x_q(nT_S) the effect eq(nTS)e_q(nT_S) is in most cases "on average independent" of the non-quantized samples xc(nTS)x_c(nT_S). It is realistic to treat eq(nTS)e_q(nT_S) as a sequence of independent random variables with the same probability density, i.e. eqe_q is a white noise uniformly distributed in [−Δ/2,+Δ/2)[-\Delta/2,+\Delta/2):

statistic value
mean E[eq(nTs)]=0E[e_q(nT_s)]=0
variance E[eq2(nTs)]=Δ212E[e_q^2(nT_s)]=\dfrac{\Delta^2}{12}
correlation (m≠nm\ne n) E[eq(nTs) eq(mTs)]=0E[e_q(nT_s)\,e_q(mT_s)]=0

(The slide writes both factors with the index nn; the correlation condition is m≠nm\neq n.) The quantizer Q[s]Q[s] is thus modelled as the signal ss going through unchanged plus an added error eq[s]e_q[s] giving sqs_q: 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 II mapped to BB levels QkQ_k, 0≤k≤B−10\le k\le B-1, with B−1B-1 thresholds TkT_k. xq=Q(xc)x_q=Q(x_c), xc∈Ix_c\in I, xq∈Qx_q\in Q. Full-scale value XFSX_{FS}. Normalized input range: bipolar CI=[−1,1)C_I=[-1,1), unipolar CI=[0,1)C_I=[0,1).
  • Uniform law: Δ=2B=2−(b−1)\Delta=\dfrac{2}{B}=2^{-(b-1)} (bipolar), with B=2bB=2^b.
  • Uniform rounding (bipolar): levels Q={kΔ}Q=\{k\Delta\}, −B2≤k≤B2−1-\tfrac{B}{2}\le k\le \tfrac{B}{2}-1; thresholds Tk=(k+12)ΔT_k=(k+\tfrac12)\Delta; law xq=kΔx_q=k\Delta for (k−12)Δ≤xc≤(k+12)Δ(k-\tfrac12)\Delta\le x_c\le(k+\tfrac12)\Delta. Staircase around Q[s]=sQ[s]=s, with saturation outside the extreme thresholds.
  • Coding C:Q→{0,1}bC:Q\to\{0,1\}^b: level QkQ_k becomes the binary word of kk on bb bits (offset binary or two's complement). Decoding is C−1C^{-1}. Specifying bb means specifying the resolution.
  • SHA: SAMPLE mode vy=vxv_y=v_x; HOLD mode keeps the value on CHC_H while the ADC converts.
    • Sample phase: RgCHR_gC_H must be small, so fH=12πRgCHf_H=\dfrac{1}{2\pi R_gC_H} must be well above the signal bandwidth (CHC_H small).
    • Hold phase: RLCHR_LC_H must be large (CHC_H large).
    • Fix: input follower lowers the source resistance seen by CHC_H; output follower makes the load seen by the SHA very high.
    • Input variation during TADCT_{ADC} must stay below the quantization error, i.e. half a step.
  • Types of ADC:
    • successive approximation: microcontrollers, μ\mus, 16-18 bit, up to some MHz;
    • flash: oscilloscopes, ns, 8-10 bit, up to GHz;
    • integrating: multimeters, ms, 18-20 bit.
  • Flash: B−1B-1 comparators in parallel on a resistor ladder give a thermometer code; a digital encoder gives the bb-bit word (all bits at once). Example b=3b=3: seven comparators at thresholds ±Δ/2,±3Δ/2,±5Δ/2,±7Δ/2\pm\Delta/2,\pm3\Delta/2,\pm5\Delta/2,\pm7\Delta/2 (listed in the body).
  • Successive approximation: one comparator plus a DAC, Vxq=xq2bVR=xqΔV_{x_q}=\dfrac{x_q}{2^b}V_R=x_q\Delta.
    • Procedure: SOC sets the MSB to 1 and the other bits to 0; the DAC gives 12VR\tfrac12V_R; if Vx>VxqV_x>V_{x_q} 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 TT, so TADC=bTT_{ADC}=bT.
    • Slide example: Vx=11.3ΔV_x=11.3\Delta, trial values 8Δ8\Delta, 12Δ12\Delta, 10Δ10\Delta, 11Δ11\Delta (final Vxq=11ΔV_{x_q}=11\Delta, with VR=16ΔV_R=16\Delta).
    • At the end ∣vx−vxq∣|v_x-v_{x_q}| is below Δ\Delta. Accuracy depends on comparator noise, stability of VRV_R and DAC accuracy.
  • Quantization error: eq(xc)=xq−xc=Q(xc)−xce_q(x_c)=x_q-x_c=Q(x_c)-x_c.
    • Granular error (inside the range): −12Δ<eq<12Δ-\tfrac12\Delta<e_q<\tfrac12\Delta; more bits, smaller error.
    • Overload error: input beyond full scale, error grows linearly.
  • Real converters: a change of the internal reference changes Δ\Delta proportionally, giving a gain error; non-uniform steps move the thresholds TkT_k, giving a non-linearity error.
  • Statistical model: xq=xc+eq(xc)x_q=x_c+e_q(x_c); treat eqe_q as white noise uniform in [−Δ/2,+Δ/2)[-\Delta/2,+\Delta/2), independent of the samples:
    • E[eq]=0E[e_q]=0;
    • E[eq2]=Δ212E[e_q^2]=\dfrac{\Delta^2}{12};
    • E[eq(nTS) eq(mTS)]=0E[e_q(nT_S)\,e_q(mT_S)]=0 for m≠nm\ne n.
  • Typical errors: confusing BB (levels) with bb (bits); forgetting that successive-approximation time bTbT grows with the bits; making CHC_H large in the sample phase (it must be small there); taking the granular error bound as Δ\Delta instead of Δ/2\Delta/2.

Teoria collegata