UNIT 11 · MOVING AND PROCESSING DATA
Analog Signals and Conversion
Turn voltages into numbers, and numbers back into voltages.
Temperature, light, current, sound and position all reach firmware as voltages, and an analog-to-digital converter turns them into numbers at chosen instants. Each step can quietly lose information: a signal sampled too slowly turns into a different one, a 12-bit converter delivers fewer than 12 useful bits, a high-impedance sensor leaves the sample capacitor half charged, and a software-timed loop smears the timing. The same care applies on the way out, when PWM or a DAC turns numbers back into voltages.
The unit in six ideas
- 1A sampled signal is described completely only if it contains nothing above the Nyquist frequency f_s / 2.
- 21 LSB = Vref / 2^N; code = ⌊Vin / Vref × 2^N⌋, limited to 2^N − 1.
- 3Every code is a fraction of Vref: reference errors are gain errors in every reading.
- 4Start conversions from a timer or run the ADC free; software-timed sampling carries all the code’s jitter.
- 5A moving average of N reduces random noise by √N and delays a step by (N − 1)/2 samples.
- 6Filtered PWM gives D × V_supply plus ripple ≈ V_supply D(1 − D) T / τ for T ≪ τ.
Lessons
Sampling, Aliasing, and Bandwidth
How can an ADC report a frequency that is not there, and how do you stop it?
Resolution, Quantization, and Accuracy
What does “12 bits” actually promise?
References, Input Impedance, and Acquisition Time
What are the ADC’s reference and input really doing?
Triggered Sampling and Conversion Sequences
Getting samples at the right moments and out of the ADC in time: software-started, free-running and timer-triggered conversions, why sampling-time jitter limits accuracy, sequences and round-robin scans over several inputs and the skew between them, and collecting results through FIFOs, interrupts and DMA without overruns.
Digital Filtering and Sensor Calibration
How do you tell them apart, and fix each?
Analog Outputs and PWM Filtering
Where is the balance?