Most heart disease is related to and reflected by the sounds the heart makes, and one of the easiest and cheapest ways to diagnose cardiac dysfunction is cardiac auscultation, which is listening to heart sounds. Now, if we're talking about traditional auscultation, that requires experience and good listening skills. That's why in this project we considered to build an electronic stethoscope that can acquire human heart rate and we can display the data in a bluetooth based serial terminal window. So without further ado, let's get started.

How does a wireless digital stethoscope work?

Before we continue reading this article, let's discuss how this circuit works.

To get the heartbeat data, we first take a stethoscope, cut it in half, and attach a condenser microphone so we can get the heartbeat from the stethoscope. Next, we'll make an amplifier with an op-amp and amplify the signal from the microphone so we can read it using the Arduino's ADC. But before reading the signal we will pass it through a low pass filter which will reject all unwanted noise and signal and we will get a pure heartbeat signal at the output. Next, we will send this data to the bluetooth terminal window with the help of the HC-05 bluetooth module.

Components needed to build a wireless stethoscope

The components needed to build a wireless stethoscope are quite versatile, and you can find most of them at your local hobby store. A list of components is given below.

Arduino UNO

HC-05 Bluetooth module

NE5532 Operational Amplifier – 1

Bipolar power supply

Perfboard – 1

1K Resistors – 2

3.3K Resistor 1

10K Resistors – 3

100K Resistor – 1

470nF Capacitor – 1

2.2uF Capacitor – 1

Schematic diagram of wireless stethoscope

The schematic diagram of the wireless stethoscope is very simple and easy to understand. First, the heartbeat is picked up by a condenser microphone, and we have a 1uF DC blocking capacitor to block all DC components of the output signal. Next, we have a noninverting amplifier with a gain set to 100X. We set the gain to 100X with the help of 1k and 100K resistors to amplify the signal received by the microphone. Once the signal is amplified, we pass it through a low pass filter that rejects all signal components above 300 Hz and only passes that signal range. After that we have a voltage divider circuit, since we are using a 12-0-12 V transformer to power the actual circuit, the output of the op amp will be different, so you need to adjust the voltage divider according to this, so it is not given in the schematic The value of R1 and R2. Once done, we convert the signal with the help of the ADC and calculate the heartbeat based on the ADC signal and send the data with the help of the connected bluetooth module.

Bluetooth based wireless stethoscope code

The code for the Bluetooth based wireless stethoscope is very simple and easy to understand. We start our code by including all the required libraries. For this project, we only need one library to communicate with the bluetooth module, it is the software serial library,

#include

Next, we need to include the required variables. We define variables to store the ADC value and a counter to hold the number of pulses in a specific time period. We also have an interval variable containing millisecond values ​​that we will use to sample heartbeats and then calculate the mean of the variable. We also have a variable called previousMillis which holds the counter data and is used to compare with the milliseconds counter.

const int analog input pin = A0; // analog input pin the potentiometer is connected to int sensor value = 0; unsigned long counter = 0; integer interval = 5000; unsigned long previousMillis = 0;

Next, we initialized softserial and created an instance called BTserial. Through this, we can communicate with the Bluetooth serial port module.

SoftwareSerial BTserial(3, 4); // Receive | Texas

Next, we have our setup function. In the setup function, we call the begin method of the serial and BTserial instances with 9600 baud. This way we can debug via Arduino while communicating with the bluetooth module.

void set() { serial.start(9600); BTserial.begin(9600);}

Next, we have the loop function. In the loop function, we declare two variables currentMillis and currentMillis2. These will hold the two current timestamps, which will be useful later in the code.

unsigned long currentMillis = millis(); unsigned long currentMillis2 = millis();

Next, we have an if statement. In the if statement, we check if 30 seconds has elapsed, and if so, enter the next while loop. In the while loop, we get the ADC data and check if the received value is within a certain range, if it is, we increment the counter, incrementing the counter means that we have identified a heartbeat. Now we reset all variables and print the heartbeat account to the serial monitor window, we also send data over bluetooth.

if ((unsigned long)(currentMillis2 - previousMillis2) >= interval2) { while ((currentMillis - previousMillis) < interval)="" {="" sensor value="analog read(analog input pin);" if ( sensor value=""> 130 && sensor value < 250)="" {="" counter++;="" }="" }="" previous millis="currentMillis;" previous millis2="currentMillis2; " serial.println(counter);="" btserial.write(counter);="" }="">

This marks the end of our code section and we can move on to the next section, which is the testing part of the article.

Testing the Wireless Stethoscope Circuit

After the circuit is built, we put the stethoscope in and examine the waveform. To do this, we first tap the diaphragm of the stethoscope with a finger, which produces the result shown below −

Next, I put the stethoscope on my chest to observe the waveform, as shown in the picture below –

As you can see from the picture above, the peek-to-peek voltage coming out of the op amp is about 14.6V.

Next, we open the serial port monitor window to check whether the serial port data is accurate and whether the data is accurately printed on the serial port monitor window.

Next, we pair the bluetooth with the mobile phone, download the bluetooth serial terminal Android application, and connect the bluetooth with the serial terminal. Once everything is done, you can see that we are able to get data in the serial terminal window.

Problems we encountered during the build process

During the build process, we had a lot of problems, one of the most important was fitting the microphone to the stethoscope's pipe. To do this we had to scrape the stethoscope's tube a lot, then heat it to make the tube bigger, and then we used superglue to fasten the microphone to the stethoscope's tube.

The next big problem is noise. The stethoscope tube produces random noise when it rubs against the clothes, so we need to add a low pass filter to the output of the op amp stage.

Next, we must use software to filter the ADC data and use a for loop to average the data to stabilize the output of the module.

code

#include

const int analog input pin = A0; // analog input pin to which the potentiometer is connected

int sensor value = 0;

unsigned long counter = 0;

integer interval = 5000;

integer interval 2 = 5000;

unsigned long previousMillis = 0;

unsigned long previousMillis2 = 0;

SoftwareSerial BTserial(3, 4); // Receive | Texas

void set() {

serial.start(9600);

BTserial.begin(9600);

}

void loop() {

unsigned long currentMillis = millis();

unsigned long currentMillis2 = millis();

if ((unsigned long)(currentMillis2 – previousMillis2) >= interval2)

{

while ((currentMillis – previousMillis) <>

{

sensorvalue = analog read(analog input pin);

if (sensor value &gt; 130 &amp;&amp; sensor value &lt;&gt;

{

counter++;

}

}

previousMillis = currentMillis;

previous Millis2 = currentMillis2;

Serial.println(counter);

BTserial.write(counter);

}

}

Leave a Reply

Your email address will not be published.