Arduino Electrocardiograph Project.

I HAVE SOLVED THE PROBLEM THANKS!

Fotoplestismografo_v1.ino (1.95 KB)

So, what's the error?

The BPS never change! They always appear in 0. Everything it´s ok but when the analog values pass the treshold the "anterior" variable becomes 0 and the BPM never increases. And when it is lower than the treshold everything appears normally again.
Oh! I forgot to say I am using an Intel´s Galileo.

Have you monitored the input values, for example by printing them to serial, to verify that you are actually receiving a decodable signal?

Yes I have, that was the fist thing I did. And I can also graph it perfectly, the problem as I said was tu calculate the BPS.

Okay, good. While I have your attention, why are you throwing away useful resolution by mapping the values to a smaller range? It's going to diminish the decoding quality.

Because if I dont map it, it shows very big on Processing.. What do you suggest?

luis_ag:
Because if I dont map it, it shows very big on Processing.. What do you suggest?

Map it for Processing, but don't map it for decoding.

Let me try, and I´ll tell you what happened.

I don't know what the original problem is, but this will create a problem eventually:

"My idea is detecting the BPM by calculating how many peaks are in 10 seconds, we can know this if we found a point which is smaller that the previous one and is also bigger than the treshold and then multiplying it by 10."

Isn't the BPM the number of beats in 10 seconds, multiplied by six ?

There are 60 seconds in a minute, not 100.

Where do you increment timer?

vaj4088:
I don't know what the original problem is, but this will create a problem eventually:

"My idea is detecting the BPM by calculating how many peaks are in 10 seconds, we can know this if we found a point which is smaller that the previous one and is also bigger than the treshold and then multiplying it by 10."

Isn't the BPM the number of beats in 10 seconds, multiplied by six ?

There are 60 seconds in a minute, not 100.

So? That part is ok, if you have the beats in 10 seconds you can aproximate the beats in 60 seconds by multiplying it by 6...

aarg:
Where do you increment timer?

I forgot to put it in the code! But the problem persists...

if((heartRate > anterior) && (anterior =! -1)){

! -1 would be zero would it not?

Did you mean !=?

Again here...

if ((anterior > heartRate) && (anterior > treshold) && (anterior =! -1)){

Hey !

Delta_G:

if((heartRate > anterior) && (anterior =! -1)){

! -1 would be zero would it not?

Did you mean !=?

Again here...

if ((anterior > heartRate) && (anterior > treshold) && (anterior =! -1)){

I was thinking in False = -1 and True = 1
BUT THAT WAS THE PROBLE!
I tried with False = 0 and True = 1 (in this case the variable "anterior") and not it works"
Thanks for your Help Delta_G!

luis_ag:
Hey !
I was thinking in False = -1 and True = 1
BUT THAT WAS THE PROBLE!
I tried with False = 0 and True = 1 (in this case the variable "anterior") and not it works"
Thanks for your Help Delta_G!

You could use the built in constants "true" and "false". Not only reliable, but easy to understand.