Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Heart beat sensor, problem with the threshold value !

imane tech

New Member
Hello community!

I'm new on this forum. I'm working on my heartbeat sensor (pulse sensor) that uses PPG technology, i've got some troubles to calibrate the sensor. Actually, i don't know how to choose a "threshold value" in order to have the shape of that ppg signal when i put my finger on it. Do you have any idea, please ? If you want me to give more details, feel free to ask me, and thank you!!
 

rjenkinsgb

Well-Known Member
Most Helpful Member
I believe you will need an adaptive setup, where you use the peak maximum and minimum levels, and set the threshold proportionally between those.

Ideally monitor the levels on an oscilloscope to see what percentage between the peaks will give the ideal signal - or adjust through the range and use the midpoint between the extremes it becomes unreliable.
 

imane tech

New Member
Thanks so much for your reply!
Unfortunately, I don't have an oscilloscope available right now, but I'm using the serial monitor of Arduino instead, but still the same problem. To be more practical, I'm gonna share the result that I got, and the signal that I wish to have! The program that is available on Arduino's library suggests a threshold value that we can adjust, tried many values randomly f many times but in vain. Thank you so much!! I need help, please!
 

Attachments

  • ppg signal arduino threshold value problem.png
    ppg signal arduino threshold value problem.png
    27.3 KB · Views: 68
  • Clean and good ppg signal.PNG
    Clean and good ppg signal.PNG
    90.7 KB · Views: 61

danadak

Active Member
These might help -







This is soundcard solution, scope + spectrum analyzer + sig gen, make sure you protect inputs -


Google "protect soundcard inputs"


Regards, Dana.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
To be more practical, I'm gonna share the result that I got, and the signal that I wish to have!
It looks like you need a lot more gain before the ADC to get a decently accurate waveform representation.
You may be able to get something from the existing signal using a low pass filter, eg. like storing the last 32 samples in a circular buffer and adding them all together after each new sample, to get a slower-moving signal with a lot more levels.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Hello community!

I'm new on this forum. I'm working on my heartbeat sensor (pulse sensor) that uses PPG technology, i've got some troubles to calibrate the sensor. Actually, i don't know how to choose a "threshold value" in order to have the shape of that ppg signal when i put my finger on it. Do you have any idea, please ? If you want me to give more details, feel free to ask me, and thank you!!
What sensor are you using?, and how is it connected?, post a schematic.
 

imane tech

New Member
It looks like you need a lot more gain before the ADC to get a decently accurate waveform representation.
You may be able to get something from the existing signal using a low pass filter, eg. like storing the last 32 samples in a circular buffer and adding them all together after each new sample, to get a slower-moving signal with a lot more levels.
I believe that the signal that I will have on the serial plotter will not be clean, and this is normal because of motion artifacts, but this is the next step of my project which is filtering the signal. Firstly, I think I need to calibrate the sensor, then after having a noisy PPG signal, I'll try-finally to filter it. What do you think?
 

imane tech

New Member
Single chip approach with SOC and onboard digital filter -


Note this ap note seems to have been obsoleted, maybe contact author to see
if there is an update. Could be medical application some vendors gun shy on
involvement.

In general, PSOC has the following on it (single chip) -


View attachment 136672

Regards, Dana
Hello Dana!
Thanks for your help! I get from that document that maybe it is not necessary to have the shape of the signal that I am aiming for, because It is the main purpose of filtering, What do you think? But still, the threshold value needs to be adjusted!

PS: For filtering, I am planning to use LMS Algorithm.
 

imane tech

New Member
What sensor are you using?, and how is it connected?, post a schematic.
Hello! This is the guide that I am following.

 

rjenkinsgb

Well-Known Member
Most Helpful Member
According to the original article, the amplitude out of the sensor is near 200 ADC counts, which gives a decent signal range to work with; yours is more like 5 counts.

That implies something wrong with the hardware setup, a faulty sensor, or the ADC input pin is not configured correctly??
 

imane tech

New Member
I'm gonna share the Arduino code and the schematic. My circuit contains the following components: 10 LEDs, 10 resistors (1 k ohm), Arduino UNO, and my pulse sensor. The circuit is quite simple.
Thank you so much for your precious help!

According to the original article, the amplitude out of the sensor is near 200 ADC counts, which gives a decent signal range to work with; yours is more like 5 counts.

That implies something wrong with the hardware setup, a faulty sensor, or the ADC input pin is not configured correctly??
 

Attachments

  • scematic.PNG
    scematic.PNG
    58.4 KB · Views: 67
  • Arduino code pulse sensor.txt
    4.3 KB · Views: 55
  • schemaSimple.pdf
    144.7 KB · Views: 79

danadak

Active Member
Your first output pin is D2 so this :

//LEDS SETUP in Output
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}

should be :

//LEDS SETUP in Output
for (int thisPin = 2; thisPin < pinCount+2; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}

And you have other loops where you are setting / clearing pins starting with D0 ....instead of D2 ....


Regards, Dana.
 
Last edited:

imane tech

New Member
Regards, Dana.
Your first output pin is D2 so this :



should be :

//LEDS SETUP in Output
for (int thisPin = 2; thisPin < pinCount+2; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}

And you have other loops where you are setting / clearing pins starting with D0 ....instead of D2 ....


Regards, Dana.
so I'll start with D0, just a quick question please, I think that led 13 on Arduino's board will lighten if I have something wrong with my circuit, and the LEDs will lighten simultaneously with my heartbeat? What do you think?
 

danadak

Active Member
Stay with D2, so you dont give up your serial connection to IDE.

Your update loop is fast enough should look simultaneously.....

LED on D13 is not an overall circuit fail indicator......not sure why you think this.


Regards, Dana.
 
Last edited:

Latest threads

New Articles From Microcontroller Tips

Top