11-17-2025, 02:43 PM
Thread 9 — Digital Signal Processing (DSP)
How Electronics Interpret Sound, Light, Motion & Data
Digital Signal Processing (DSP) is the science of converting real-world signals
— audio, images, vibration, radio waves, sensor data —
into digital form so computers and microcontrollers can analyze them.
DSP powers:
• microphones and speakers
• phone cameras
• medical scanners
• seismographs
• satellite communication
• robotics and self-driving systems
• image stabilization
• noise suppression
This thread builds a strong foundation for understanding how DSP works.
1. What Is a Signal?
A signal is any quantity that varies over time —
voltage, sound pressure, vibration, light intensity, etc.
Analog signal examples:
• voice picked up by a microphone
• ECG heartbeat waveform
• accelerometer vibration
• light captured by a camera sensor
DSP converts these analog waveforms into numbers
so computers can process them.
2. Sampling — Turning Signals Into Numbers
A microcontroller or ADC takes “samples” of a signal at regular intervals.
Sampling frequency (Fs):
how many samples per second are recorded.
Examples:
• CD audio: 44,100 Hz
• Phone microphones: ~8,000–48,000 Hz
• Seismometers: 100–500 Hz
• Camera video: 30–240 samples (frames) per second
Nyquist Rule:
To capture a frequency f, you must sample at least 2f.
So to capture 10 kHz audio → sample ≥ 20 kHz.
3. Quantisation — Turning Each Sample Into a Number
Each analog sample is mapped to a digital value.
Bit depth determines accuracy:
• 8-bit → 256 levels
• 12-bit → 4096 levels
• 16-bit → 65,536 levels
• 24-bit → 16.7 million levels
Higher bit depth = more detail & less noise.
4. Filters — Removing Unwanted Parts of a Signal
Filters reshape signals.
Low-pass filter (LPF):
lets low frequencies through (remove hiss, jitter).
High-pass filter (HPF):
lets high frequencies through (remove hum, DC offset).
Band-pass filter:
keeps only a selected range.
Band-stop / notch filter:
removes a specific frequency (e.g., 50/60 Hz mains hum).
Filters exist in:
• analog circuits
• digital algorithms (DSP)
5. Fourier Transform — The Heart of DSP
The Fourier Transform converts a time-domain signal
into its frequency components.
Instead of seeing the waveform itself,
we see *which frequencies* are present.
Example: A guitar chord
→ time-domain: complex waveform
→ frequency-domain: peaks at musical notes
Digital version used in DSP:
Fast Fourier Transform (FFT)
Applications:
• audio analysis
• vibration monitoring
• RF communication
• astronomy (spectral analysis)
• image compression
6. Convolution — How Filters Work Internally
Convolution slides a filter “kernel” across the signal.
Used for:
• blurring or sharpening images
• edge detection
• smoothing sensor data
• motion tracking
• machine learning
Convolution is at the heart of:
CNNs (Convolutional Neural Networks)
7. DSP in Microcontrollers
Modern MCUs (ARM Cortex-M series, ESP32) include DSP instructions.
Microcontrollers can perform:
• FFTs
• filtering
• decimation
• interpolation
• noise reduction
Common sensor applications:
• accelerometers (vibration analysis)
• gyroscopes (orientation)
• microphones (audio processing)
• motor control (current wave shaping)
8. Example: Real-Time Low-Pass Filter in Code
Simple digital smoothing filter:
Where:
• alpha = smoothing factor (0.0 to 1.0)
• smaller alpha = more smoothing
• larger alpha = more responsiveness
Used for:
• stabilizing sensor readings
• removing noise
• making robotics more reliable
9. Example: Detecting Frequency with FFT
Pseudo-code:
This is how apps detect pitch — and how machines detect vibration problems.
10. What You Can Build With DSP
Here are real project ideas users can build:
• digital oscilloscope
• vibration analyzer
• spectrum analyser
• audio visualizer
• noise gate for microphones
• step detection (accelerometer DSP)
• seismic monitor
• motor vibration health monitor
• heart-rate detection from IR sensor
• remote sensing & signal decoding
DSP unlocks the real world.
11. Recommended Next Threads
• Thread 10 — Build a Simple DSP-Based Spectrum Analyzer
• Thread 11 — Real-Time Sensor Fusion (Kalman Filters)
• Thread 12 — Introduction to Control Theory
End of Thread — Digital Signal Processing (DSP)
How Electronics Interpret Sound, Light, Motion & Data
Digital Signal Processing (DSP) is the science of converting real-world signals
— audio, images, vibration, radio waves, sensor data —
into digital form so computers and microcontrollers can analyze them.
DSP powers:
• microphones and speakers
• phone cameras
• medical scanners
• seismographs
• satellite communication
• robotics and self-driving systems
• image stabilization
• noise suppression
This thread builds a strong foundation for understanding how DSP works.
1. What Is a Signal?
A signal is any quantity that varies over time —
voltage, sound pressure, vibration, light intensity, etc.
Analog signal examples:
• voice picked up by a microphone
• ECG heartbeat waveform
• accelerometer vibration
• light captured by a camera sensor
DSP converts these analog waveforms into numbers
so computers can process them.
2. Sampling — Turning Signals Into Numbers
A microcontroller or ADC takes “samples” of a signal at regular intervals.
Sampling frequency (Fs):
how many samples per second are recorded.
Examples:
• CD audio: 44,100 Hz
• Phone microphones: ~8,000–48,000 Hz
• Seismometers: 100–500 Hz
• Camera video: 30–240 samples (frames) per second
Nyquist Rule:
To capture a frequency f, you must sample at least 2f.
So to capture 10 kHz audio → sample ≥ 20 kHz.
3. Quantisation — Turning Each Sample Into a Number
Each analog sample is mapped to a digital value.
Bit depth determines accuracy:
• 8-bit → 256 levels
• 12-bit → 4096 levels
• 16-bit → 65,536 levels
• 24-bit → 16.7 million levels
Higher bit depth = more detail & less noise.
4. Filters — Removing Unwanted Parts of a Signal
Filters reshape signals.
Low-pass filter (LPF):
lets low frequencies through (remove hiss, jitter).
High-pass filter (HPF):
lets high frequencies through (remove hum, DC offset).
Band-pass filter:
keeps only a selected range.
Band-stop / notch filter:
removes a specific frequency (e.g., 50/60 Hz mains hum).
Filters exist in:
• analog circuits
• digital algorithms (DSP)
5. Fourier Transform — The Heart of DSP
The Fourier Transform converts a time-domain signal
into its frequency components.
Instead of seeing the waveform itself,
we see *which frequencies* are present.
Example: A guitar chord
→ time-domain: complex waveform
→ frequency-domain: peaks at musical notes
Digital version used in DSP:
Fast Fourier Transform (FFT)
Applications:
• audio analysis
• vibration monitoring
• RF communication
• astronomy (spectral analysis)
• image compression
6. Convolution — How Filters Work Internally
Convolution slides a filter “kernel” across the signal.
Used for:
• blurring or sharpening images
• edge detection
• smoothing sensor data
• motion tracking
• machine learning
Convolution is at the heart of:
CNNs (Convolutional Neural Networks)
7. DSP in Microcontrollers
Modern MCUs (ARM Cortex-M series, ESP32) include DSP instructions.
Microcontrollers can perform:
• FFTs
• filtering
• decimation
• interpolation
• noise reduction
Common sensor applications:
• accelerometers (vibration analysis)
• gyroscopes (orientation)
• microphones (audio processing)
• motor control (current wave shaping)
8. Example: Real-Time Low-Pass Filter in Code
Simple digital smoothing filter:
Code:
float smooth(float prev, float input, float alpha) {
return alpha * input + (1 - alpha) * prev;
}Where:
• alpha = smoothing factor (0.0 to 1.0)
• smaller alpha = more smoothing
• larger alpha = more responsiveness
Used for:
• stabilizing sensor readings
• removing noise
• making robotics more reliable
9. Example: Detecting Frequency with FFT
Pseudo-code:
Code:
// collect samples into array
for (int i = 0; i < N; i++) {
samples[i] = analogRead(micPin);
}
// run FFT
runFFT(samples);
// find the strongest frequency peak
float peak = findDominantFrequency();This is how apps detect pitch — and how machines detect vibration problems.
10. What You Can Build With DSP
Here are real project ideas users can build:
• digital oscilloscope
• vibration analyzer
• spectrum analyser
• audio visualizer
• noise gate for microphones
• step detection (accelerometer DSP)
• seismic monitor
• motor vibration health monitor
• heart-rate detection from IR sensor
• remote sensing & signal decoding
DSP unlocks the real world.
11. Recommended Next Threads
• Thread 10 — Build a Simple DSP-Based Spectrum Analyzer
• Thread 11 — Real-Time Sensor Fusion (Kalman Filters)
• Thread 12 — Introduction to Control Theory
End of Thread — Digital Signal Processing (DSP)
