Physical World Development

ANC Tuning & Performance Optimization

In engineering practice, the most time-consuming and experience-dependent part of an active noise control system is not algorithm selection, but parameter tuning and stability debugging. Filter order, step size, sampling rate — each parameter interacts with the others in ways that are not always obvious. This article draws from hands-on experience to cover the key parameter selection logic and common troubleshooting approaches in ANC tuning. Filter Order Selection The FIR filter order $N$ directly determines two core metrics: frequency resolution and computational complexity. Getting this choice wrong reveals itself early in debugging — poor noise reduction, slow convergence, or outright divergence.

Continue reading →

Embedded ANC: ESP32 Practice

The ESP32-S3’s dual-core Xtensa LX7 processor with vector instruction set extensions is well-suited for the real-time DSP workloads required by embedded ANC. Combined with the ESP-DSP library, efficient adaptive filtering becomes practical on this platform. I2S Microphone Capture ANC requires at least two synchronous input channels: a reference microphone (capturing ambient noise) and an error microphone (capturing residual error). The ESP32-S3 I2S peripheral supports simultaneous multi-channel ADC data reception. Configuring it for 16-bit, 16 kHz sampling suffices for consumer-grade ANC.

Continue reading →

Embedded ANC: STM32 in Practice

Hardware Architecture Implementing real-time ANC begins with selecting the right hardware platform. The controller must complete adaptive filtering within microseconds while managing multiple audio data streams. Module Function Typical Choice Main Controller Executes adaptive algorithm STM32F4/F7, ESP32-S3, nRF5340 Reference Mic Captures ambient noise Knowles SPH0645, Infineon IM69D130 Error Mic Captures residual noise Knowles SPH0645, TDK ICS-43434 Audio DAC Outputs anti-noise signal ES9218, PCM5102 Amplifier Drives speaker Class-D The reference microphone sits outside the earcup and captures external ambient noise as the algorithm’s reference input. The error microphone sits inside the earcup near the speaker, capturing residual noise for evaluating cancellation performance and driving adaptive updates. The audio DAC converts the digital anti-noise signal to analog, which is amplified by a Class-D amplifier to drive the speaker.

Continue reading →

IMU Fundamentals: Accelerometer and Gyroscope

Opening post of the Motion Sensing series. Sensors are the window through which embedded systems perceive the physical world, and the IMU (Inertial Measurement Unit) is the most common type. This article skips heavy theory — just how MEMS sensors work, how to wire them, how to read data, and what the numbers actually look like. IMU Coordinate System The diagram below defines the three axes of the IMU — all formulas and discussions that follow are based on this coordinate system:

Continue reading →

Variable Step Size and Frequency-Domain Adaptive Algorithms

The Convergence Trade-off of Fixed Step Size Standard LMS and NLMS algorithms use a fixed step size parameter $\mu$. The choice of step size directly impacts algorithm performance, but a fundamental contradiction exists: Large step size: Fast convergence and quick adaptation to environmental changes, but large steady-state error and low filtering precision Small step size: Small steady-state error and high filtering precision, but slow convergence and sluggish response to abrupt changes This contradiction is particularly pronounced in applications such as echo cancellation and active noise control — the system needs fast convergence during startup, yet wishes to maintain low error in steady state. A fixed step size cannot satisfy both phases simultaneously.

Continue reading →

FXLMS and Active Noise Control System Architecture

Active Noise Control (ANC) works by generating an acoustic wave with equal amplitude and opposite phase to the incoming noise, canceling it through destructive interference at the target zone. Translating this into hardware requires two decisions: which sensors to use for noise sensing, and what control strategy to apply for anti-noise generation. These two factors define the three canonical ANC architectures: feedforward, feedback, and hybrid. Feedforward ANC A feedforward ANC system places a reference microphone upstream of the noise source to capture the disturbance early, feeds it to the DSP, and drives the speaker to produce the anti-noise. An error microphone near the ear monitors the residual noise and feeds it back to the adaptive algorithm for coefficient update.

Continue reading →

Image Basics & Getting Started with OpenCV

What Is a Digital Image Computer vision operates on digital images. At its core, a digital image is just a 2D array of pixels. Pixels and Grayscale Images A grayscale image is the simplest form—each pixel stores a single brightness value from 0 (pure black) to 255 (pure white). In Python, a grayscale image of width W and height H is a 2D array with shape (H, W): python 1 2 3 4 import numpy as np # Create a 100x100 gray square (brightness 128) gray_img = np.full((100, 100), 128, dtype=np.uint8) uint8 ranges from 0 to 255 because 8 bits can represent 2^8 = 256 unique values. If a pixel value exceeds its range, wrap around occurs: 255 + 1 becomes 0, not 256 (like an odometer rolling over). Use cv2.add() (saturating arithmetic) or np.clip() to prevent wrap around.

Continue reading →

Adaptive Filtering: From LMS to NLMS

The LMS Algorithm The core problem in adaptive filtering is: given a reference signal x(n) and a desired signal d(n), find a filter coefficient vector w such that the output y(n) approximates d(n). The Least Mean Square (LMS) algorithm is the most classic solution to this problem, proposed by Widrow and Hoff in 1960. The core idea is to take one step down the steepest gradient of the error surface at each iteration — stochastic gradient descent.

Continue reading →

Acoustic Waves & Digital Signal Processing Basics

Destructive Interference Active noise cancellation (ANC) builds on a simple physical principle: destructive interference. Two sound waves of the same frequency and opposite phase cancel each other out. The original noise signal: $$ p_n(t) = A \cos(2\pi ft + \phi) $$ The anti-noise generated by the ANC system: $$ p_c(t) = -A \cos(2\pi ft + \phi) = A \cos(2\pi ft + \phi + \pi) $$ Superposition: $$ p_{\text{total}} = p_n(t) + p_c(t) = 0 $$

Continue reading →