Digital signal processing lesson plan
Signals into numbers and back, on the Uno and the ESP32: sampling and aliasing, moving averages and FIR filters, IIR filters, the FFT, windows and leakage, pitch and beat detection, and a guitar tuner on a microphone and a TFT.
Objectives and materials
By the end, students can
- What a fixed sample rate can see, and what it gets wrong.
- Moving average, FIR and IIR, measured on real hum and steps.
- The FFT, windows, and finding pitch and beat.
- A guitar tuner from microphone to needle.
Materials for the whole unit
- Arduino Uno R3
- ESP32 DevKit V1
- Function generator x 2
- I2S microphone, INMP441
- Oscilloscope
- Resistor x 2
- TFT display, 240x320
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Sampling
What a fixed sample rate can see, and what it gets wrong.
| Lesson | Time | What students do |
|---|---|---|
| Sampling and NyquistAn Uno samples a signal generator at exactly 1000 Hz and finds the frequency in its samples: right up to 500 Hz, and a false, lower one above it. Aliasing, seen and measured. | 65 min |
|
Materials
- Arduino Uno R3
- Function generator
- Oscilloscope
Check for understanding
Each student finishes "Sampling and Nyquist" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "The anti-aliasing filter".
Filters
Moving average, FIR and IIR, measured on real hum and steps.
| Lesson | Time | What students do |
|---|---|---|
| Moving average and FIRA slow sensor with mains hum on top, at 500 samples a second: a 10-point moving average that cancels 50 Hz exactly, a 15-tap FIR low-pass, and what happens at 60 Hz. | 55 min |
|
| IIR filtersThe exponential moving average: one line, one variable, and a memory that never quite forgets. Its time constant measured on a square wave, and the trade between smoothing and lag. | 55 min |
|
Materials
- Arduino Uno R3
- Function generator x 2
- Oscilloscope
- Resistor x 2
Check for understanding
Each student finishes "IIR filters" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Which filter when".
The spectrum
The FFT, windows, and finding pitch and beat.
| Lesson | Time | What students do |
|---|---|---|
| The FFT128 samples at 4000 Hz through arduinoFFT on an Uno: bins 31.25 Hz apart, the biggest one is the pitch, a square wave shows its odd harmonics, and a tone above Nyquist folds into the spectrum. | 65 min |
|
| WindowingA tone between two bins smears across the whole spectrum. The same capture through the FFT with no window and with a Hamming window, and the leakage eight bins away measured both ways. | 55 min |
|
| Pitch and beat detectionAutocorrelation finds the pitch of a note on A0 whatever its wave shape, and an onset detector on A1 finds a drum’s beat and its tempo, measuring pitch in the quiet between beats. | 65 min |
|
Materials
- Arduino Uno R3
- Function generator x 2
- Oscilloscope
Check for understanding
Each student finishes "Pitch and beat detection" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Octave errors".
Boss project
A guitar tuner from microphone to needle.
| Lesson | Time | What students do |
|---|---|---|
| Boss: a guitar tunerAn ESP32 listens through an INMP441, decimates, autocorrelates, names the nearest guitar string and shows the cents on an ILI9341 with a needle that turns green in tune. | 70 min |
|
Materials
- ESP32 DevKit V1
- I2S microphone, INMP441
- TFT display, 240x320
Check for understanding
Each student finishes "Boss: a guitar tuner" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.