An Arduino-based Device to Detect Dangerous Audio Noises
Lorenzo de Lauretis
1
, Tiziano Lombardi
1
, Stefania Costantini
1
and Ludovica Clementini
2
1
Universit
`
a degli studi dell’Aquila, DISIM Department, L’Aquila, Italy
2
Universit
`
a degli studi dell’Aquila, DIIIE Department, L’Aquila, Italy
Keywords:
Arduino, Health Issue Prevention, Dangerous Noises Detection, IoT, Portable Device.
Abstract:
The issue of noise pollution is becoming more and more relevant in our today’s way of life. Studies have shown
that some noise waves are especially damaging, triggering continuous harm to the nervous scheme with the
resulting failure of listening capacity in some instances. Thanks to the latest technological findings, noises can
be sampled and analyzed even on very tiny appliances that can possibly be carried anywhere. By testing the
noise via a condenser microphone and evaluating the outcome of applying the Fast Fourier Transform to the
sampled samples, we can identify the existence of frequencies that are considered detrimental to the auditory
system, warning a person in real-time about the prospective risk to which (s)he is facing. Moreover, using a
buzzer to alert the user when malicious sounds are detected, our device is also suitable for blind people.
1 INTRODUCTION
Living in our culture today implies being continu-
ally surrounded by the voices and vibrations gener-
ated by the most disparate causes like smartphones,
vehicles, automobiles, aerial transport, etc. Due to
population growth and urbanization, this “noise pollu-
tion” will increase (Goines and Hagler, 2007). Noises
should not be hazardous to the human ear in small
doses and low volume, but they can be hazardous if
they increase in volume and density. According to re-
cent research, with long-lasting exposition to certain
sound thresholds, there are specific sounds that can
trigger serious hearing loss in rats for several days;
these sounds have a frequency of 16kHz and stress of
115dB. There are also worst noises, with a frequency
of 4kHz with a pressure of 125 dB, that cause perma-
nent damage to the hearing of rats in both the low-
and high-frequency range (Reed et al., 2014). Sounds
at so high pressure can be dangerous for the human
ear too (Maassen et al., 2001).
To advice the user of the occurrence of these dan-
gerous noises, we built a very small device. It samples
sounds through a condenser microphone and analyzes
the result of the application of the Fast Fourier Trans-
form (FFT) to the sampled signals, thus detecting dan-
gerous noises. When dangerous noises are detected,
a buzzer installed on our device starts buzzing, so as
to warn the user of the potentially harmful noise. We
used a buzzer instead of a led, because, in this way, the
product is also suitable for blind people, helping them
in the prevention of hearing loss due to malicious
noises. We tested the device with different noises at
different frequencies/pressures, obtaining satisfactory
results.
The paper is structured as follows. In Section
2 there is an excursus about similar works related
to this topic. Section 3 presents background knowl-
edge needed to better understand the work we have
done. Section 4 describes our prototype, explaining
the architecture, the firmware and their functionali-
ties. Sections 5 and 6 discuss the testing phase and
the achieved results. Then, Section 7 reports our con-
clusions based on data obtained using our prototype.
2 RELATED WORK
In (Rajagukguk and Sari, 2018), Rajagukguk et al.
sampled the sound using a condenser microphone, an-
alyzing the data using an Arduino Uno. They used an
LCD display, a buzzer and LEDs to display the infor-
mation about the danger level of the analyzed sound.
Their device warns the user when the sound reaches
the pressure of 75dB, considered by them harmful for
the human ear. Our device is more precise, because it
does not keep track only of the sound level, but also
of the sound frequencies.
In (Bianchi, 2013), Bianchi et. al. explored the
use of the Arduino platform, that can be a versatile
de Lauretis, L., Lombardi, T., Costantini, S. and Clementini, L.
An Arduino-based Device to Detect Dangerous Audio Noises.
DOI: 10.5220/0010476403030308
In Proceedings of the 6th International Conference on Internet of Things, Big Data and Security (IoTBDS 2021), pages 303-308
ISBN: 978-989-758-504-3
Copyright
c
2021 by SCITEPRESS Science and Technology Publications, Lda. All r ights reserved
303
audio processor. They treated the real-time signal
processing, with particular emphasis on the FFT, re-
alizing a sort of benchmark to discover the maximum
length of an FFT that can be computed in real-time in-
side an Arduino. Their work is more about the opera-
tions that Arduino can make on audio, with the related
benchmarks, while we focus more on the practical ap-
plication of the results of FFT computation to prevent
hearing loss.
In (Silva et al., 2012), Silva et. al. made a study
on digital sound processing using Arduino and Mat-
lab
1
, using two different approaches: in the first one,
all the computation is done on the Arduino, in the
second one the sound samples are instead sent to a
laptop where Matlab software performs the compu-
tations, before sending back to playback on the Ar-
duino. Their work, differently from ours, is partly im-
plemented on the Arduino and partly on a PC with
complex sound analysis. Instead, we focus only on
the Arduino without the need of the PC, thus devising
a fully portable device.
In (Raj et al., 2019), the authors explored the use
of the Arduino platform in conjunction with Matlab,
in order to develop a voice-controlled door lock sys-
tem. Interfacing among Matlab and Arduino, they
developed a tool that, using a microphone and FFT
technique, it is able to recognize different voices and
open/close a smart lock. Differently from them, we
used Arduino as a standalone device.
3 BACKGROUND
This section discusses some heritage notions about
Arduino and Fast Fourier Transform approach.
3.1 Internet of Medical Things
The Internet of Medical Things (also called the in-
ternet of health things) is an extension of the Inter-
net of things (IoT)
2
. It is the specific field of appli-
cation for medical and health purposes, such as data
collection and analysis for research and monitoring.
This ‘Smart Healthcare’ infrastructure facilitates the
creation of digitized healthcare systems, connecting
available medical resources and healthcare services.
IoT healthcare systems manage chronic diseases and
their prevention and control. The connectivity for re-
mote monitoring enables health practitioners to cap-
ture data of the patients and applying complex algo-
rithms in health data analysis.
1
https://it.mathworks.com/products/matlab.html
2
https://en.wikipedia.org/wiki/Internet of things
3.2 Arduino
Arduino
3
is an open-source hardware and software
company that designs and manufactures single-board
microcontrollers and microcontroller kits. They are
used for building or prototyping digital devices and
interactive objects, which make use of various sen-
sors and actuators. Boards are equipped with sets of
digital and analog input/output (I/O) pins that may be
interfaced to various hardware components.
Arduino boards can be easily programmed using
an Integrated Development Environment (IDE)
4
and
a USB cable. A typical Arduino program is composed
of two main functions:
setup: it is the initialization phase of the board
loop: it is a portion of code executed repeatedly.
3.3 Fast Fourier Transform
The Fast Fourier transform (FFT
5
) algorithm is a
method for computing the Finite Fourier transform of
a series of N (complex) data points in approximately
N log
2
N operations.
The Fast Fourier Transform can be useful in many
fields, among which the one of our interest: sound
analysis. In fact, it can be used to detect Speech Spec-
trogram (Oppenheim, 1970) from the original wave-
form signal. Another use case is the Automatic Index-
ing of Musical Sounds (Zhang and Zbigniew, 2007)
through their timbre recognition.
4 ARCHITECTURE AND
FIRMWARE
4.1 SYSTEM Structure
This section discusses the architecture of the sys-
tem in order to show relations among different stages
composing our system.
Our device is composed of five macro-
components:
Controller: the “brain” of our device, it has the
Firmware core inside. It receives input data from
the Microphone Sensor and, when dangerous
noises are revealed, it triggers the Alert Buzzer.
Health rule checker: it contains all the mathemat-
ical rules applied to collected microphone data in
order to reveal dangerous situations.
3
https://en.wikipedia.org/wiki/Arduino
4
https://www.arduino.cc/en/Main/Software
5
https://en.wikipedia.org/wiki/Fast Fourier transform
IoTBDS 2021 - 6th International Conference on Internet of Things, Big Data and Security
304
Buzzer actuator: it is the component designed
to drive an alert buzz sound; when triggered it
changes its state, from on to off and vice-versa.
Mic sensor: is a sound sensor, which detects audio
from the ambient and transmits data samples to
the Controller component.
The presented Component architecture is designed to
be Hardware independent, in the sense that the same
designed system can be implemented also in differ-
ent platform apart from the chosen Arduino frame-
work; which means, it could be used also in other crit-
ical applications, such as the detection of ultrasonic-
frequencies in a medical environment or very low fre-
quencies in sonar applications (i.e. resonant testing of
buildings).
In our Arduino example, we have three hardware
boards wired together. In particular:
Arduino Board: the core board with the main con-
troller installed into it. Here is where the main
firmware runs.
Sensor Shield: input peripheral board where sen-
sors are installed (microphone in our case). This
board collects data from the environment and
sends them to the main controller.
Actuator Shield output peripheral board, where
actuators are installed (the Buzzer in our case).
This board is interfaced to the user.
4.2 SYSTEM Behavior
This system is characterized by three running states
during its execution, related to the danger index.
Normal: is the idle state in which the environment
is in a safe state and nothing is prompted to the
user.
Danger: the environment is exiting the safe state
for the presence of some dangerous frequency.
The user is softly prompted of that.
Critical: the environment is totally unsafe for
the presence of dangerous frequencies at a high-
pressure level. The user is strongly alerted.
When entering a state, the system properly sets
its actuators to inform the user about environmen-
tal changes. Specific conditions allow the system to
change state in a scale of danger; moreover, the sys-
tem can return in a normal state if a critical situations
end.
In this first prototype, the state machine in Fig-
ure 1 realizes the Arduino Firmware, which allows
our device to be reliable and functional. It relies on
the usage of the FFT algorithm, which is a polyno-
mial approximation of the Fourier Transformation
Algorithm 1: FFT Implemented on Arduino.
s e t s am p l i n g m a x f r e q ue n c y
s e t n u m b er o f s a m pl e s
s e t d a n g e r o u s f r e q u e n c i e s a r r a y
s e t dan g ero us c o mmo n SP L
s e t dan g e r ou s SP L
Loop {
r e a d n u mb e r o f s a mp l e s i n r a ng e ( 0 ,
s a m p l i ng m a x f r e q u en c y ) > s a m p l e a r r a y
do FFT on s a m p l e a r r a y > F FT a r ra y
f o r e a c h FFT elem i n F F T a rr a y {
i f FF T e lem [ SPL]> = d ang erou s co mmo n SP L {
a l e r t
}
f o r e a c h d a n g e r o u s f r e q u e n c y i n
d a n g e r o u s f r e q u e n c i e s a r r a y {
i f FF T e lem [ f r e q u e n c y ] == d a n g e r o u s f r e q u e n c y {
i f FF T e lem [ SPL ] >= d a ng er ou s SP L {
a l e r t
}
}
}
}
}
method. This method is parametrized on two parame-
ters: the sampling maximum frequency, which deter-
mines the maximum detectable frequency; the num-
ber of samples to be stored and then analyzed, which
describes our implementation is shown in Algorithm
1.
At the beginning of the code, it is possible to see
the declaration of the two parameters cited above.
Sampling maximum frequency: it is chosen high
enough to catch all wanted frequencies with re-
spect to hardware capabilities.
The number of samples: it is chosen large enough
to have a certain number of samples which can
emphasize the characteristic of the audio signal,
accordingly with hardware capabilities.
After the declaration of the two parameters described
above, there is the declaration of global variables to
describe the samples’ list of data and the initializa-
tion of our algorithm variables. In the Loop method,
there is the cyclic core of the algorithm. First of all, it
collects the chosen number of samples, storing them
in dedicated memory locations. Then Fast Fourier
Transform is applied on the set of data, identifying
the spectrum characteristic of the detected audio sig-
nal, which can be compared with the target to possibly
trigger an alert, which turns on/off the output buzzer
of the circuit. This algorithm is iterated every second
in order to have real-time continuous monitoring of
the environment.
An Arduino-based Device to Detect Dangerous Audio Noises
305
Figure 1: Our Device Behavior evolution.
5 DETECTING MALICIOUS
FREQUENCIES
The main objective of our device is to warn the user
of potentially harmful noises that are in her/his sur-
rounding, helping them to prevent hearing loss. To do
that, we first have to understand which are the harm-
ful noises, and what they can cause to the auditory
system during short and long period expositions.
As discussed in (Reed et al., 2014), there are two
main kinds of sound that are very dangerous for the
auditory system of the rat: one is 16kHz at 115dB
and one is 4kHz at 125dB. The exposition to the
noise with 16kHz and 115dB can cause severe hear-
ing loss for several days, while the exposition to the
noise with 4kHz at 125dB can cause permanent dam-
age to the auditory system of the rat. Also, as argued
in (Maassen et al., 2001), sounds at so high pressure
are dangerous for the human auditory system too, and
they should be avoided.
The noises at 115dB and 125dB are at very high
pressure, so they can be identified by the human ear;
the frequency recognition, instead, can be more diffi-
cult for the human ear, so we need a device that helps
the user in recognizing also these potentially harmful
frequencies. As the first step, we built our prototype
with Arduino as the microcontroller, as shown in the
previous section. The resulting device can be used for
audio sampling and analysis. The device is very small
and is battery powered, so it is perfect to be carried
around potentially everywhere.
As next step, we wrote the code that permits to the
Arduino to work, written entirely in C++
6
: through
this code, we were able to sample and analyze the
audio surrounding our device and to make a buzzer
buzz.
Our device helps the user in the recognition of fre-
quency and pressure, buzzing a buzzer to alert the user
when one of the following conditions are met:
Analyzed sound is at a frequency of 4kHz or
16kHz and the pressure is greater equal 75dB.
Analyzed sound has a pressure greater equal
100dB.
The buzzer volume is proportional to the pressure
of the analyzed noises. When the sound pressure is
lower than 75dB, the buzzer is switched off, when the
sound pressure is greater equal 75dB it buzzes at a
low volume, when the sound pressure increases even
more, the buzzer buzzes with an increasing volume,
until it reaches a very high volume, at the 125dB.
Our buzzer does not interfere with the FFT sound
analysis: it produces sounds with a frequency of
10kHz and a volume between 30dB and 50dB (re-
programmable), frequency and volume not consid-
ered harmful from our device, thus being discarded
from the system, preventing a ”backtracking effect”,
in which the sound of the buzzer is given as an input
for our system and so on.
The device was tested using a wave generator, an
object that is able to produce sounds at particular fre-
quencies and pressures. We performed forty noises
tests, with four different pressure levels: 60dB, 80dB,
6
https://it.wikipedia.org/wiki/C%2B%2B
IoTBDS 2021 - 6th International Conference on Internet of Things, Big Data and Security
306
Table 1: buzzer buzzing testing results.
60dB 80dB 90dB 105dB
2KHz No No No Yes
3KHz No No No Yes
4KHz No Yes Yes Yes
5KHz No No No Yes
6KHz No No No Yes
10KHz No No No Yes
14KHz No No No Yes
16KHz No Yes Yes Yes
18KHz No No No Yes
20KHz No No No Yes
90dB and 105dB, varying the frequency from 2kHz to
20kHz. The results of our tests are shown in Table 1:
if the buzzer buzzes at the corresponding frequency
and pressure, in the table is reported “Yes”, “No” oth-
erwise. We tested our device in a silent room, without
external sounds, to prevent interferences given from
them.
6 DISCUSSION
This paper started with an introduction to Arduino
and why it is so useful to cope with problems that
are always more relevant nowadays. We choose Ar-
duino for our project for a number of reasons: it is
open-source, it is cheap, it is all-in-one and can be
programmed using C++. Via the combination of all
these features, we got a dedicated microcontroller that
is easily expandable. The sensors and actuators are
relatively cheap, permitting, with a very low budget,
to build one’s own devices. There are a lot of Arduino
libraries available online, that permits rapid develop-
ment of code for any device. Without Arduino and
all its features, a work such as the one described in
this paper would have been more complicated and, in
some cases, it would have not been possible.
For example, a similar work could have been done
using the smartphone, with an App that samples and
analyzes the sounds. We discarded this option, be-
cause, the microphone of the smartphone is not sensi-
ble enough to sample and record the sounds that sur-
round the user, while, with Arduino, we can choose
the most useful microphone, with specific sensibility
and characteristics.
Within the data obtained from the testing, it is
possible to verify that the devices work well, cor-
rectly identifying the potentially dangerous frequen-
cies/pressures. When the noises produced from our
wave generator had a pressure of 60dB, the buzzer on
our device had not been active, because the analyzed
sound was not potentially harmful. When we tested
the device with noises with the pressure set at 80dB,
the buzzer buzzed when the noises reached 4kHz and
16kHz frequencies, correctly advising the user of the
analyzed harmful frequencies. When the noises pro-
duced from our wave generator had a pressure of
90dB, the buzzer buzzed when the noises reached
4kHz and 16kHz frequencies, correctly warning the
user of the potential danger for his ears. When the
noises had a pressure of 105dB, the buzzer was ac-
tive within all the frequencies reached from our wave
generator, because we consider dangerous noises at so
high pressure. The buzzer buzzing volume is propor-
tional to the pressure of the analyzed noises.
A problem that is possible to identify in our sys-
tem is the microphone sensibility, that, in some cases,
cannot be enough to sample very high sound pres-
sures: the microphone we used for testing is a con-
sumer one, that can be bought from everybody to
build own devices, and not a professional one; so, the
precision is not so high for professional use; it may
lead to a loss of precision during measurements.
Another problem that is possible to identify is the
”backtracking effect”: using a buzzer to alert the user
when dangerous noises are revealed, the sound of the
buzzer may act as an input for our microphone, loop-
ing through the system. To prevent this, our buzzer
produces sounds with a frequency of 10kHz and with
a volume between 30dB and 50dB (reprogrammable);
being this kind of sound unharmful, our algorithm
simply discards it and does not act as a recursive in-
put for our device. If, for example, our buzzer had a
frequency of 4kHz and a volume of 70dB, it will have
acted as a dangerous sound source, producing sounds
considered harmful by our device, and causing our
buzzer to increase the volume, causing detection of
more dangerous sounds, and so on.
Another problem that is possible to identify is that,
if our device is used in a place with other people in the
near surroundings, the device can eventually be dis-
turbing for them, if the buzzer buzzes continuously.
A way to avoid this, without losing the feature of be-
ing suitable for blind people, is simply to decrease the
volume of the buzzer: being the device volume repro-
grammable, it is possible to set to a very low buzzing
volume range, for example, 5dB to 10dB, resulting no
more disturbing for people in the surroundings.
From the testing results, we can ensure that our
device works correctly with respect to the workflow,
properly identifying the potentially dangerous fre-
quencies/pressures.
An Arduino-based Device to Detect Dangerous Audio Noises
307
7 CONCLUSIONS AND FUTURE
WORK
In this work, we created a tool that warns the user
when potentially harmful noises are detected in its
near surroundings. It is very small, meaning that it
can be carried potentially everywhere. It is cheap and
is easy to build, meaning that it can be constructed
potentially by everybody. It is functional because
it is able to sample and analyze the noises coming
from the near surroundings, warning the user with the
buzz of a buzzer if the analyzed noises are potentially
harmful to them. Using the buzzer instead of a led
or other kinds of light-based actuators, our system is
suitable also for blind people, helping them in the pre-
vention of hearing loss. In the near future, we will try
to develop a system that uses a vibrating actuator in-
stead of a buzzer one, to avoid disturbing people that
can be in the near surrounding of the user. We will
also build another version of our system, with a bet-
ter professional microphone, that will be able to sam-
ple the sounds with better precision, even at higher
sound pressures. Using the design guidelines illus-
trated here, everybody can build its own system with a
very low budget, safeguarding their own auditory sys-
tem and protecting their ears from auditory diseases.
REFERENCES
Bianchi, A. J. (2013). Real time digital audio processing
using arduino.
Goines, L. and Hagler, L. (2007). Noise pollution: A mod-
ern plague. Southern Medical Journal, 100(3).
Maassen, M., Babisch, W., Bachmann, K., Ising, H.,
Lehnert, G., Plath, P., Plinkert, P., Rebentisch, E.,
Schuschke, G., Spreng, M., Stange, G., Struwe, V.,
and Zenner, H. (2001). Ear damage caused by leisure
noise. Noise and Health, 4(13):1–16.
Oppenheim, A. V. (1970). Speech spectrograms using the
fast fourier transform. IEEE Spectrum, 7(8):57–62.
Raj, L. D. W., Santhosh, K., Subash, S., Sujin, C., and
Tharun, P. (2019). Voice controlled door lock system
using matlab and arduino. In 2019 IEEE International
Conference on System, Computation, Automation and
Networking (ICSCAN), pages 1–6. IEEE.
Rajagukguk, J. and Sari, N. E. (2018). Detection system
of sound noise level (snl) based on condenser micro-
phone sensor. Journal of Physics: Conference Series,
970(1):012025.
Reed, A. C., Centanni, T. M., Borland, M. S., Matney, C. J.,
Engineer, C. T., and Kilgard, M. P. (2014). Behav-
ioral and neural discrimination of speech sounds after
moderate or intense noise exposure in rats. Ear Hear,
35(6):e248–e261. 25072238[pmid].
Silva, S., Soares, S., and Valente, A. (2012). Digital sound
processing using arduino and matlab.
Zhang, X. and Zbigniew, W. R. (2007). Analysis of sound
features for music timbre recognition. In 2007 Inter-
national Conference on Multimedia and Ubiquitous
Engineering (MUE’07), pages 3–8.
IoTBDS 2021 - 6th International Conference on Internet of Things, Big Data and Security
308