Heart rate calculation

Hello
I'm in the final year of my study in fuclty of engineering i work on ECG signal and PPG signal I want to calculate the heart rate by using one of these signals to dertmine the heart rate form ECG signal I want to calculate the RR interval I want to detect the peak t of the signal and it's time but I can't find the suitable
code .can any one help me?
in pref i want to measure the time between the peaks but I don't know the period .

index.jpg

Test2.ino (717 Bytes)

sabergamal:
I'm in the final year of my study in fuclty of engineering
...
I can't find the suitable code .

By final year engineering, you should be, well, engineering a solution, ie figuring out the algorithm and designing the code and writing the code, not hoping to find it somewhere.

(I say that with all due respect.)

Link to a thread on autocorrelation approach to determining frequency of periodic signals:
https://forum.arduino.cc/index.php?topic=540969.15

Thread and posted code are for pitch detection of audio frequency signals, but approach should be applicable to any periodic signal.

There are, of course, other approaches, but this should be pretty robust even with noisy signals.

elvon_blunden:
By final year engineering, you should be, well, engineering a solution, ie figuring out the algorithm and designing the code and writing the code, not hoping to find it somewhere.

(I say that with all due respect.)

Thank you very much for this advice. I admit that I have started late, but do not be late to start the level of university education in Egypt is low, especially at the level of the program I have some solutions, but look for the best solution

thanks alots but I couldn't understand what u mean I don't know how to find the Freq of my signal I'm try to write acode to detect the peak time I don't know if this code right or not . if u examine the code and reply to me I'll be happy thank again.
I add the code in the post

MrMark:
Link to a thread on autocorrelation approach to determining frequency of periodic signals:
Arduino pitch detection in realtime (using autocorrelation and peak detection) - Project Guidance - Arduino Forum

Thread and posted code are for pitch detection of audio frequency signals, but approach should be applicable to any periodic signal.

There are, of course, other approaches, but this should be pretty robust even with noisy signals.