25  ADC Sampling & Aliasing

fundamentals
signal-processing
ADC
sampling
sensors
In 60 Seconds

ADC sampling turns a continuous sensor voltage into timed digital measurements, and aliasing is what happens when that timing is too slow for the signal you are trying to observe. The practical rule is simple: identify the highest frequency you need, sample above twice that frequency, then add enough margin for real filters and noisy deployments. If you ignore that rule, a fast vibration can masquerade as a slower one and drive the entire IoT system toward false diagnosis.

25.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Classify Signal Types: Differentiate analog (continuous) from digital (discrete) signals and explain why ADC conversion is necessary for IoT sensor data
  • Calculate Nyquist Sampling Rates: Apply the Nyquist-Shannon theorem to determine minimum and practical sampling frequencies for real-world IoT sensors
  • Diagnose Aliasing Artifacts: Predict aliased frequencies using the formula \(f_{\text{alias}} = |f_{\text{sample}} - f_{\text{signal}}|\) and trace false readings to their root cause
  • Specify Anti-Aliasing Filter Parameters: Select appropriate low-pass filter cutoff frequencies and orders to prevent sampling distortion in a given ADC pipeline
  • Evaluate Sampling Trade-offs: Compare power consumption, data volume, and signal fidelity across different sampling rate and ADC resolution choices for battery-powered IoT deployments
  • Design Duty-Cycled Sampling Strategies: Combine Nyquist-compliant sampling rates with duty cycling to meet both accuracy and battery-life targets
MVU: Minimum Viable Understanding

Core Concept: Sampling converts continuous analog signals to discrete digital values by taking “snapshots” at regular intervals. The Nyquist theorem states you must sample at more than twice the highest signal frequency to avoid aliasing (false low-frequency artifacts).

Why It Matters: Every IoT sensor (temperature, pressure, light, motion) produces analog signals, but microcontrollers only understand digital numbers. Sample too slowly and you get aliasing - a 50 Hz vibration appears as 10 Hz, causing completely wrong readings. Sample too fast and you waste power, storage, and bandwidth.

Key Takeaway: Sample at 2.5-5x the highest frequency you need to capture. For a temperature sensor changing at 0.01 Hz, sample at 0.1 Hz (every 10 seconds). For vibration up to 500 Hz, sample at 1600 Hz minimum.

Hey there, young inventor! Let’s learn about sampling with our friend Sammy the Sensor!

Meet the Team:

  • Sammy the Sensor - Watches temperature all day long
  • Bella the Battery - Powers Sammy’s camera
  • Max the Memory Chip - Stores all the photos Sammy takes
  • Lila the Light - Blinks when Sammy takes a photo

The Big Question: Imagine you want to make a flipbook movie of a bouncing ball. How many pictures do you need to take?

Too Few Pictures (Sampling Too Slowly): If you only take 1 picture per second and the ball bounces 3 times per second, your flipbook will look WEIRD! The ball might seem to go backward or barely move. This is called aliasing - it’s like a magic trick gone wrong!

Just Right (Good Sampling): If you take 10 pictures per second for a ball bouncing 3 times per second, your flipbook looks smooth and correct. You captured the bouncing perfectly!

Too Many Pictures (Oversampling): If you take 1000 pictures per second… well, it looks the same as 10 pictures, but now Bella the Battery is tired, and Max the Memory is FULL!

The Magic Rule (Nyquist): Take at least 2 pictures for every bounce to see what’s really happening. Scientists call this the “Nyquist rule.” If the ball bounces 3 times per second, take at least 6 pictures per second!

Real Example: Sammy watches the temperature in your room. Temperature changes VERY slowly - maybe once every 100 seconds. So Sammy only needs to take 1 “photo” (measurement) every 10 seconds. Taking 1000 measurements per second would be silly and waste Bella’s energy!

Fun Challenge: If a merry-go-round spins 2 times per minute, how many pictures per minute do you need to make a good flipbook? (Hint: at least 2 x 2 = ?)

The Problem: Sensors measure the real world (temperature, light, pressure), which is continuous and smooth. But microcontrollers and computers only understand discrete numbers (0s and 1s).

The Solution: Signal processing bridges this gap by converting continuous analog signals into discrete digital values that computers can process.

Real-World Analogy: Imagine watching a movie. The real world moves smoothly, but a movie is actually 24 still pictures per second. Your brain fills in the gaps, so it looks smooth. Signal processing does the same thing - it takes “snapshots” of sensor values fast enough that we capture all the important information.

Key Terms:

  • Analog signal: a continuous quantity that can take infinitely many values, such as a thermistor voltage drifting smoothly with temperature.
  • Digital signal: a discrete representation limited to specific codes, such as ADC counts from 0 to 4095.
  • Sampling: taking repeated snapshots of the analog signal at fixed time intervals.
  • Sampling rate: how many snapshots are taken per second, measured in hertz.
  • Aliasing: a false low-frequency pattern created when the sample rate is too slow for the real signal.

The Bottom Line: Sample fast enough (at least 2x the fastest change you care about) to capture what matters without wasting resources.

Real-World Example: ECG Heart Rate Monitor

A wearable ECG sensor demonstrates the complete signal processing pipeline:

Raw Signal Characteristics:

  • Cardiac signal: 0.5-40 Hz frequency range (heart rate + waveform shape)
  • Powerline noise: 50/60 Hz interference from electrical environment
  • Muscle artifacts: High-frequency noise from arm movement
  • DC drift: Baseline wander from electrode contact variation

Processing Chain:

  1. High-pass filter (0.5 Hz cutoff): Removes DC drift and baseline wander
  2. Notch filter (50/60 Hz): Eliminates powerline interference
  3. Low-pass filter (40 Hz cutoff): Removes muscle artifacts and high-frequency noise
  4. Anti-aliasing filter (100 Hz): Prevents sampling distortion
  5. ADC sampling (250 Hz): Nyquist requires 2x the max frequency = 200 Hz minimum; 250 Hz provides 25% safety margin above Nyquist
  6. R-peak detection: Pan-Tompkins algorithm identifies heartbeat peaks
  7. Heart rate calculation: 72 BPM from R-R interval measurement (833 ms between peaks)

System Performance:

  • ADC resolution: 12-bit (0.8 mV precision for 3.3V range)
  • Power consumption: ~20 mW continuous operation (6 mA @ 3.3V)
  • Battery life: 8 hours on 50 mAh battery (50 mAh ÷ 6 mA = 8.3 hours)
  • Accuracy: +/-2 BPM compared to medical-grade ECG
  • Latency: <100 ms from heartbeat to BPM update

Key Lesson: Signal processing isn’t just about converting analog to digital - it’s about intelligently filtering noise, choosing appropriate sample rates, and balancing accuracy with power consumption.

25.2 Analog vs Digital Signals

Time: ~8 min | Level: Foundational | Unit: P02.C05.U01

25.2.1 The Continuous World

Physical phenomena are inherently continuous - temperature changes smoothly, light intensity varies gradually, and sound waves oscillate continuously.

Example: A thermometer might show 23.456789…C at one instant and 23.458123…C a moment later. There are infinite possible values between any two measurements.

25.2.2 The Digital Constraint

Microcontrollers and computers work with discrete digital values: - 8-bit number: Can only represent 256 different values (0-255) - 12-bit number: 4,096 different values (0-4095) - 16-bit number: 65,536 different values (0-65535)

This creates two challenges:

  1. Sampling: How often do we measure the signal? (temporal discretization)
  2. Quantization: How precisely do we measure each sample? (amplitude discretization)

Understanding Quantization: An 8-bit ADC divides the voltage range into 256 discrete levels. For a 3.3V range, this gives ~13 mV per step. A 12-bit ADC provides 4,096 levels (~0.8 mV per step), while a 16-bit ADC offers 65,536 levels (~0.05 mV per step). Higher resolution means finer measurements but typically requires more power and conversion time.

A four-stage analog-to-digital conversion pipeline showing a continuous sensor waveform entering an anti-aliasing filter, then sample-and-hold, then ADC quantization, and finally a discrete digital output with notes about what each stage contributes

Analog-to-digital conversion pipeline from sensor to digital value
Figure 25.1

ADC Pipeline: The complete analog-to-digital conversion process. Anti-aliasing filter removes high frequencies before sampling to prevent distortion. Sample & hold captures instantaneous voltage. ADC quantizes to nearest digital level.

This variant shows the same ADC pipeline with concrete values from a real temperature sensor - making abstract concepts tangible:

Temperature sensor ADC example showing 23.5 degrees Celsius as an analog voltage, a sampled hold value, quantization into a 12-bit ADC code, and the reconstructed digital reading used by the microcontroller
Figure 25.2: ADC pipeline with concrete temperature sensor values at each stage

Why this variant helps: The original shows abstract component names. This variant shows actual values flowing through a real temperature sensor - you can trace 23.5C from voltage (1.234V) through digital value (1534) and back. Understanding what happens to real data at each stage makes the pipeline tangible.


25.3 The Nyquist Theorem: How Fast to Sample?

Time: ~12 min | Level: Intermediate | Unit: P02.C05.U02

The fundamental question: How many times per second must we sample to accurately capture a changing signal?

Nyquist-Shannon Sampling Theorem: > To accurately capture a signal, you must sample at more than twice the highest frequency component.

Minimum Sampling Rate = 2 x Maximum Signal Frequency

Why exactly 2× the frequency? Consider sampling a 50 Hz sine wave:

Sampling at exactly 100 Hz (Nyquist limit):

  • You capture exactly 2 samples per wave cycle
  • Minimum needed to reconstruct: one at peak, one at trough
  • But phase ambiguity exists—you might catch all peaks or all zero-crossings

Sampling at 40 Hz (undersampling, 0.4× Nyquist rate):

  • Aliasing occurs: \(f_{\text{alias}} = |40 - 50| = 10 \text{ Hz}\)
  • The 50 Hz signal incorrectly appears as 10 Hz

Sampling at 250 Hz (2.5× Nyquist rate, 5× signal frequency):

  • You get 5 samples per wave cycle
  • Phase uncertainty eliminated
  • Margin allows for filter rolloff

Concrete example: A vibration sensor monitoring a 200 Hz bearing: - Nyquist minimum: 400 Hz - Practical engineering: 1000-2000 Hz (5-10× margin) - At 1600 Hz sampling, you get 8 samples per 200 Hz cycle, clearly capturing waveform shape plus harmonics up to 500 Hz (bearing defects show as 2-10× shaft frequency).

Three-panel Nyquist comparison showing undersampling producing the wrong reconstructed waveform, Nyquist minimum barely capturing the signal, and practical oversampling preserving shape with safety margin

Nyquist sampling rate comparison: undersampling, minimum, and oversampling
Figure 25.3

Nyquist Sampling Comparison: Undersampling causes aliasing distortion. Sampling exactly at 2f is theoretically sufficient but risky. Practical systems oversample at 5-10x the signal frequency for reliability.

What to try: Adjust the signal frequency and sampling rate sliders to see how different sampling rates affect signal reconstruction. Watch how undersampling (below 2× signal frequency) causes aliasing - the reconstructed signal shows a completely different frequency than the original!

This variant uses a movie filming analogy to make sampling rate intuitive:

Movie frame-rate analogy for Nyquist sampling showing too few frames creating backward wheel motion, a barely adequate frame rate, and a smoother oversampled capture that reflects the real motion
Figure 25.4: Nyquist sampling as movie frame rate: undersampling makes wheels spin backward, oversampling captures motion correctly

Why this variant helps: The original shows abstract frequency ratios (2f, 0.8f). Everyone has seen the “wagon wheel effect” in movies where car wheels appear to spin backward. This directly connects Nyquist undersampling to a visible, memorable phenomenon that students can visualize.

25.3.1 Practical Examples

Example 1: Temperature Sensor

  • Building HVAC changes slowly: ~0.01 Hz (1 cycle per 100 seconds)
  • Nyquist requirement: Sample > 0.02 Hz
  • Practical choice: 0.1 Hz (once every 10 seconds) provides 5x margin

Example 2: Heart Rate Monitor

  • Heart rate: 0.5-3 Hz (30-180 bpm)
  • Nyquist requirement: Sample > 6 Hz
  • Practical choice: 100-500 Hz to capture waveform shape, not just frequency

Example 3: Accelerometer for Vibration

  • Machine vibration: 0-1000 Hz
  • Nyquist requirement: Sample > 2000 Hz
  • Practical choice: 5000-10000 Hz for safety margin

Quick Reference: Common IoT Sampling Rates

  • Temperature monitoring: about 0.01 Hz, so Nyquist says 0.02 Hz; a practical choice is 0.1 Hz, or one sample every 10 seconds.
  • Soil moisture: about 0.0003 Hz, so Nyquist says 0.0006 Hz; a practical choice is 0.001 Hz, or roughly one sample every 1000 seconds.
  • Heart-rate waveform monitoring: around 3 Hz for rate alone, so Nyquist says 6 Hz; in practice systems often use about 250 Hz because they also need waveform shape.
  • Vibration analysis: around 500 Hz, so Nyquist says 1000 Hz; a practical predictive-maintenance system may use about 5000 Hz.
  • Audio processing: up to 20,000 Hz, so Nyquist says 40,000 Hz; 44,100 Hz remains the common practical standard.
  • Ultrasonic sensing: around 40,000 Hz, so Nyquist says 80,000 Hz; a practical choice is about 100,000 Hz for modest safety margin.

Key Insight: Slowly changing signals (temperature, moisture) need very low sampling rates, saving massive amounts of power. Fast signals (vibration, audio) require high rates but often operate duty-cycled (sample for short bursts, not continuously).

The Myth: “I should sample as fast as possible to get the best data quality.”

Why It’s Wrong: Higher sampling rates don’t improve signal quality beyond Nyquist requirements - they just waste resources.

The Reality:

Misconception #1: “1000 Hz is better than 100 Hz for all sensors” - Reality: Temperature changes at 0.01 Hz. Sampling at 1000 Hz captures the same 0.01 Hz signal 100,000 times without gaining new information. - Cost: 10x higher sampling rate = 10x more power, 10x more data storage, 10x more bandwidth - Better approach: Match sampling rate to signal bandwidth (5-10x Nyquist, not 1000x)

Misconception #2: “16-bit ADC is always better than 12-bit” - Reality: If your sensor accuracy is +/-1% (e.g., thermistor), 12-bit resolution (0.025%) already exceeds sensor precision by 40x. Using 16-bit (0.0015%) provides 667x more precision than the sensor can deliver! - Cost: 16-bit ADCs typically consume 3-5x more power than 12-bit - Better approach: Match ADC resolution to sensor precision, not maximum available bits

Real-World Example:

  • Inefficient design: Soil moisture sensor sampled at 1 kHz, 16-bit ADC, no filtering
    • Soil moisture changes over hours (0.0003 Hz)
    • Power consumption: 5 mA continuous
    • Battery life: 20 hours
  • Optimized design: Same sensor sampled at 0.01 Hz (once per 100 seconds), 10-bit ADC, median filter
    • Captures all relevant changes (30x Nyquist margin)
    • Power consumption: 50 uA average (100x reduction!)
    • Battery life: 2000 hours (83 days)
    • Data quality: Identical for the application

Key Lesson: “Good enough” signal processing saves 100x power without sacrificing data quality. Over-specification wastes resources on precision you can’t use.

Rule of Thumb:

  1. Identify maximum signal frequency (fmax)
  2. Sample at 5-10x fmax (not 100x or 1000x)
  3. Match ADC resolution to sensor accuracy +/-20% margin
  4. Filter intelligently to remove noise, not signal

Your Challenge: You’re designing a predictive maintenance system for industrial machinery. Your accelerometer detects vibrations indicating bearing wear.

Scenario Details:

  • Bearing frequency: Healthy bearings vibrate at 200 Hz (shaft rotation rate)
  • Wear signature: Damaged bearings show harmonics up to 500 Hz (2.5x fundamental)
  • Your accelerometer: ADXL345 digital accelerometer
    • Available sample rates: 25 Hz, 50 Hz, 100 Hz, 200 Hz, 400 Hz, 800 Hz, 1600 Hz, 3200 Hz
    • Power consumption scales with sample rate: 40 uA @ 100 Hz, 140 uA @ 3200 Hz
  • Power budget: Battery-powered sensor node, need 1-year battery life

Your Task: What sample rate should you choose? Show your reasoning.


Solution: Step-by-Step Analysis

Step 1: Identify Maximum Signal Frequency

  • Bearing fundamental: 200 Hz
  • Wear harmonics: up to 500 Hz
  • Maximum frequency to detect: 500 Hz (fmax)

Step 2: Apply Nyquist Theorem

  • Nyquist minimum: Sample rate > 2 x fmax = 2 x 500 Hz = 1000 Hz
  • Practical target: 5-10x margin -> 1250-1500 Hz minimum

Step 3: Evaluate Available Options

  • 400 Hz: only 0.4x the needed margin, about 60 uA, and not acceptable because it guarantees aliasing.
  • 800 Hz: about 1.6x margin, around 85 uA, but still too close to the limit for reliable field use.
  • 1600 Hz: about 3.2x margin, around 115 uA, and the best balanced option in this sensor’s sample-rate menu.
  • 3200 Hz: about 6.4x margin, around 140 uA, which works technically but spends more energy than the application needs.

Step 4: Power Budget Analysis

  • Battery capacity: 1000 mAh (typical AA battery)
  • Target lifetime: 1 year = 8760 hours
  • Allowed current: 1000 mAh / 8760 h = 114 uA average

Power consumption breakdown:

  • Accelerometer @ 1600 Hz: 115 uA
  • Microcontroller sleep mode: 20 uA
  • Wireless transmission (1% duty): 5 uA average
  • Total: ~140 uA (exceeds budget by 26 uA!)

Step 5: Optimization Strategy

Option B: Duty-cycle the accelerometer - Sample at 1600 Hz for 1 second every 10 seconds (10% duty cycle) - Accelerometer power: 115 uA x 10% = 11.5 uA average - Total: 11.5 + 20 + 5 = 36.5 uA - Battery life: 1000 mAh / 0.0365 mA = 27,400 hours = 3.1 years

Best Choice: 1600 Hz with 10% duty cycle

Why This Works:

  • Nyquist-compliant: 1600 Hz > 1000 Hz requirement (3.2x margin)
  • Catches transient events: 1-second bursts at 1600 Hz = 1600 samples per measurement window
  • Power-efficient: 10% duty cycle saves 90% accelerometer power
  • Exceeds 1-year target: 3+ years battery life
  • Practical: Bearings don’t wear instantly - sampling every 10 seconds catches degradation trends

Key Lessons:

  1. Nyquist is non-negotiable: 400 Hz would alias 500 Hz signals to 100 Hz (false readings!)
  2. Oversampling has costs: 3200 Hz provides no benefit over 1600 Hz for this application
  3. Duty cycling saves power: 10% duty cycle = 10x battery life extension
  4. Match sampling to physics: Bearing wear develops over days/weeks, not milliseconds

25.4 Aliasing: When Sampling is Too Slow

Time: ~9 min | Level: Intermediate | Unit: P02.C05.U03

What happens if you sample too slowly?

Fast signals masquerade as slow signals - this is called aliasing.

Visual Example: Imagine a wheel spinning at 60 RPM (1 revolution/second = 1 Hz). If you sample at 1.5 Hz (every 0.67 seconds), the wheel appears to spin slowly backward instead of forward!

IoT Example:

  • True signal: 50 Hz vibration (motor spinning at 3000 RPM)
  • Sampling rate: 40 Hz (too slow! Violates Nyquist)
  • Observed signal: Appears as 10 Hz vibration (completely wrong!)

Solution: Use anti-aliasing filter (low-pass) before ADC to remove frequencies above Nyquist limit.

Aliasing explainer showing a real 50 Hz vibration, a 75 Hz sampling system that folds it into a false 25 Hz reading, and a corrected design using higher sample rate plus anti-alias filtering

Aliasing effect: how undersampling distorts high-frequency signals
Figure 25.5

Aliasing Effect: When sampling rate is below Nyquist (2x signal frequency), high-frequency signals incorrectly appear as low-frequency signals. A 50 Hz vibration sampled at 40 Hz masquerades as 10 Hz. Anti-aliasing filters prevent this by removing high frequencies before sampling.

25.4.1 Calculating Aliased Frequencies

When a frequency \(f_{\text{signal}}\) is sampled at rate \(f_{\text{sample}}\) (where \(f_{\text{signal}} > f_{\text{sample}}/2\)), the aliased frequency is:

\[f_{\text{aliased}} = |f_{\text{sample}} - f_{\text{signal}}|\]

Example:

  • Signal: 60 Hz HVAC vibration
  • Sampling: 100 Hz
  • Nyquist limit: 50 Hz (100/2)
  • Since 60 Hz > 50 Hz, aliasing occurs
  • Aliased frequency: |100 - 60| = 40 Hz

The 60 Hz vibration appears as 40 Hz in your data!


25.5 Worked Example: Vibration Sensor Aliasing Diagnosis

Scenario: A factory installs vibration sensors on motors to detect bearing wear. The system reports motors vibrating at 25 Hz, triggering “low-frequency imbalance” alerts. However, mechanics inspect the motors and find nothing wrong. The motors are actually spinning at 3000 RPM = 50 Hz. What went wrong?


Step 1: Gather System Details

  • Motor speed: 3000 RPM, taken from the nameplate.
  • Expected vibration frequency: 50 Hz, because 3000 RPM / 60 = 50 revolutions per second.
  • Reported vibration frequency: 25 Hz, as seen on the dashboard.
  • ADC sampling rate: 75 Hz, based on the firmware configuration.
  • ADC resolution: 12-bit, based on the ESP32 hardware.
  • Anti-aliasing filter: none, confirmed during hardware inspection.

Step 2: Calculate Nyquist Frequency

Nyquist frequency = Sampling rate / 2 = 75 Hz / 2 = 37.5 Hz

Any signal above 37.5 Hz will be aliased (fold back into the 0-37.5 Hz range).


Step 3: Identify Aliasing

The actual 50 Hz vibration is above the 37.5 Hz Nyquist frequency. Aliasing formula:

\[f_{\text{alias}} = |f_{\text{sample}} - f_{\text{signal}}| = |75 \text{ Hz} - 50 \text{ Hz}| = 25 \text{ Hz}\]

Diagnosis: The 50 Hz motor vibration is aliasing to 25 Hz in the sampled data. The system is reading a false frequency!


Step 4: Verify with Frequency Analysis

If we also see a 25 Hz component when motor speed changes: - Motor at 3600 RPM (60 Hz) → Aliased to |75 - 60| = 15 Hz ✓ - Motor at 2400 RPM (40 Hz) → Above Nyquist (40 Hz > 37.5 Hz), so aliased to |75 - 40| = 35 Hz

The pattern confirms aliasing is occurring for frequencies above Nyquist.


Step 5: Calculate Required Sampling Rate

For accurate 50 Hz measurement: - Nyquist minimum: 2 × 50 Hz = 100 Hz - Practical safety margin: 5× = 250 Hz - Industry standard for vibration: 1000-2000 Hz (to capture harmonics up to 500 Hz)

Recommended: Sample at 1000 Hz to capture fundamental + first 10 harmonics (bearing defects show up as harmonics 2-10× shaft speed).


Step 6: Add Anti-Aliasing Filter

Even at 1000 Hz sampling, signals above 500 Hz (Nyquist) can alias. Install hardware low-pass filter:

  • Filter type: Bessel 4th-order (linear phase, no waveform distortion)
  • Cutoff frequency: 400 Hz (80% of Nyquist for rolloff margin)
  • Attenuation: -40 dB at 500 Hz (100× reduction of aliased frequencies)

Analog circuit (example using TL084 op-amp for 400 Hz cutoff):

Vin ──[10kΩ]──┬──[39nF]── GND
              │
              ├── [OpAmp] ── Vout (to ADC)
              │
              └──[10kΩ]── GND

Component calculation: \[f_c = \frac{1}{2\pi RC} = \frac{1}{2\pi \times 10\text{k}\Omega \times 39\text{nF}} \approx 408 \text{ Hz}\]

Using standard 39 nF capacitor with 10 kΩ resistor gives the desired 400 Hz cutoff frequency.


Step 7: Validate Fix

Before fix (75 Hz sampling, no anti-aliasing): - 50 Hz motor → displays as 25 Hz ✗ - False “low-frequency imbalance” alerts ✗ - Mechanics waste time inspecting healthy motors ✗

After fix (1000 Hz sampling, 400 Hz anti-aliasing filter): - 50 Hz motor → displays as 50 Hz ✓ - 100 Hz harmonic (2×) visible ✓ - 150 Hz harmonic (3×) visible ✓ - Bearing defect signature (harmonics at 2-10× speed) now detectable ✓ - Alerts only trigger for real issues ✓


Cost-Benefit Analysis:

  • Original false-alert cost: about 2 hours/week of mechanic time at $50/hour, or roughly $5,200/year in wasted labor.
  • Hardware fix: a 400 Hz analog filter at about $3 per sensor across 50 sensors, or $150 one-time.
  • Firmware update: about $800 one-time for one engineer day to raise the sample rate and update processing.
  • Total fix cost: about $950, with a 6-week payback period and the added benefit of catching real bearing issues earlier.

Key Lessons:

  1. Aliasing masquerades as real signals: 50 Hz vibration appeared as 25 Hz, triggering false diagnosis
  2. Nyquist is non-negotiable: 75 Hz sampling cannot accurately measure 50 Hz (need >100 Hz minimum)
  3. Anti-aliasing filter is mandatory: Even at 1000 Hz sampling, frequencies >500 Hz must be filtered before ADC
  4. Real-world validation: When sensor readings don’t match physical inspection, suspect aliasing or other signal processing errors
  5. Cost of poor sampling: False alerts cost $5,200/year in wasted labor — far exceeding the $950 fix cost

Takeaway: This example shows why the Nyquist theorem isn’t just theoretical — violating it causes expensive, hard-to-diagnose problems in production systems. Always oversample (5-10× signal bandwidth) and always use anti-aliasing filters.


Time: ~10 min | Difficulty: Beginner | No hardware needed

Challenge: You’re designing an IoT soil moisture sensor. The soil moisture changes over hours (fastest change: 0.5% per hour during irrigation). What sample rate should you choose?

Steps:

  1. Convert change rate to frequency: 0.5%/hour = 0.5%/3600s = 0.00014%/s → frequency ≈ 0.0003 Hz
  2. Apply Nyquist: Minimum sampling rate = 2 × 0.0003 Hz = 0.0006 Hz
  3. Add safety margin: 5× Nyquist = 0.003 Hz = 1 sample per 333 seconds ≈ 1 sample per 5 minutes

Recommended: Sample once every 10-15 minutes (0.001-0.0017 Hz) - Captures all changes (>3× Nyquist margin) - Saves battery (99.9% sleep time vs continuous sampling) - Typical implementation: Wake, sample, transmit, sleep for 600 seconds

Common Pitfalls

Developers often leave the ADC or digital sensor at its default sample rate because it “already works.” That default can be wildly wrong for the actual phenomenon. A vibration sensor sampled below Nyquist produces false low-frequency content, while a temperature sensor sampled thousands of times per second only burns battery and fills buffers with redundant data.

Even a “correct” digital sample rate cannot save you if high-frequency energy reaches the ADC input unfiltered. Noise, harmonics, and interference above fs/2 will fold back into the band of interest. Anti-aliasing is a hardware responsibility first, not something a later digital filter can undo after the bad samples are already captured.

Higher resolution and higher sample rate are only useful when the sensor, analog front-end, and power budget support them. If the sensor is noisy or only accurate to a coarse tolerance, extra ADC bits buy fake precision. If the signal changes slowly, extra samples only buy extra energy use.

25.6 Summary

Key concepts from this chapter:

  • Analog vs Digital: Continuous sensor signals must be discretized for digital processing
  • Nyquist Theorem: Sample at >2x the highest frequency you care about
  • Practical sampling: Use 5-10x oversampling for safety margin
  • Aliasing: Sampling too slowly makes fast signals appear slow
  • Anti-aliasing filters: Low-pass filter before ADC prevents aliasing artifacts
  • Resource optimization: Don’t over-sample - it wastes power, storage, and bandwidth
Concept Relationships: ADC Fundamentals
  • Sampling rate -> Nyquist theorem: the sample rate must be higher than 2x the highest signal frequency you actually care about.
  • Aliasing -> anti-aliasing filter: the analog low-pass filter removes frequencies above fs/2 before they can fold into false digital content.
  • ADC resolution -> sensor accuracy: the converter bit depth should match the real precision of the sensor chain instead of chasing meaningless extra digits.
  • Power consumption -> sampling frequency: faster sampling means more conversions, more data movement, and more energy unless the design duty-cycles intelligently.

Cross-module connection: Quantization and Filtering covers ADC resolution and digital noise reduction.

25.7 See Also

Summary diagram of ADC fundamentals showing the four main design checkpoints: identify signal bandwidth, choose a safe sample rate, filter before the ADC, and validate accuracy against power budget


25.8 Knowledge Check

25.9 What’s Next

Now that you can calculate Nyquist sampling rates and diagnose aliasing artifacts, explore these related topics: