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: Violating this rule causes aliasing, where high-frequency content masquerades as lower frequencies, producing silently corrupted data that looks plausible but is wrong.
  • Explain: The Nyquist theorem is the single most important rule for digitizing analog signals: always sample at least twice the highest frequency present.
  • Explain: Sampling is like taking photos of a moving object -- take photos too slowly and you miss the action!
  • Explain: Scenario: You're designing a smart doorbell that records 5-second audio clips when the button is pressed.
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.
iotclass.org

Major section

For Kids: Meet the Sensor Squad!

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 microcontroller said, "I cannot watch continuously like you, Sammy.
  • I can only take snapshots -- like photographs.

Key terms

Blinking slowly
Blinking slowly is like undersampling -- you miss what is really happening!
iotclass.org

Major section

For Kids: Meet the Sensor Squad! (continued)

But the wheel was spinning 10 times per second!

  • In Max's photos, the wheel looked like it was barely moving -- or even going backwards!
  • 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.
  • Clips stored: 66 clips (fits in 4 MB with margin).

Numbers to remember

4 MBClips stored: 66 clips (fits in 4 MB with margin).

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.

Numbers to remember

200 kHzCh3: 200 kHz (ESP32 limit = 83 kHz → requires external ADC).
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.
iotclass.org

Deck summary

Key takeaways

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

  • Sampling is like taking photos of a moving object -- take photos too slowly and you miss the action!
  • But the wheel was spinning 10 times per second!
  • Max is not taking photos fast enough, so the fast spinning LOOKS like slow spinning.".
  • Scenario: You're designing a smart doorbell that records 5-second audio clips when the button is pressed.
iotclass.org

Retrieval practice

Recall check 1 of 2

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?

AIt changes the ADC into an analog output device
BIt removes the need to consider clip duration
CIt falls below the sampling requirement for that bandwidth
DIt increases the number of stored samples
Show answer

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

iotclass.org

Retrieval practice

Recall check 2 of 2

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.

Q3Place each sampling concept where it lives so you can predict whether a measured frequency is real or aliased.

ASignal bandwidth
BSampling clock
CADC samples
DAliased component
Show answer

Answer: A Separate source bandwidth, discrete capture, and interpretation so you can test the Nyquist condition and recognize aliasing instead of trusting every spectral peak.

iotclass.org

Print reference

Answers

Answer key.

  1. C · 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. A · Separate source bandwidth, discrete capture, and interpretation so you can test the Nyquist condition and recognize aliasing instead of trusting every spectral peak.
iotclass.org