I don't understand how it has anything to do with heart beat...but detecting peaks can be done by sampling your signal over a period of time and selecting the highest value in that time window
I am using a ppg sensor to generate an analog signal and by finding peaks i can calculate the heart rate.so how to detect peaks and find distance between those peaks.
1. You convert your analog signal to a digital signal with an ADC. Your ADC will have to be selected according to your desired sampling rate. For example - 10,000 samples per second.
2. You define a time window in your software during which you compare each sampled signal to the one that came before it. If it's bigger then you mark it as the biggest.
3. You do the same thing for the next time window.