How to calculate BPM for pulse sensore

Hi,

Currently I'm working on pulse sensor project. This is the code I'm using.

int ledPin = 13;
int sensorPin = A0;
double alpha = 0.75;
void setup ()
{
pinMode (ledPin, OUTPUT);
Serial.begin (115200);
}
void loop ()
{
static double oldValue = 0;
static double oldChange = 0;
int rawValue = analogRead (sensorPin);
float voltage = rawValue * (5.0 / 1023.0);
double BPM = alpha * oldValue + (1 - alpha) * rawValue;
Serial.println (BPM);
Serial.println (voltage);
delay(1000);
oldValue = value;

}

But I'm not getting proper BPM. Please help me If any one knows how to calculate BPM form analog values.

Please help me If any one knows how to calculate BPM form analog values.

What kind of sensor is it? How do you determine, using that sensor, that a beat has occurred?

I don't see a time register...

Also, with the delay function, the arduino really waits until the time is done. So it will only read the sensor pin once a second. Is that correct and what you want?

Actually I'm using this pulse sensor http://www.ebay.in/itm/HEARTBEAT-SENSOR-FINGER-PULSE-DETECTING-HEARTBEAT-5V-MODULE-For-ARDUINO-/251944160842?_trksid=p2054897.l5675 .

And also they have given some code I'm using that one only for testing but it is not giving proper values.