Electronics & Circuits · Study deck

Sampling Design: Product Scenarios

A doorbell, thermometer, and ECG monitor do not need the same sample rate.

Voltage Vera is your guide for this deck.

analogdigitalnyquist
Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: Hardware filters can support lower sampling rates when their passband and stopband are specified against the source spectrum; a filter alone does not guarantee alias-free sampling.
  • Explain: If the sampling rate is too low, different signals can produce the same apparent pattern, and later processing cannot recover the missing changes.
  • Explain: Violating this rule causes aliasing, where high-frequency content masquerades as lower frequencies, producing silently corrupted data that looks plausible but is wrong.
  • Explain: Final optimization: A verified 40% compression reduction would leave ~228 GB, within a 256 GB card's nominal capacity.
iotclass.org

Major section

Start With the Decision

A doorbell, thermometer, and ECG monitor do not need the same sample rate.

  • Each product must preserve its fastest useful change without wasting power or storage.

A doorbell, thermometer, and ECG monitor do not need the same sample rate. Each product must preserve its fastest useful change without wasting power or storage.

iotclass.org

Major section

For Kids: Meet the Sensor Squad!

ECG records electrical activity from the heart.

  • A sample is one reading; the sample rate says how many readings are taken each second.
  • A temperature trend can be sampled slowly, while an ECG waveform needs enough samples to retain its shape.
  • the microcontroller said, "I cannot watch continuously like you, Sammy.

Key terms

If the sampling rate
If the sampling rate is too low, different signals can produce the same apparent pattern, and later processing cannot recover the missing changes.
Blinking slowly
Blinking slowly is like undersampling -- you miss what is really happening!
iotclass.org

Major section

For Kids: Meet the Sensor Squad! (continued)

In Max's photos, the wheel looked like it was barely moving -- or even going backwards!

  • If the sampling rate is too low, different signals can produce the same apparent pattern, and later processing cannot recover the missing changes.
  • I can only take snapshots -- like photographs.
  • But the wheel was spinning 10 times per second!
iotclass.org

Major section

For Kids: Meet the Sensor Squad! (continued)

Sampling is like taking photos of a moving object -- take photos too slowly and you miss the action!

  • Temperature Terry was watching a spinning wheel. "I can see it spinning smoothly, going round and round!".
  • the LED was confused. "That is like when car wheels look like they spin backwards in movies!".
  • "Exactly!" said ADC Andy. "That is called ALIASING.
iotclass.org

Major section

For Kids: Meet the Sensor Squad! (continued)

Max is not taking photos fast enough, so the fast spinning LOOKS like slow spinning.".

  • the battery asked, "How fast does Max need to take photos?".
  • Andy did some math. "The wheel spins 10 times per second.
  • Blinking slowly is like undersampling -- you miss what is really happening!
iotclass.org

Major section

Doorbell Sampling Design

Scenario: You're designing a smart doorbell that records 5-second audio clips when the button is pressed.

  • You need to select the ADC sampling rate for the ESP32 and calculate storage requirements.
  • Anti-aliasing filter: specify its transition band and stopband attenuation; a 6 kHz RC corner alone is not sufficient.
  • Hardware filters can support lower sampling rates when their passband and stopband are specified against the source spectrum; a filter alone does not guarantee alias-free sampling.

Why it matters

100 clips × 60 kB = 6 MB → Need to reduce to 66 clips OR add external flash.

iotclass.org

Major section

Deep dive: Adaptive Multi-Channel Sampling

The system must optimize storage/power by adapting sampling rates.

  • Ch3: 200 kHz (ESP32 limit = 83 kHz → requires external ADC).
  • Ch4: 100 kHz (requires external ADC).
  • Ch3: 200,000 × 2 × 86,400 = 34.6 GB/day (exceeds 30-day budget!).
  • Variable rate: Ch3 records only at night (bats), Ch2 only at dawn/dusk (birds).

Key terms

Anti-aliasing filters
Anti-aliasing filters are mandatory for each channel.
Adaptive/triggered recording
Adaptive/triggered recording is essential for battery-powered deployments.
iotclass.org

Major section

Deep dive: Adaptive Multi-Channel Sampling (continued)

Final optimization: A verified 40% compression reduction would leave ~228 GB, within a 256 GB card's nominal capacity.

  • Key lesson: Multi-channel systems with diverse sampling rates require careful storage/power budgeting.
  • Anti-aliasing filters are mandatory for each channel.
  • Adaptive/triggered recording is essential for battery-powered deployments.
iotclass.org

Major section

Key Takeaway

The Nyquist theorem is the single most important rule for digitizing analog signals: always sample at least twice the highest frequency present.

  • Violating this rule causes aliasing, where high-frequency content masquerades as lower frequencies, producing silently corrupted data that looks plausible but is wrong.
  • In battery-powered IoT devices, balancing sampling rate against power consumption is a critical design decision.
iotclass.org

Deck summary

Key takeaways

A doorbell, thermometer, and ECG monitor do not need the same sample rate.

  • ECG records electrical activity from the heart.
  • In Max's photos, the wheel looked like it was barely moving -- or even going backwards!
  • Sampling is like taking photos of a moving object -- take photos too slowly and you miss the action!
  • Max is not taking photos fast enough, so the fast spinning LOOKS like slow spinning.".
iotclass.org

Retrieval practice

Recall check 1 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q1The doorbell’s uncompressed audio exceeds its flash budget. Why is halving the sample rate a poor fix for the stated input bandwidth?

ABecause it supposedly turns the ADC into an analog output device.
BBecause it falls below the sampling rate needed for the input bandwidth.
CBecause it supposedly removes clip duration from the flash calculation.
DBecause it supposedly increases the count of stored audio samples.
Show answer

Answer: B The worked example identifies aliasing when the sample rate is reduced without narrowing the signal.

iotclass.org

Retrieval practice

Recall check 2 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q2A home sensor tracks slowly changing room temperature. What supports a slower sampling plan than an audio recorder?

AThe assumption that a larger sample count improves accuracy
BThe much slower meaningful change in the measured signal
CThe temperature sensor’s physical size by itself
DThe use of the same controller as an audio device
Show answer

Answer: B The temperature example sets sampling from its change rate and measurement purpose.

iotclass.org

Retrieval practice

Recall check 3 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q3A recorder samples slow temperature and fast audio on separate channels. Which filter plan protects both measurements?

APut one low-rate digital filter after both channels are already sampled.
BUse audio rate for temperature while omitting its analog input filter.
CSet each input's analog filter from its channel bandwidth and sample rate.
DUse temperature sample rate for both, risking aliasing of fast audio.
Show answer

Answer: C Each channel needs its own alias margin before conversion.

Q4What discrete values are produced at each sampling-clock instant?

ASignal bandwidth
BAnti-alias filter
CSampling clock
DADC samples
Show answer

Answer: D ADC samples belong in Capture samples because they are the discrete values produced at each clock instant.

iotclass.org

Print reference

Answers

Answer key.

  1. B · The worked example identifies aliasing when the sample rate is reduced without narrowing the signal.
  2. B · The temperature example sets sampling from its change rate and measurement purpose.
  3. C · Each channel needs its own alias margin before conversion.
  4. D · ADC samples belong in Capture samples because they are the discrete values produced at each clock instant.
iotclass.org