Sunteți pe pagina 1din 5

Use of Adaptive Filtering for Improved

Performance in Digital Stethoscopes


Donald L. Hall Matthew I. McTaggart William K. Jenkins
School of Electrical Engineering School of Electrical Engineering School of Electrical Engineering
and Computer Science and Computer Science and Computer Science
Pennsylvania State University Pennsylvania State University Pennsylvania State University
University Park, PA 16802, USA University Park, PA 16802, USA University Park, PA 16802, USA
Email: dqh5265@psu.edu Email: mim5548@psu.edu Email: jenkins@engr.psu.edu

Abstract – A digital stethoscope is constructed for the into account the potential presence of noise that could
adaptive mitigation of internal and external noise resonate from the patient themselves, i.e. internal noise.
accompanying real-time acoustical heart This form of resonation can range anywhere from heavy
measurements. The developed system utilizes the breathing to yelling from a patient in pain, which is
fundamentals of statistical tendencies accompanying resonated through the channel accompanying the heart
signals for the suppression of noise, reconstruction of signal in the form of attenuation.
heart signals, and heart rate calculation in a The current digital stethoscope supports a real-time
simultaneous manner. In this paper, the designed display of the heart rate and acoustic heart signal, along
digital stethoscope is reconstructed from a with the audio playback to any speaker or listening device.
mathematical model accompanied by the physical A median filter was constructed for accurate heart rate
equipment used. After the exploration of the system realization. Four cascaded second order infinite impulse
from mathematical principles is completed, the response (IIR) transfer functions were cascaded for
working performance of the instrument is displayed generating an eighth order low-pass filter sufficient in peak
followed by the derivation and implementation of the detection of the heartbeat signals. An adaptive thresholding
variable step-size least-mean-squares adaptive noise algorithm was implemented for efficient peak detection
cancelling algorithm. capable of evaluating different users. The display and
Index Terms – Adaptive filters, variable step-size LMS audio playback of the microcontroller was designed as an
algorithm, digital filters, microcontroller, cardiac eighth order IIR bandpass filter for capturing critical
acoustics, internal noise reduction, digital stethoscope information regarding the first and second (S1 and S2)
acoustic parameters of the heartbeat waveform [5]. The
I. INTRODUCTION AND BACKGROUND design was also based on two cascaded fourth order
transfer functions. A variable step-size LMS adaptive
Digital stethoscopes are instruments used as a
algorithm was employed for internal noise suppression
measurement and analysis tool for auscultation (listening
based on [7]. A simulated adaptive noise canceler was
to the heart sounds of the heart) and medical diagnosis.
generated as a proof-of-concept.
Acquisition of signals accompanying the low signal
strength of the heart requires sensitive equipment in order
II. HARDWARE SETUP
to generate accurate calculations for the medical
examiners, as well as granting the ability to audibly discern The digital stethoscope is realized using a microphone
the true signal to a high degree. As the sensitivity of any placed at the inner portion of the resonator cavity, such that
receiver or recording device increases for increased signal resonations can occur from vibrations present at the analog
observability, so does the presence of unwanted signals. diaphragm. The microphone was biased at 3.3 volts from a
The presence of external noise can attenuate the pre- peripheral pin onboard of the LPCXpresso54608. The
existing heart signal such that observations of the heart signal is sampled on the LPCXpresso54608 platform at
signal are unobservable [1]. 8000 Hz at the audio-in port of the analog-to-digital
Adaptive filtering is an ever-lasting solution for the converter (ADC). The sampled data is collected by the
mitigation of time-variant noise that can occur in a system. LPC54608 for the display of the heart signals and heart rate
Such implementations have been developed for digital calculation. The digital stethoscope reconstructs the signal
stethoscopes in adaptively mitigating external noise [2], and allows for the audio playback on any listening device
[3], [4], [5] and [6]. Although proven to be successful in connected to the audio-out port of the microcontroller. The
the suppression of the external noise, and extremely current system is configured and visualized by figure 1.
valuable to the medical industry, the authors had not taken
𝑦1 [𝑛] = 𝛼10 𝑥[𝑛] + 𝛼11 𝑥[𝑛 − 1] + 𝛼12 𝑥[𝑛 − 2] (1)
+ 𝛽11 𝑦1 [𝑛 − 1] + 𝛽12 𝑦1 [𝑛 − 2]

𝑦2 [𝑛] = 𝛼20 𝑦1 [𝑛] + 𝛼21 𝑦1 [𝑛 − 1] + 𝛼22 𝑦1 [𝑛 − 2] (2)


+ 𝛽21 𝑦2 [𝑛 − 1] + 𝛽22 𝑦2 [𝑛 − 2]

𝑦3 [𝑛] = 𝛼30 𝑦2 [𝑛] + 𝛼31 𝑦2 [𝑛 − 1] + 𝛼32 𝑦2 [𝑛 − 2] (3)


+ 𝛽31 𝑦3 [𝑛 − 1] + 𝛽32 𝑦3 [𝑛 − 2]

𝑦4 [𝑛] = 𝛼40 𝑦3 [𝑛] + 𝛼41 𝑦3 [𝑛 − 1] + 𝛼42 𝑦3 [𝑛 − 2] (4)


+ 𝛽41 𝑦4 [𝑛 − 1] + 𝛽42 𝑦4 [𝑛 − 2]

Fig. 1. where 𝑦𝑖 is the output of the ith section, 𝑥[𝑛] is the


Designed digital stethoscope. digitized heartbeat signal, and 𝛼 and 𝛽 are the impulse
coefficients of the IIR transfer function. The low-pass filter
III. CURRENT PERFORMANCE is used to filter the microphone signal so that the peaks per
heartbeat are well realized from the signal for peak
The digital stethoscope consists of four distinct sections detection and heart rate calculation.
for realizing the acoustical nature of the heartbeat from the
user. The functionality is resembled by the block diagram B. Threshold Adaptation and Median Filtering for Peak
shown below in figure 2. Detection and Heart Rate Calculation
The output of the low-pass filter is analyzed by a
thresholding algorithm, of which adapts to the signal being
observed in an iterative process. The heart rate filtered data
ranges from 1 to 32,767 as the buffer is calculated based on
the number of samples between two measured peaks. A
small threshold is set and is stepped up or down based on
the amount of peaks observed. Once a second peak is
detected, the time per heartbeat is calculated by the number
of samples between two peaks divided by the sample rate.
Fig. 2. High-level overview of the designed digital stethoscope on As each user has a different heartbeat, the threshold
the LPC54608 microcontroller. must adapt. The magnitude of the low pass stores 16 bits
per sample. The adaptive threshold starts at 3,500 and
The four primary sections encompass the peak detection, decreases by 2,000 every second if no measurements are
heart rate calculation, waveform display, and audio above the threshold. The adaptive threshold never goes
playback; of which consists of three sub-functions below 2,000. The adaptive threshold increases by 2,000 if
including: low-pass filtering for peak detection, an any measurement is above the threshold. Eventually the
adaptive thresholding algorithm for realizing a variety of threshold stabilizes such that it can be used to detect the
different users, a median filter for accurate heart rate peaks of each heartbeat. As the threshold is adaptive, it
calculation, and a bandpass filter for the audio playback does have a transient response until it begins to calculate
and waveform display. the heartrate accurately.
When attempting to calculate the heartrate, the peak
A. Low-pass Filtering detection governs the overall accuracy of the heart rate
calculation. As such, whenever a heart rate is calculated a
The designed low-pass filter is constructed as four median filter is leveraged for storing the data samples. The
cascaded, second order, transfer functions that feed a median filter is used to filter the heart rate buffer to always
decision making algorithm, such that the heart rate can be display the median value, or the current value, of the heart
calculated optimally. The low-pass filter is designed with a rate. The filter simply works such that it sorts each value in
cutoff frequency of 125 Hz. The transfer function is the odd-dimensioned buffer in ascending order, and
modeled by the difference equations expressed by displays the value in the middle of the buffer. An example
equations (1-4). The output of the IIR filter is dependent on of the sorting in heart rate buffer is represented in equation
both the input to the system as well as the previous outputs. (5), as the order of statistics (O.S) are represented by 𝑠𝑛 .
The overall filter is constructed as an eighth order IIR filter
of the form: 𝐵𝑢𝑓𝑓𝑒𝑟 → 𝑂.𝑆 [{𝑠1 }, {𝑠2 }, … {𝑠6 } … {𝑠10 }, {𝑠11 }] (5)

where
𝐻𝑒𝑎𝑟𝑡 𝑅𝑎𝑡𝑒 = {𝑠6 } (6) 𝑑(𝑛) = 𝑠(𝑛) + 𝑛(𝑛) (9)

C. Bandpass Filtering for Audio Playback and Waveform Display and the estimated noise source is modeled as:
The bandpass filter was implemented as an eighth order IIR 𝐿−1
filter comprising of two cascaded, fourth order sections centered
𝑛̂(𝑛) = ∑ 𝑤𝑘 (𝑛)𝑛̃(𝑛 − 𝑘) (10)
at 175 Hz and having a bandwidth of 250 Hz, is expressed here in
𝑘=0
the form of difference equations:
with
𝑦1 [𝑛] = 𝛼10 𝑥[𝑛] + 𝛼11 𝑥[𝑛 − 1] + 𝛼12 𝑥[𝑛 − 2] 𝑒(𝑛) = 𝑑(𝑛) − 𝑛̂(𝑛) = 𝑑(𝑛) − 𝑤(𝑛)𝑛̃(𝑛) (11)
+ 𝛼13 𝑥[𝑛 − 3] + 𝛼14 𝑥[𝑛 − 4] + 𝛽11 𝑦1 [𝑛 − 1] (7)
+ 𝛽12 𝑦1 [𝑛 − 2] + 𝛽13 𝑦1 [𝑛 − 3] + 𝛽14 𝑦1 [𝑛 − 4] where 𝑠(𝑛) is the acoustic heart signal, 𝑛(𝑛) is the internal
noise, and 𝑒(𝑛) is the error signal fed back to the adaptive
𝑦2 [𝑛] = 𝛼20 𝑦1 [𝑛] + 𝛼21 𝑦1 [𝑛 − 1] + 𝛼22 𝑦1 [𝑛 − 2] filter for updating the filter tap weights via gradient
+ 𝛼23 𝑦1 [𝑛 − 3] + 𝛼24 𝑦1 [𝑛 − 4] + 𝛽21 𝑦2 [𝑛 − 1] (8) descent:
+ 𝛽22 𝑦2 [𝑛 − 2] + 𝛽23 𝑦2 [𝑛 − 3] + 𝛽24 𝑦2 [𝑛 − 4]
𝑤(𝑛 + 1) = 𝑤(𝑛) − 𝜇∇𝑚𝑠𝑒 (𝑛) (12)
where equation (7) refers to the first fourth order section where ∇𝑚𝑠𝑒 is the gradient of the mean square error of the
and equation (8) is the second fourth order section, form:
respectively.
∇𝑚𝑠𝑒 (𝑛) = 𝑒 2 (𝑛) = [𝑑(𝑛) − 𝑛̃(𝑛)]2 (13)
IV. ADAPTIVE NOISE CANCELLING resulting in
𝐿−1 2

The conventional LMS algorithm is employed in [𝑑(𝑛) − ∑ 𝑤𝑘 (𝑛)𝑛̃(𝑛 − 𝑘)] (14)


studies conducted by [1-6], in which the step-size is a fixed 𝑘=0
value. When the adaptation begins, and the tap weights are with
far from the optimal solution when first being adjusted, the ∂∇𝑚𝑠𝑒 (𝑛) ∂𝑒 2 (𝑛) ∂𝑒(𝑛)
= = 2𝑒(𝑛)
step-size should be large in order to move the weights more ∂𝑤𝑘 (𝑛) ∂𝑤𝑘 (𝑛) ∂𝑤𝑘 (𝑛)
rapidly to the desired solution [7]. The idea behind the (15)
LMS algorithm implemented here is to ensure proper = −2𝑒(𝑛)𝑛̃(𝑛 − 𝑘)
convergence in the mean with modest increase in
computation, which in turn results in a considerable resulting in the VSS-LMS gradient approximation for tap weight
adjustment as:
convergence rate, this is referred to as the variable step-size
LMS algorithm [7]. 𝑤(𝑛 + 1) = 𝑤(𝑛) + 2𝜇(𝑛)e(n)𝑛̃(𝑛 − 𝑘)
The adaptive noise cancelling algorithm employed with (16)
the digital stethoscope was that of the variable step-size with 𝜇(𝑛) subject to: 𝜇𝑚𝑖𝑛 < 𝜇(𝑛) < 𝜇𝑚𝑎𝑥
(VSS) least-mean-squares (LMS) algorithm. It was
constructed based on figure 3 below. The VSS-LMS algorithm defined in this project was
developed such that it adapts the step-size depending on the
difference between the input power of the desired signal
and the resulting error power at the output. If the error
signal approaches the desired signal, the difference in
signal power will approach zero. If the power of the output
error signal does not approach the power of the desired
signal, then the power of the error signal still contains
Fig. 3. Adaptive filter structure used in the VSS-LMS adaptive power associated to the noise power. Utilizing these
noise canceling procedure. underlying facts associated with the signal’s relative
where 𝑑(𝑛) is the primary diaphragm source corrupted by power, step-sizes can be directed such that optimal
some internal noise from the patient and 𝑛̃(𝑛) is a second convergence can be conducted in the VSS-LMS algorithm.
reference diaphragm placed on the patient away from the If the difference power is large, then the step-size
primary heart signal, such that the noise reference is should be larger so that the system can adapt more quickly.
considered uncorrelated to the heartbeat signal. Similarly, if the difference in power is small, then the step-
size should be small so that the system does not need to
A. VSS-LMS Algorithm adapt as quickly due to the close approximation of the
desired signal. The step-size was variably adjusted for
The input 𝑑(𝑛), i.e. the desired signal, is that of the optimal convergence based on relative power ratios
heart acoustics resonated from the resonator cavity and expressed as:
recorded by the microphone. It is modeled as:
𝑃𝑒𝑟𝑟𝑜𝑟 |𝑒(𝑛)|2 since 𝛼(𝑛) and 𝑠(𝑛) are uncorrelated processes, thus
𝑥= = (17) resulting in (22) after resubstituting 𝑛(𝑛) − 𝑛̂(𝑛) for 𝛼(𝑛):
2𝑃𝑑𝑒𝑠𝑖𝑟𝑒𝑑 2|𝑑(𝑛)|2

where step-size parameter 𝜇(𝑛), is linearly stepped as: 𝐸[𝑜𝑢𝑡𝑝𝑢𝑡 2 ] = 𝐸[𝑏(𝑛)2 ] + 𝐸[{𝑛(𝑛) − 𝑛̂(𝑛)}2 ] (23)

0.01, 𝑥 < 0.5 showing that the minimization of the noise does not affect
𝜇(𝑛) = {1.99𝑥 − 0.99, 0.5 ≤ 𝑥 ≤ 1 (18)
the signal power at the output of the adaptive VSS-LMS
1, 𝑥>1
filter. Leveraging these underlying assumptions, an
Equations (17) and (18) define the adaptive noise AWGN channel was constructed for the realization of 𝑛(𝑛)
canceling algorithm in an efficient way, such that if the and 𝑛̃(𝑛) noise references. The un-attenuated heartbeat
power of the error signal is twice the power of the desired signal s(n) is observed below.
signal, then the step-size will be set as the upper bound of
1. When the error becomes smaller and the difference
approaches zero, then the step-size reaches the lower
bound of 0.01. When the digital stethoscope is first started,
the step-size function is initialized to the lower bound,
0.01. After receiving the first x amount of samples, the
power levels are determined and the step-size is adjusted in
an iterative manner ensuring that the tap weights are
corrected effectively.
Fig. 4. Heartbeat signal to be identified by the VSS-LMS
adaptive noise canceling filter.
V. RESULTS
The signal was extracted from a database [9] and used
The VSS-LMS algorithm is an efficient algorithm for
as the heartbeat signal for simulation. Synthetic noise is
determining an optimum step-size value in the gradient
then injected into the signal with a mean of zero and a
approximation process for approximating the error. After
variance of 0.25, shown below in figure 5.
mathematically modeling the VSS-LMS adaptive noise
canceling algorithm, two simulations were conducted in
MATLAB. The first simulation encompassed the heartbeat
extraction from a pre-recorded signal embedded in additive
white Gaussian noise.

A. Additive White Gaussian Noise Channel

The system model encompassed a few assumptions


regarding the statistical nature of the additive white
Gaussian noise (AWGN) channel. When observing the Fig. 5. Additive white Gaussian noise injected into the heartbeat
adaptive filter structure of figure 3, we first must reveal that signal.
the heartbeat signal is unaffected by the error correcting
process, i.e. weight adjustment and noise cancellation. The where figure 5 depicts the desired signal 𝑛̂(𝑛) which is fed
first assumption is that the input signal 𝑠(𝑛), noise source to the VSS-LMS adaptive filter. From this, the result of the
𝑛(𝑛), reference noise source 𝑛̃(𝑛), and estimated noise VSS-LMS filter revealed an estimated heartbeat signal as
figure 6:
source 𝑛̂(𝑛) are statistically stationary with zero means [8].
The output of the adaptive filter is modeled as:
𝑜𝑢𝑡𝑝𝑢𝑡 = 𝑠(𝑛) + 𝑛(𝑛) − 𝑛̂(𝑛) (19)
which is re-written as:
𝑜𝑢𝑡𝑝𝑢𝑡 2 = [𝑠(𝑛) + 𝑛(𝑛) − 𝑛̂(𝑛)]2 (20)
substituting 𝛼(𝑛) for 𝑛(𝑛) − 𝑛̂(𝑛) and expanding gives:
𝑜𝑢𝑡𝑝𝑢𝑡 2 = 𝑠(𝑛)2 + 2𝛼(𝑛)𝑠(𝑛) + 𝛼(𝑛)2 (21)
and taking the expectation gives:
𝐸[𝑏(𝑛)2 ] + 2𝜇𝛼 𝜇𝑠 + 𝐸[𝛼(𝑛)2 ] (22)
Fig. 6. Reconstructed signal at the output of the VSS-LMS
adaptive noise canceling filter system.
B. Injected Noise Recorded by Digital Stethoscope [2] Y. Bai and C. Lu, “The Embedded Digital Stethoscope Uses
the Adaptive Noise Cancellation Filter and the Type I
The second simulation consisted of the injection of a Chebyshev IIR Bandpass Filter to Reduce the Noise of the
noise reference from a recording of a patient talking while Heart Sound.”
the diaphragm is placed on the right side of the patient’s
[3] F. Belloni, D. D. Giustina, M. Riva, and M. Malcangi, “A
chest. A second recording is made on the same patient for New Digital Stethoscope with Environmental Noise
measuring the patient’s heartbeat signal. Using these two Cancellation,” ADVANCES in MATHEMATICAL and
sources, the construction of the desired signal and noise COMPUTATIONAL METHODS.
reference was feasible. Figure 7 depicts the measured
heartbeat signal of the patient at rest. [4] S. B. Patel, T. F. Callahan, M. G. Callahan, J. T. Jones, G. P.
Graber, K. S. Foster, K. Glifort, and G. R. Wodicka, “An
Adaptive Noise Reduction Stethoscope for Auscultation in
High Noise Environments,” Acoustical Society of America,
May 1998.
[5] P. U. Kim, Y. Lee, J. H. Cho, and M. N. Kim, “Modified
Adaptive Noise Canceller with an Electrocardiogram to
Enhance Heart Sounds in the Auscultation Sounds,” The
Korean Society of Medical & Biological Engineering and
Springer 2011.
[6] B. E. Hill, “Reducing Background Noise through a
Fig. 7. Adaptive noise canceling via VSS-LMS algorithm with Stethoscope Cup using Adaptive Filters,” NASA Space
desired signal (left) and output signal (right). Grant Consortium, May 2010.

VI. CONCLUSION [7] M. H. Hayes, Statistical digital signal processing and


modeling. New Delhi: Wiley, 2014
The digital stethoscope simulations lay the foundation
[8] B. Widrow, J. M. McCOOL, C. S. Williams, J. R. Zeidler, J.
towards future growth of the VSS-LMS algorithm for
R. Glover, J. Kaunitz, R. H. Hearn, and R. C. Goodlin,
adaptive noise canceling in the medical industry. The VSS- “Adaptive noise cancelling: Principles and
LMS algorithm has proven to be an effective method at Applications,” Adaptive noise cancelling: Principles and
reconstructing the heartbeat signal, as well as mitigating applications - IEEE Journals & Magazine. [Online].
noise from internal resonations from a patient. The entire Available:
idea behind the developed digital stethoscope on the http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1451965
LPCXpresso54608 board is to explore the idea of creating Accessed: 07-Oct-2017].
a new method of helping medical examiners in the
diagnostic process of cardiac illness in patients. [9] “heart beat increasing 116642.wav by
Conventional methods of the LMS algorithm expressed klankbeeld,” Freesound.org. [Online]. Available:
https://freesound.org/people/klankbeeld/sounds/181805/.
highly accurate methods of adaptive noise canceling for
[Accessed: 08-Oct-2017].
digital stethoscopes, however, when noise variance is high
the step-size cannot adjust itself in helping speed up the
convergence process. Moreover, the conventional LMS
algorithm was employed for adaptively canceling the
external/background noise that can be received by the
microphone embedded within the resonator cavity of the
diaphragm connected to the traditional analog stethoscope,
which is not always going to be the source of noise.
Therefore, the implementation of the VSS-LMS algorithm,
along with the analysis of internal noise that can be present
in the diaphragm, brings a new method of adaptive noise
canceling to fruition that could be present in designed
digital stethoscopes on the market today.

VII. REFERENCES
[1] N. Jatupaiboon, S. Pan-Ngum, and P. Israsena, “Electronic
stethoscope prototype with adaptive noise
cancellation,” 2010 Eighth International Conference on ICT
and Knowledge Engineering, 2010.

S-ar putea să vă placă și