Data Converters at Working Depth: R–2R and Weighted DACs, ADC Arithmetic, Sigma-Delta, INL/DNL/ENOB, Sample-and-Hold, PGA, Microcontroller Timing and On-Board AI
ADC Arithmetic and Architectures
An n-bit ADC on a full-scale range FSR has a step q = FSR/2ⁿ and a quantisation error of ±q/2 (uniform, so rms q/√12 = 0.289q). For 12 bits and 10 V: q = 2.44 mV, v_n = 0.705 mV rms, and for a full-scale sine the ideal SQNR = 6.02n + 1.76 = 74.0 dB. To resolve 0.1% needs 2ⁿ ≥ 1000, n = 10 bits. ENOB = (SINAD − 1.76)/6.02: a measured SINAD of 62 dB gives 10.0 bits, whatever the datasheet bit count. Flash: one comparator per level, 2ⁿ − 1 = 255 for 8 bits, one clock per conversion, but the comparator count (and power) doubles with each bit. Successive approximation: a binary search with a DAC, n clock cycles per conversion, so 12 bits at a 1 MHz clock takes 12 µs (≈ 83 kS/s before acquisition) — the best compromise of speed, resolution and power for data acquisition.
Dual-slope (integrating): integrate V_in for a fixed time T₁ (N₁ clock counts), then integrate −V_ref until the output returns to zero in time T₂; V_in = V_ref·T₂/T₁, independent of R, C and the clock frequency. With V_ref = 10 V, a 100 kHz clock, N₁ = 2000 (T₁ = 20 ms, a whole number of 50 Hz periods, so mains interference averages to zero) and V_in = 3.2 V: T₂ = 6.4 ms, count 640, conversion time ≤ 2T₁ = 40 ms — hence the 3½-digit bench meter. Sigma-delta: a 1-bit quantiser inside a feedback loop, running at an oversampling ratio OSR = f_s/2f_B, shapes the quantisation noise to high frequency; a digital decimation filter removes it. For an L-th order modulator SQNR ≈ 6.02N + 1.76 − 10log[π^(2L)/(2L + 1)] + (20L + 10)log OSR; with N = 1, OSR = 64: first order 56.8 dB (9.1 bits), second order 85.2 dB (13.9 bits) — resolution bought with oversampling instead of precision components, at a cost in bandwidth, so it dominates low-frequency, high-resolution instrumentation (weighing, temperature).
| ADC | Conversion time | Hardware | Typical use |
|---|---|---|---|
| Flash | 1 clock | 2ⁿ − 1 comparators | Video, oscilloscopes |
| SAR | n clocks | 1 comparator + DAC | Data acquisition, MCUs |
| Dual-slope | ≤ 2T₁ (tens of ms) | Integrator + counter | Digital multimeters |
| Sigma-delta | OSR × samples | 1-bit modulator + filter | Weighing, temperature, audio |
- Integrate V_in for fixed T₁T₁ = 20 ms, whole 50 Hz periods
- Integrate −V_ref back to zeroTakes time T₂
- V_in = V_ref·T₂/T₁Independent of R, C and clock
An n-bit ADC on a full-scale range FSR has a step q = FSR/2ⁿ and a quantisation error of ±q/2 (uniform, so rms q/√12 = 0.289q). For 12 bits and 10 V: q = 2.44 mV, v_n = 0.705 mV rms, and…
INL, DNL, ENOB, Sample-and-Hold, PGA and Multiplexing
DNL is the deviation of each code width from 1 LSB; INL is the accumulated deviation of the transfer curve from the ideal straight line, and for an end-point fit INL[k] is the running sum of DNL. DNL = −1 LSB means a code of zero width — a missing code. Take DNL = [0.2, −0.5, 0.8, −1.0, 0.3] LSB: INL = 0.2, -0.3, 0.5, -0.5, -0.2 LSB, and the fourth code is missing. DNL > −1 for every code guarantees a monotonic converter; INL ≤ ½ LSB is what makes a converter "accurate to its resolution". Dynamic range = 20 log(full scale/rms noise floor); ENOB from SINAD as above; aperture jitter t_j limits SNR to −20 log(2πf_in t_j): 1 ps jitter allows 104 dB at 1 MHz but only 64 dB at 100 MHz — clock quality can limit a fast converter more than its architecture.
Sample-and-hold. A switch charges a hold capacitor C_h; in hold the capacitor leaks, giving a droop rate I_leak/C_h: 10 nA into 1 nF droops 10 V/s, so a 12-bit, 10 V converter (½ LSB = 1.22 mV) tolerates a hold time of only 0.12 ms. The acquisition time to settle within ½ LSB is t = RC ln(2^(n+1)): R = 1 kΩ, C = 1 nF, n = 12 gives 9.0 µs — the minimum sampling interval the S/H allows. Programmable-gain amplifier: choose the gain so the signal fills the ADC range; for a 0–50 mV sensor into a 5 V ADC the gain is 100 (and its resolution with a 12-bit ADC becomes 1.2 µV at the input). Analog multiplexer: one ADC shared by N channels; the ADC must run at N × the per-channel rate (8 channels × 10 kS/s = 80 kS/s), and the source must settle after each switch (S/H plus a buffer), with crosstalk between adjacent channels a specification.
| Specification | Definition | Worked value |
|---|---|---|
| LSB (12 bit, 10 V) | FSR/2ⁿ | 2.44 mV |
| Quantisation noise | q/√12 | 0.705 mV rms |
| Ideal SQNR (12 bit) | 6.02n + 1.76 | 74.0 dB |
| ENOB at SINAD 62 dB | (SINAD − 1.76)/6.02 | 10.0 bits |
| Acquisition time | RC ln 2^(n+1) | 9.0 µs |
DNL is the deviation of each code width from 1 LSB; INL is the accumulated deviation of the transfer curve from the ideal straight line, and for an end-point fit INL[k] is the running sum…
Microcontroller Timing, Interfaces, IoT Power Budget and AI in Instrumentation
Timers and serial links. A periodic interrupt comes from a timer: with f_clk = 16 MHz, prescaler 64 and a wanted 1 kHz tick, counts = 16 MHz/(64 × 1000) = 250, so an 8-bit timer reloads at 250 − 1. A UART divides the clock by 16 × baud: for 9600 baud, divisor = 16 MHz/(16 × 9600) = 104.17, rounded to 104, an error of -0.16% (a UART tolerates about ±2–3%). A microcontroller's 10-bit ADC on a 3.3 V reference has an LSB of 3.22 mV. Interfaces: UART (asynchronous, 2 wires, point to point), SPI (synchronous, 4 wires, fast, one chip-select per device), I²C (2 wires, addressed, multi-device, slower). Memory-mapped I/O places peripherals in the memory address space (ordinary load/store), whereas port-mapped I/O uses separate IN/OUT instructions; address decoding uses the upper address lines: with 16 address lines (64 KB), A15 = 0 selecting a 32 KB RAM and A15 = 1 the peripheral block is the simplest decode. Interrupt-driven I/O replaces polling, and DMA moves ADC data to memory with no CPU cycles.
IoT node power. A node draws 20 mA for 1 s every 10 minutes and 5 µA asleep: average current = (20 mA × 1 s + 5 µA × 599 s)/600 s = 38.3 µA, so a 2400 mAh cell lasts 2.4 Ah/38.3 µA = 62,622 h ≈ 7.1 years (before self-discharge) — the duty cycle, not the active current, sets battery life. A data acquisition system chains sensor → conditioning → multiplexer → S/H → ADC → processor → storage or radio; virtual instrumentation replaces the front panel by software on a PC with the same hardware. AI in instrumentation: (i) sensor linearisation — fit the inverse characteristic from calibration data; (ii) calibration and tuning — adapt parameters from data; (iii) signal classification — assign a measurement to a known class. A two-line example: a sensor reading V = 0.02, 1.01, 2.03, 3.00, 4.02 V at 0, 25, 50, 75, 100 °C fits V = 0.0400T + 0.018, so T = (V − 0.018)/0.0400, with a worst residual of 15 mV (0.38 °C); a non-linear sensor needs a polynomial or a small neural network, trained on a held-out split to avoid over-fitting the calibration points.
| Interface | Wires | Addressing | Typical rate |
|---|---|---|---|
| UART | 2 (TX, RX) | Point to point | 9.6 kbaud – 1 Mbaud |
| SPI | 4 (SCLK, MOSI, MISO, CS) | Chip select per device | Up to tens of Mbit/s |
| I²C | 2 (SDA, SCL) | 7-bit address | 100 kbit/s – 3.4 Mbit/s |
Timers and serial links. A periodic interrupt comes from a timer: with f_clk = 16 MHz, prescaler 64 and a wanted 1 kHz tick, counts = 16 MHz/(64 × 1000) = 250, so an 8-bit timer reloads at…
Key takeaways
- DAC: LSB = V_ref/2ⁿ; weighted resistors need a 2^(n−1):1 spread, the R–2R ladder only R and 2R; current steering is fastest and segmentation tames glitches.
- ADC: step q = FSR/2ⁿ, quantisation noise q/√12, SQNR = 6.02n + 1.76 dB, ENOB = (SINAD − 1.76)/6.02; flash needs 2ⁿ − 1 comparators, SAR n clocks.
- Dual-slope: V_in = V_ref T₂/T₁, independent of R, C and the clock; T₁ at a mains multiple rejects interference. Sigma-delta buys resolution with oversampling.
- DNL = −1 LSB is a missing code; INL is the running sum of DNL; S/H droop = I_leak/C_h and acquisition t = RC ln 2^(n+1); aperture jitter limits SNR at high input frequency.
- Timer counts = f_clk/(prescaler × f_tick); UART divisor = f_clk/(16 × baud); IoT battery life follows the duty cycle; AI in instrumentation means linearisation, calibration and classification.
Practice questions (24)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
An 8-bit R–2R ladder DAC uses V_ref = 5 V. For input code 0xA5 (decimal 165) the output voltage in volts (three decimals) is:
Numerical answer — type the value.
Show answer
Answer: 3.223
V_out = V_ref × 165/256 = 3.223 V; the LSB is 5/256 = 19.53 mV. Dividing by 255 would be the mistake of treating the reference as full scale.The main reason an R–2R ladder is preferred to a binary-weighted resistor DAC in integrated circuits is that it:
Show answer
Answer: A — needs only two resistor values, which are easy to match
A weighted DAC at 8 bits needs resistors spanning 128:1 with the largest matched to 0.4%; the ladder uses only R and 2R. It still glitches at the major carry, and current steering is faster.A sensor reads V = 0.02, 1.01, 2.03, 3.00, 4.02 V at 0, 25, 50, 75, 100 °C. A least-squares line V = mT + b is fitted as a calibration. A later reading of 2.50 V corresponds, by inverting that line, to a temperature in °C (one decimal) of:
Numerical answer — type the value.
Show answer
Answer: 62.1
The fit is V = 0.0400T + 0.018; inverting, T = (2.50 − 0.018)/0.0400 = 62.1 °C. This is the simplest form of sensor linearisation by calibration; a non-linear sensor needs a polynomial or small neural network.
Show the other 21 questions
A converter has a measured SINAD of 62 dB. Its effective number of bits is nearest to:
Show answer
Answer: D — 10
ENOB = (SINAD − 1.76)/6.02 = 60.24/6.02 = 10.0. A 12-bit part with a 62 dB SINAD is delivering only 10 bits.In a dual-slope ADC, V_ref = 10 V, the clock is 100 kHz and the fixed integration period is 2000 counts. For V_in = 3.2 V the second-slope count is:
Numerical answer — type the value.
Show answer
Answer: 640
T₂ = T₁ V_in/V_ref = 20 ms × 0.32 = 6.4 ms, which is 640 clock counts. The result is independent of R, C and the clock frequency.Which statements about converter specifications are correct?
Show answer
Answer: A — A sigma-delta ADC achieves high resolution mainly through oversampling and noise shaping; C — INL is the accumulated deviation from the ideal transfer line; D — DNL = −1 LSB at a code means that code is missing
ENOB is at most the nominal bit count, because real noise and distortion only reduce it. The other three statements are the standard definitions.A sample-and-hold has R = 1 kΩ and C_h = 1 nF. The acquisition time to settle within ½ LSB of a 12-bit converter, t = RC ln(2^(n+1)), in µs (one decimal), is:
Numerical answer — type the value.
Show answer
Answer: 9.0
ln(2¹³) = 13 × 0.6931 = 9.01, so t = 1 µs × 9.01 = 9.0 µs. Using only one RC time constant would badly under-settle.A sensor produces 0–50 mV and feeds a 5 V full-scale ADC through a programmable-gain amplifier. The gain that uses the full ADC range is:
Show answer
Answer: B — 100
G = 5 V/50 mV = 100. A higher gain would clip the top of the signal, a lower one wastes bits of resolution.A microcontroller with a 16 MHz clock uses a prescaler of 64 to generate a 1 kHz tick from a timer. The timer count between ticks is:
Numerical answer — type the value.
Show answer
Answer: 250
Timer clock = 16 MHz/64 = 250 kHz; 250 kHz/1 kHz = 250 counts per tick, so an 8-bit timer reloads at 249 (counting 0 … 249).An IoT node draws 20 mA for 1 s every 10 minutes and 5 µA in sleep. A 2400 mAh battery lasts approximately:
Show answer
Answer: D — 7 years
Average current = (20 mA × 1 s + 5 µA × 599 s)/600 s ≈ 38 µA; 2.4 Ah/38 µA ≈ 62 600 h ≈ 7 years. The sleep current and duty cycle dominate, not the 20 mA burst.A 4-bit DAC with V_ref = 10 V gives V_o = V_ref·D/2⁴. For the input 1010, the output voltage, in V (two decimals), is ____.
Numerical answer — type the value.
Show answer
Answer: 6.25
D = 1010₂ = 10, so V_o = 10 × 10/16 = 6.25 V (the MSB alone gives 5 V, plus 1.25 V from the third bit). Dividing by 15 instead of 16 gives 6.67 V, a different full-scale convention than the one stated.The resolution of a 10-bit converter, expressed as a percentage of full scale (1/2¹⁰ × 100, three decimals), is ____.
Numerical answer — type the value.
Show answer
Answer: 0.098
100/1024 = 0.098 % of full scale. Answering 10 % divides by the number of bits instead of by 2¹⁰, which would make a 10-bit converter barely better than a 4-bit one.An asynchronous serial link (UART) keeps transmitter and receiver aligned without a shared clock line by
Show answer
Answer: D — framing each character with a start bit and stop bit(s) at an agreed baud rate
The falling start bit re-synchronises the receiver for each character, and both ends must agree on the baud rate. A separate clock wire and chip-select describe synchronous buses such as SPI, which is exactly what UART avoids.A sample-and-hold is placed ahead of a successive-approximation ADC chiefly to
Show answer
Answer: C — keep the input constant while the bits are being resolved
SAR compares the input with a sequence of trial codes; if the input moves by more than an LSB during the search, the result is wrong. Removing frequencies above Nyquist is the anti-aliasing filter's job, a different block.A UART runs at 9600 baud with 8 data bits, no parity and 1 stop bit (plus 1 start bit). The maximum throughput, in bytes per second, is ____.
Numerical answer — type the value.
Show answer
Answer: 960
Each byte costs 1 + 8 + 1 = 10 bit times, so 9600/10 = 960 bytes/s. Dividing by 8 (1200 bytes/s) forgets the framing overhead.An 8-bit binary-weighted-resistor DAC uses R = 10 kΩ for the MSB. The resistor for the LSB, in kΩ, is ____.
Numerical answer — type the value.
Show answer
Answer: 1280
Each lower bit doubles the resistor, so the LSB needs 2⁷R = 1280 kΩ. Using 2⁸R = 2560 kΩ miscounts: eight bits span seven doublings. This 128 : 1 spread is why the R–2R ladder is preferred on chips.The number of comparators in a 6-bit flash ADC is ____.
Numerical answer — type the value.
Show answer
Answer: 63
A flash ADC compares against every threshold between codes, 2ⁿ − 1 = 63 of them. Answering 64 counts codes rather than the boundaries between them; the exponential growth is why flash converters stop at about 8 bits.In an ADC transfer curve, one code is found to be 1.5 LSB wide. The differential non-linearity at that code, in LSB, is ____.
Numerical answer — type the value.
Show answer
Answer: 0.5
DNL = actual width − ideal width = 1.5 − 1 = +0.5 LSB. Answering 1.5 reports the width itself; a DNL of −1 LSB would mean a missing code.A sample-and-hold uses a 1 nF hold capacitor and the total leakage current at its node is 1 nA. The droop rate, in mV per ms, is ____.
Numerical answer — type the value.
Show answer
Answer: 1
dV/dt = I/C = 1 nA/1 nF = 1 V/s = 1 mV/ms. Answering 1 V/ms misplaces the factor 1000 between seconds and milliseconds; a bigger capacitor cuts droop but lengthens acquisition.Training a neural network to map a thermocouple's raw voltage (and cold-junction temperature) to the true process temperature is an example of
Show answer
Answer: C — supervised regression
Labelled pairs (reading → reference temperature) train a model whose output is a continuous number, which is regression. Classification is the tempting supervised alternative, but it outputs discrete labels such as "faulty/healthy", not a temperature.An 8-bit timer is clocked from 16 MHz through a prescaler of 8 and counts 0 → 255. The overflow period, in µs, is ____.
Numerical answer — type the value.
Show answer
Answer: 128
One tick = 8/16 MHz = 0.5 µs, and overflow takes 256 ticks: 128 µs. Using 255 ticks gives 127.5 µs, missing the step from 255 back to 0.Without noise shaping, oversampling by a factor OSR improves in-band SQNR by 10 log₁₀(OSR) dB. With OSR = 256 and 6.02 dB per bit, the number of extra effective bits (nearest integer) is ____.
Numerical answer — type the value.
Show answer
Answer: 4
10 log₁₀256 = 24.08 dB and 24.08/6.02 = 4 bits: each 4× of oversampling buys one bit. Answering 8 treats the gain as 20 log₁₀(OSR), which double-counts; noise shaping is what makes sigma-delta far better than this.A 12-bit ADC digitises a full-scale 100 kHz sine (peak-to-peak equal to full scale). For the sampling-instant error at the steepest point to stay within ½ LSB, the maximum aperture jitter, in ps (one decimal), is ____.
Numerical answer — type the value.
Show answer
Answer: 388.6
Max slope = 2πf·(FS/2); require slope × t_j ≤ FS/2¹³, so t_j ≤ 1/(2πf·2¹²) = 388.6 ps. Using 2¹³ in place of 2¹² (about 194 ps) treats the amplitude as the full peak-to-peak range.Which statements about the I²C and SPI buses are correct?
Show answer
Answer: B — I²C lines are open-drain and need pull-up resistors.; C — SPI is full-duplex: data move on MOSI and MISO at the same time.; D — I²C uses two lines, SDA and SCL, shared by all devices.
I²C is a two-wire open-drain bus (hence pull-ups) and addresses slaves in-band; SPI shifts data both ways each clock. SPI selects a slave with a dedicated chip-select line, so the 7-bit address statement transplants I²C behaviour onto SPI.