You are on page 1of 5

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/322446726

Design and analysis of a digital active noise control system for headphones
implemented in an Arduino compatible microcontroller

Conference Paper · November 2017

CITATION READS

1 3,012

4 authors:

Artur Zorzo Leao William D'Andrea Fonseca


Universidade Federal de Santa Maria Universidade Federal de Santa Maria
8 PUBLICATIONS   4 CITATIONS    92 PUBLICATIONS   82 CITATIONS   

SEE PROFILE SEE PROFILE

Eric Brandao Paulo Mareze


Universidade Federal de Santa Maria Universidade Federal de Santa Maria
67 PUBLICATIONS   177 CITATIONS    60 PUBLICATIONS   103 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Sound quality analysis of handheld blenders. View project

Acoustically Induced Vibration in Pipeline Systems View project

All content following this page was uploaded by William D'Andrea Fonseca on 12 January 2018.

The user has requested enhancement of the downloaded file.


Design and analysis of a digital active noise control system for
headphones implemented in an Arduino compatible microcontroller
A. Zorzo∗ , W. D’A. Fonseca∗ , E. Brandão∗ , P. H. Mareze∗
∗ AcousticalEngineering, Federal University of Santa Maria, Santa Maria, Brazil
artur.zorzo@eac.ufsm.br

Abstract - Active noise control can be a powerful sure good communication even with loud wind and
tool when dealing with problematic low frequencies engine noise. Furthermore, in the past few years,
tones or general broadband noise. The primary several headphones designed for audio and music
goal of this paper is to expose the design methods have been developed with this ANC system, the
and analyze the performance measurements of goal in this situation is to make possible listening
a low-cost (Arduino compatible) active noise to songs in good quality even in loud environments
control system for headphones. The measured such as train stations and airports.
performance was impaired by the poor coupling The main purpose of this article is to evaluate
between the headphone and the pinna of the head the performance of a digital active noise control sys-
and torso simulator used in the measurements. tem that was implemented in a Teensy 3.6 board.
For this reason, the complete measurement set This board has a ARM cortex M4 processor and
was carried out with and without the artificial can be programmed with the same programming
pinna (in this first step only the results without language used for Arduino boards. The additional
the pinna are discussed). The algorithm used for microphone preamplifier and headphone driver cir-
this research was the FXLMS (Filtered Least Mean cuits that were necessary to the development of
Squared), which is a variation of the Least Mean this project is going to be published soon in a
Square algorithm (LMS). Although the system more detailed paper (discussing circuit diagrams
was designed to attenuate broadband noise, great and codes).
results were obtained for both broadband and
tonal noise, showing that is possible to adapt a Materials and methods
headphone to substantially attenuate noise with In this section, the necessary theories regarding
relatively low-cost components and easy to use the digital active noise control technique used are
microcontrollers. briefly explained. A specification of the measure-
Keywords: headphones, Arduino, acoustics, ment systems, as well as the hardware used, is also
FXLMS, active noise control. given.
1 Feedback active noise control
Introduction According to Elliot e Nelson [1], one of the most
successfully use of feedback ANC control has been
Active Noise Control (ANC) can be a useful tool applied to the design of wide-band noise control
when reducing excessive and/or undesired Sound systems for headphones. A feedback control system,
Pressure Levels (SPL). This technique is based on firstly described by Olson e May [3], is based upon
the wave superposition principle and it works by an error microphone in the position where the
generating an anti-noise that cancels the primary reduction is desired and a loudspeaker close to the
noise when they are added (in the same sound microphone. A diagram of such configuration can
field) [1]. be observed in Figure 1. The controller purpose
Passive noise control methods, like porous mate- is to generate a signal to the loudspeaker that
rials, barriers, and enclosures, usually aren’t able minimizes the error captured by the microphone.
to reduce significantly SPL at lower frequencies, The major problem of this configuration is that
unless they are very large and bulky, which may be the phase distortions due to the circuitry, acoustic
impossible to implement due to space limitations. path between microphone and loudspeaker and the
On the other hand, according to Kuo e Morgan [2], loudspeaker itself can impair the performance of
ANC works mainly in the low-frequency range. the controller and even generate positive feedback
This fact arises from the difficulty of adjusting the at higher frequencies (if the phase delays reach
anti-noise’s phase for high frequencies. more than 180 degrees). Thus, these secondary sys-
The application of this method in headphones tems have to be accounted for and the distance be-
has been used in the field of aviation, specifically tween the microphone and the loudspeaker (source-
in communication devices used by pilots, to en- receiver) should be small as possible.
product of the transposed version of vector W (n)
and the input vector. Accordingly,
L−1
X
y(n) = wi (n) x(n − i) = W T (n) X(n) . (3)
i=0

There is a significant amount phase and ampli-


Figure 1 – Basic model of a feedback active noise tude distortion between the exit and the input of
control system (adapted from [2]). the controller, called secondary path. These distor-
tions are given by the loudspeaker, preamplifier,
2 FXLMS algorithm A/D and D/A converters, microphone and acoustic
path between the microphone and the loudspeaker.
The algorithm used for this research was the The sum of these system’s influence is denoted by
FXLMS (Filtered Least Mean Squared), which is S(z) in the diagram (the z is the derived by the use
a variation of the Least Mean Square algorithm of Z-transform). If these distortions are not taken
(LMS). The method is based on an adaptive finite into account, the algorithm might become unstable.
impulse filter that varies its coefficients in order to Therefore, an estimate of the secondary path (Ŝ(z))
minimize the square of the error measurement [2] is performed to adjust the LMS algorithm, hence,
(or to minimize the variance of error signal). A becoming FXLMS.
complete diagram o the algorithm can be found in The Equation 4 is responsible for updating the
Figure 2. adaptive filter’s coefficients in order to minimize
the instantaneous squared error. The step size,
represented by µ, coordinates the rate in which the
algorithm converges [5], therefore,

w(n + 1) = w(n) + µ x′ (n) e(n) , (4)

where e(n) is the error (considering a threshold)


and the {·}′ indicates that a sample has passed
through the Ŝ(z).
Since there is only one microphone that measures
Figure 2 – Diagram of the FXLMS algorithm the error, it is necessary to estimate the primary
(adapted from [2]). noise. Thus, the estimate of a given Ŝ(z) of size M
yields
The equations related to the filter and the adap- M −1
tive algorithm will be shown throughout this sec- ˆ = e(n) +
X
x(n) ≡ d(n) ŝm y(n − m) . (5)
tion (further reading about LMS may be found m=0
in [4]). Herein, vectors and matrices will be de-
Finally, the primary noise and the secondary path
noted by uppercase letters and scalar quantities
estimates are convoluted to generate the signal
denoted by lowercase letters. The FIR filter is de-
that is used to update the filter’s coefficients. The
fined as a vector W (n) with L coefficients and the
convolution can be expressed by
input vector X(n) is defined as a vector of the same
size, where x(n) represent the current input value, M −1
x′ (n) =
X
x(n − 1) the immediately past input value and so ŝm x(n − m) . (6)
on and so forth. The cited vectors can be denoted m=0
by In practice, the algorithm is not able to reach the
W (n) = [w0 (n) w1 (n) ... wL−1 (n)] , (1) exactly the optimal solution. However, it achieves
and a fairly close point. The measure of how close the
solution reaches the optimum is called misadjust-
X(n) = [x(n) x(n − 1) ... x(n − L + 1)] . (2) ment. If the step size is small, the algorithm will
take longer to converge but the solution will get
For each discrete value of time n, the error is given closer to the optimum, thus, the misadjustment
by the microphone’s measurement. value will be smaller. If µ is greater, the opposite
The output of the filter can be computed as a event occurs, a fast convergence shall be expected,
real time convolution between the filter’s impulse but after convergence, the solution will be far (or
response and the input vector (Equation 3). This less close) to the desired value than with a small
convolution can also be expressed as the vector step size [6].

2
The shown algorithm is implemented in a stream- expressed by y(n), are subtracted to generate an
ing format. At each input sample converted by the error signal e(n). The error, as well as the input
controller, an output sample must be computed signal, are used by the minimization algorithm
and emitted before the next input sample is gath- to adjust the filter to minimize the difference of
ered. Therefore, the sampling period must be higher outputs.
than the time it takes the processor to compute the When the error reaches its minimum (or thresh-
equations above (thereby decreasing the sampling old), the IR of the adaptive filter is (in an optimum
frequency). way) emulating the impulse response of S(z).
In this study, the sampling frequency was not set
as constant. At the codes loaded in the boards, each
4 Hardware and measurement
input sample is obtained as soon as the output sam- The performance measurements were made with
ple is converted into analog value. Consequently, a head and torso simulator (HATS) Type 4128C
the sampling rate varies with the size of the filter. from B&K. The experiment was carried out inside
For this reason, there is a trade-off between filter a reverberation chamber with an omnidirectional
size and sampling rate. If the filter size is too small, sound source (see Figure 4). The signals tested were
it might not be possible to achieve the necessary white noise and a 500 Hz tonal noise. The data
impulse response needed for a good performance. was collected with and without sound reproduction
However, if the size of the filter is too wide, the sam- from the dodecahedron.
pling frequency, as well as the maximum frequency
of analysis, is accordingly reduced. A continued
study will consider fixed sampling rate.

3 Secondary path estimation


The secondary path estimation is obtained based
on the system identification technique. According
to Morgan and Kuo [5], the basic idea behind the
system identification procedure is to construct a
model based upon a measurement of the signal pro-
duced by the system. The diagram of the secondary
path estimation can be consulted in Figure 3.
Figure 4 – Instrumentation used to obtain the
performance measurements.

During the measurements, it was noticed that the


HATS’s ear was too big for the chosen headphone,
and, subsequently, the coupling was unsatisfactory.
The measurements were then carried out with and
without the ears, for comparison purposes. Later,
it was possible to realize that the bad coupling has
impaired the performance of the control system.
Therefore, only the results measured without the
ear will be shown herein.
The headphone used throughout this experiment
was the AKG K44 and the error microphone was
the JLI-61A. The microphone was placed next
to the HATS’s microphone and connected to the
preamplifier circuit that was designed for the con-
Figure 3 – Secondary path estimation diagram troller. The headphone was set to the simulator
(adapted from [2]). and connected to the controller’s output.
A variety of measurements were collected for
An input signal x(n), usually a wideband signal both, white noise and the 500 Hz tone, varying the
(such as a white noise), is generated by the processor filter length for a given (fast converging) value of µ.
and it serves as inputs to both adaptive filter and The best results are shown in the next section.
the secondary path.
The output of S(z), expressed in the diagram
by d(n), and the output of the adaptive filter Ŝ(z),
3
Results obtained by the correct adjustments of the filter
size and the value of the step size. Moreover, the
Considering the narrowband test, the 500 Hz tone problem regarding the bad coupling between the
has achieved the best result obtained for a filter headphone and the measuring instrumentation can
length of 50. The SPL reduction obtained was quite be solved by changing the headphone model or
large, almost reaching a 40 dB reduction, as can obtaining a smaller ear for the head and torso sim-
be seen in Figure 5. The results obtained for the ulator. Further studies are still in development.

110
100
System off References
Amplitude [dB] - ref. 20e-6 Pa

System on
90
80 [1] S. ELLIOTT and P. NELSON, “Active noise
70
control,” IEEE SIGNAL PROCESSING MAG-
60
50
AZINE, 1993.
40
[2] S. M. KUO and D. R. MORGAN, “Active noise
30
20
control: A tutorial review,” PROCEEDINGS
10
OF THE IEEE, 1999.
100 1000
Frequency [Hz] [3] H. F. OLSON and E. G. MAY, “Electronic
sound absorber,” THE JOURNAL OF THE
Figure 5 – Performance of the ANC system with a
ACOUSTICAL SOCIETY OF AMERICA,
50 taps filter for a 500Hz tone.
1953.

wideband noise were not as expressive as for the [4] P. M. Clarkson, Optimal and Adaptive Signal
tonal noise (Figure 6). Nevertheless, some reduction Processing: A Volume in the Electronic Engi-
was obtained for a frequency range of about 50 Hz neering Systems Series: 3. CRC-Press, 1993.
to 700 Hz. This result was obtained with a 15 taps [5] S. M. Kuo and D. R. Morgan, “Active noise
filter. Although the small filter length might be control systems – algorithms and dsp implemen-
limiting, a smaller length means a larger sampling tation,” Wiley Series in Telecommunications
rate. For the filters used to the tone and wideband and Signal Processing, 2009.
noise measurements, the sampling rates obtained [6] J. A. A. Jr and S. L. Netto, QRD-RLS Adaptive
were 25 and 45 kHz, respectively. Filtering. Springer, 2009.

72
System off
70
Amplitude [dB] - ref. 20e-6 Pa

System on
68
66
64
62
60
58
56
54
52
50
100 1000
Frequency [Hz]

Figure 6 – Performance of the ANC system with a


15 taps filter for white noise.

It is important to notice that these results were


obtained for a large value of µ (processing time
below 1 s). Therefore, better results could be ob-
tained with lower values at the expense of a slower
convergence.

Discussions and conclusions


Despite the fact that a relatively low-cost micro-
controller was used to do the real-time processing,
great results were obtained for both the tonal and
the wideband noises. Better results may still be
4
View publication stats

You might also like