← Back

This preview is the content that will print. Choose “Save as PDF” in your browser’s print dialog to make a PDF.

Metatransformer report

ADC sampling and honest resolution

Practice · 65 minutes · Convert ADC codes into calibrated quantities and choose sample rate, reference, and filtering from the signal rather than from nominal bit count.

Text report: images and diagrams are omitted, and links to project files are inactive. Keep the exported project alongside this PDF for wiring diagrams, models, and linked files.

Learning outcomes

  • Translate ADC counts to voltage with uncertainty, identify clipping and aliasing, and design a repeatable low-voltage sampling test.

Prerequisites

  • mcu-gpio
  • algebra-trig

Concepts

An analog-to-digital converter turns a continuous input range into numbered bins. It is like reporting a ruler position using only whole millimeters: nearby values may receive the same code. For an ideal N-bit converter spanning 0 to V_ref, there are 2^N codes and a nominal step near V_ref/2^N. A 12-bit, 3.3 V range therefore has about 0.806 mV per code. That is code width, not guaranteed measurement accuracy.

A useful conversion is V_est = code × V_ref/(2^N - 1) when the device maps the maximum code to the reference. Documentation may specify a different convention. Reference tolerance, input noise, nonlinearity, source impedance, and calibration all affect the result. A voltage divider must remain inside the pin’s allowed range under worst case, not merely at its typical input. For a 5 V signal into a 3.3 V-only ADC, equal resistors would produce 2.5 V, but input protection, grounding, source impedance, and fault voltage still need review.

Sampling also describes time. A sample rate f_s can represent a sinusoid unambiguously only when the signal is suitably band-limited below f_s/2. Sampling a 70 Hz tone at 100 samples/s can resemble 30 Hz: aliasing. More samples do not repair information already folded by inadequate analog bandwidth. A simple RC low-pass before the ADC can limit high-frequency content, but its time constant and ADC acquisition requirements must be chosen deliberately.

The build decision for a slow temperature sensor might be 10 samples/s and averaging, while a microphone envelope needs different bandwidth. A common misconception is that 12 bits means four decimal digits of truth. Repeated codes can reveal noise and effective resolution, but agreement with a calibrated reference establishes accuracy. Clipped runs of zero or maximum code indicate range failure, not a stable physical phenomenon.

Worked example

Problem

A 12-bit ADC uses a measured 3.28 V reference and returns code 2480. Using the endpoint-calibrated convention that maps code 4095 to the reference, estimate input voltage and the approximate quantization half-step.

Steps

  1. Maximum code is 2^12 - 1 = 4095.
  2. V_est = 2480 × 3.28 V / 4095 = 1.986 V (rounded).
  3. The ideal code-bin width is 3.28 V / 4096 = 0.801 mV, so the approximate quantization half-step is ±0.400 mV before other errors. The endpoint calibration factor above is a different convention from the bin width.

Result

The code corresponds to about 1.986 V with an ideal quantization half-step near ±0.00040 V; total measurement uncertainty is larger unless other errors are bounded.

Sanity check

2480/4095 ≈ 0.606 of full scale, and 0.606 × 3.28 V ≈ 1.99 V, safely within the range.

Check your understanding

A steady sensor repeatedly returns the maximum ADC code. What is the best first interpretation?

A. The physical quantity is exactly equal to the printed maximum B. The input may be clipping at or above the ADC range, so inspect the circuit and range before interpreting the quantity C. Averaging more maximum codes will recover the missing voltage D. The sample rate must be doubled because all constant signals alias

Your answer: ______________________________

Reasoning:



Answer key

ANSWER KEY — check only after attempting the question.

B. The input may be clipping at or above the ADC range, so inspect the circuit and range before interpreting the quantity

Maximum code marks the top representable bin and may hide any larger input. Circuit range and pin safety come first. Averaging clipped values cannot reconstruct excess amplitude. A constant signal does not alias merely because it is constant; doubling rate does not correct saturation.

Hands-on lab

Goal

Calibrate an ADC channel against a multimeter and distinguish quantization, noise, and clipping.

Equipment

  • 3.3 V microcontroller with ADC
  • 10 kΩ potentiometer
  • multimeter
  • breadboard and jumpers
  • serial console

Procedure

  1. With power disconnected, wire the potentiometer ends to 3.3 V and ground and its wiper to the ADC; check the board’s ADC range.
  2. At roughly 25%, 50%, and 75% rotation, collect 100 codes and separately measure wiper voltage with the meter.
  3. Calculate mean, minimum, maximum, code spread, and voltage estimate using a measured supply/reference if the board exposes it.
  4. Introduce a deliberate safe fault by moving the wiper near the upper rail until codes clip; identify the repeated maximum and then return to midrange.
  5. State whether differences are resolution, repeatability, reference, or meter uncertainty rather than calling them all ADC error.

What to observe

  • Expected: mean code rises monotonically with wiper voltage and near-rail readings may clip.
  • Record actual meter voltage, code statistics, and conversion residual at each point; expected values are not measurements.
  • Expected fault signature: many consecutive maximum codes lose information about further voltage increase.

Transfer challenge

Specify sample rate, input range, and one anti-alias measure for logging a slowly changing vacuum-blower pressure sensor without opening or modifying an appliance.

Cautions

  • Keep the wiper strictly within the documented ADC voltage range; disconnect power before changing wiring and do not probe household appliances.

Evidence record

Learner: ____________________ Date: ____________________

Evidence artifact or file: ____________________________________________

ItemRecord
Prediction or expected result
Actual observation or measurement
Conditions and tools used
Difference from expectation
Next decision or follow-up

Notes:




Sources and references

  1. MicroPython RP2 quick reference (opens in a new tab)
  2. MIT OpenCourseWare 6.002 Circuits and Electronics (opens in a new tab)