Skip to main content
Version: FILS English

WaveScope

An embedded device that captures, modulates and filters audio from an electret microphone for signal analysis.

info

Author: Omer Genan
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-genan2003

Description

This device is designed for audio signal processing, showcasing two fundamental principles in the field: modulation and filtering. It captures sound from an electret microphone (MAX4466) and applies digital signal processing techniques to clean and manipulate the signal. Specifically, it utilizes a biquad filter for frequency-based filtering and a Kalman filter for dynamic noise reduction and signal smoothing. All processing and computations are carried out by the microcontroller unit (NUCLEO-STM32F767ZI), which is equipped with a double-precision floating-point unit to efficiently perform mathematical functions using floating-point values. Once processed, the data is transmitted to a computer for visualization, including real-time audio feedback and plotting.

Motivation

I chose this project because I have always been passionate about control theory and digital signal processing. These fields are fundamental to understanding how we can analyze, modify, and control the signals that surround us in everyday life — from audio and video to data transmission and sensor measurements. I believe it's important for every engineer to understand how signals work and how we can shape them using mathematical tools.

Beyond the technical interest, I see mathematics as a form of art. This project gives me the opportunity to explore that artistic side by offering both visual and audio interpretations of mathematical concepts.

Architecture

Schematic Diagram

Main components:

  • NUCLEO-STM32F767ZI will handle all computations and signal processing, then send the processed data via USB to the laptop. This allows the user to both listen to the processed signal (a recording) and view plots to observe the differences before and after processing.
  • MAX4466 will capture sound from the user and send the signal through a GPIO pin with ADC capability. Since it's an analog sensor, the analog signal must be converted into a digital format for processing.

User interface:

  • Button will be used to manually start the recording, preventing memory overflow that could occur if the board continuously recorded audio.

Feedback:

  • LEDs will indicate whether the device is currently recording.

Log

Week 21 April - 28 April

I began by studying how the MAX4466 behaves and tried to find a suitable gain setting for it by connecting it to the board and printing the output values to the terminal.

Week 28 April - 4 May

I implemented USB data transmission to a Python script that listens to the port where the board is connected. I then tried to analyze how the raw audio from the microphone sounds and also plotted the data received from the microcontroller.

Week 5 - 11 May

I implemented a Kalman filter and started analyzing the processed data. From what I observe, further processing is necessary. While the Kalman filter performs well, I also want to remove the DC offset in the signal. So, I changed my strategy and added a slow low-pass filter to eliminate the DC offset. This combination currently works well alongside the Kalman filter. However, I still need to work on improving the processing and filtering even further.

Week 12 - 18 May

After several attempts using only a slow low-pass filter and a tuned Kalman filter, I think it's time to switch to a biquad filter. So, I implemented a biquad filter (a low-pass and a high-pass filter cascaded). I also started using the Kalman filter for smoothing, and the results are better than before. The next step is to analyze the audio signal under varying noise conditions.

Week 19 - 25 May

After more than 100 code iterations, I’ve finally achieved a solid filter calibration—now with adaptive capabilities. The new setup features an adaptive Kalman filter and a biquad filter. The results are very promising. However, I encountered an issue: residual noise persists even when I'm not speaking. To address this, I implemented a voice activity detection (VAD) system to suppress the noise whenever no speech is detected.

Week 26 - 29 May

This week, I focused more on noise reduction. I added a noise gate to eliminate additional background noise, but I eventually reached a point where software alone wasn’t enough. To improve the results, I experimented with advanced signal processing techniques, such as spectral analysis and component-level filtering. These approaches improved performance—but only for about two seconds, which isn’t sufficient for my goals. To push further, I experimented with amplification using integrated circuits, specifically the TDA2822M. However, since it’s designed for stereo audio, it didn’t suit my needs. As a result, I began building my own amplifier using discrete components: the 2N2222 for general-purpose amplification and the A1015 for low-noise audio amplification. I also added a low-pass filter to reduce noise. With this setup, I managed to lower the noise floor from a constant 80mV to around 60mV, as measured with an oscilloscope.

Hardware

Hardware

  • NUCLEO-STM32F767ZI will serve as the main computational and signal processing unit, and will also function as a transmitter to the computer.
  • MAX4466 will act as the sensor from which audio signals will be received.
  • Red Button will be used to trigger the raw recording.
  • Blue Button will be used to trigger the processed recording.
  • Blue LED will provide visual feedback for the timer during the processed recording.
  • Red LED will provide visual feedback for the timer during the raw recording.
  • Amplifying Circuit with a low-pass filter used to boost the MAX4466 microphone signal for improved sound clarity, while the added low-pass filter helps reduce high-frequency noise at the output.

Schematics

KiCAD Schematic

Bill of Materials

DeviceUsagePrice
NUCLEO-STM32F767ZIThe microcontroller113.26 RON
MAX4466Microphone8.54 RON
ButtonsControlling the recording1.99 RON
LEDs and resistorsIndicator for the recording26.99 RON
Wires female-maleConnecting the components9.99 RON
TransistorsAmplifying the singnal from the MAX446624.99 RON
Ceramic capacitorsMaking the analog fiter19.99 RON

Software

LibraryDescriptionUsage
embassy-stm32Async Rust embedded frameworkUsed for interacting with the peripherals
bytemuckA crate for mucking around with piles of bytes.Used for safe casting
libmA Rust implementations of the C math library.Used in the computations in filtering
defmtHighly efficient logging framework that targets resource-constrained devices, like microcontrollers.Used in displaying on screen and debugging.
static-cellProvides a no-std-compatible, no-alloc way to reserve memory at compile time for a value, but initialize it at runtime, and get a 'static reference to it.Used for saving memory.
  1. NUCLEO-F767ZI pinout
  2. Kalman filter
  3. Biquad filter in Matlab
  4. Control Theory Tutorial Basic Concepts Illustrated by Software Examples
  5. Digital Signal Processing
  6. How does an Amplifier Work? (Class-A)
  7. The Embedded Rust Book