Digital Stethoscope using Arduino

As I am making a digital stethoscope using Arduino from the following youtube link but it not giving me an accurate bpm value.
Link:

Code is:
#include <SoftwareSerial.h>

int SoundSensor=A0;
int LED13=13;
int Signal;
int Threshold=250;
int S;

SoftwareSerial mySerial (0,1);

void setup()
{
pinMode(LED13,OUTPUT);
Serial.begin(9600);
}

void loop ()
{
Signal = analogRead(SoundSensor);
S=(Signal/8);
Serial.print("Your heart beat is: ");
Serial.println(S);
mySerial.println(S);
if(Signal > Threshold)
{
digitalWrite(LED13, HIGH);
}
else
{
digitalWrite(LED13, LOW);
}
delay(1000);
}

1 Like

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

2 Likes

if it's just reading sound level, doesn't the code need to recognize a heartbeat and then count the # of heartbeats over some interval of time?

2 Likes

What a cool idea- please keep us posted on the progress!! I've worked as a paramedic for over a decade so this is very interesting to me. Here is an idea-

Remove the diaphragm from the bell of the stethoscope!

If you have a smaller, open Bell on the other side, just rotate the head of the stethoscope 180° to do an initial quick test.


You could also consider using a single headed stethoscope to reduce noise.

If your testing with smaller open side is successful, consider a second test with the diaphragm removed from the primary bell (the big side.)

Here is why

Normal stethoscopes are pretty noisy. Unless the patient, the person holding the stethoscope, and the stethoscope itself are held very still, you're going to pick up a lot of white noise caused by friction on the diaphragm. This will make it hard to differentiate between heart noise and everything else.

A lot of noise comes from the person attempting to listen holding the stethoscope wrong- moving, pressing too hard, or placing a hand on the second diaphragm (pushing on the back instead of holding the stethoscope on the sides of the flange and holding it gently in place.

If you're results get more accurate, it's because you're filtering out a lot of the noise. If that is still not good enough in terms of BPM (beats per minute) accuracy, the next step is to filter your incoming audio signal.

Get more accurate sound with a Filter

Heart tones have an audio frequency on average from 20Hz to 200Hz. The heart tone can then be better isolated using frequency selection to ignore everything that isn't a heart tone. Look into simple circuits called passive high pass and passive low pass filters. There may be some options that are easy to include and would significantly increase the accuracy of the device.

Sample rate is important for BPM accuracy

HR (heart rate) is easily approximated by selecting a sample rate (I use 10 second) and counting the number of heart beats. That number × 6 = beats per minute. The longer the sample, the better your results (mostly because people stop moving around so much after about 20 seconds as they settle down.)

As for detection- Without a diaphragm on the bell, your device should be able to hear the lower tones of the heart in a relatively health person.

False positives

Things like respiratory illness and cardiac arrhythmias may cause a problem not easily overcome without a lot of extra code. For example, CHF, pneumonia, and any other disease causing rhonchi may trigger the same frequency range as the heart beats (wheezing like from COPD may be screened out as it has a higher pitch. ) And a person with supraventricular tachycardia, atrial fibrillation, a heart block, or frequent ectopic beats may prove difficult to display a "Beats per minute" without an extended sample time.

Read this article in the Journal of Biomedical Physics and Engineering!

"In this work, a new design with a low cost electronic stethoscope is designed and implemented as a simple circuit for a replacement with conventional stethoscopes. This presented a low cost stethoscopes consisting of a preamplifier, low-pass filter, high-pass filter, microcontroller and Bluetooth."

"The results indicated that an electronic stethoscope system could provide suitable information for BPM value and could display heart sound signals."

Good luck!

Now you can see how complex it can quickly become and why the EKG machines I use every day cost over $30,000USD! Finding a better, cheaper way to monitor for cardiac conditions is an awesome goal to have. Please let us know what you come up with and share the code and hardware setup you come up with.

Cheers!

1 Like

Can you help me how to plot phonocardiograph and display bpm at a time on Arduino ide?

What have you tried so far?
What sensor do you have?
Please provide your code attempt and a schematic of your circuit.

2 Likes

LM393 sound sensor
Electric microphone
Stethoscope

These component i have used.

Yes, i have tried a lot but all in vain.

With only the Uno and this '393 module (with the microphone (?) and the stethoscope) this should enable you to see beats, at least --

int beats;

void setup() 
{
  Serial.begin(19200);
  // from 'Tools' choose "Serial Plotter" (NOT Serial Monitor)
  // and make sure the baud/bps match
}

void loop() 
{
  beats = analogRead(A0);
  Serial.println(beats);
  delay(10);    // try faster -- or no delay

}

I don't have this '393 thingy. There may be a pot/gain adjust on it to dicker with.

I want to make digital stethoscope using arduino.I have tired alot but could not make a digital stethoscope accurately.Kindly help me.

Yes.

Hello zainzakir

We need some additional information.
Post your sketch, well formated, with well-tempered comments and in so called code tags "< code >" and schematic to see how we can help.

Have a nice day and enjoy coding in C++.

Digital stethoscope should measure bpm and convert sound wave into electric wave.

Yes, and what are your expections to this forum?

Most Arduinos are TOTALLY unfit for such an application! You need HIGH-QUALITY A/D and D/A converters to do a decent job of that. The very low-bandwidth, low-resolution, low-precision analog capabilities of most Arduinos are nowhere near good enough. FAR better to use a chip designed for doing audio.

I dare to disagree. ADC resolution is not a problem, and speed also should be sufficient. From that data it's possible to determine the bpm. Wave output will be the most difficult part, using PWM or (easier) an DAC.

which components are required for making digital stethoscope using arduino??

Start by creating a technical specification that contains all the physical and logical properties of the system.
Then you can make a hardware selection.

I have use LM393 sound sensor for bpm but problem is that it is continous giving bpm graph when stethoscope is not in contact.

We have used heart rate sensor already.