Determining the heart rate from KY 39 sensor using Uno

Hello All,
I am struggling to work out the heart rate from the signal received from KY39 sensor. Does anyone have a good algorithm to determine the number of peaks of a signal?
Any light that can be thrown on this issue will be appreciated.
Cheers,
Lourdes

Does anyone have a good algorithm to determine the number of peaks of a signal?

Well, first you have to determine that a peak occurred. Counting them is trivial.

Hello PaulS,
Do you know a way to detect the peak? Unfortunately setting up a threshold does not work in this case as the signal varies considerably.
Best,
Lourdes