Heartbeat Detector Sensor Module
This uses a bright infrared (IR) LED and a phototransistor to detect the pulse of the finger.
It is important to keep stray light away from the phototransistor. For home lighting that is particularly important because the lights at home mostly based 50HZ or 60HZ fluctuate, so faint heartbeat will add considerable noise. Model #KY039.
EXAMPLE CODE: // Pulse Monitor Test Script
int sensorPin = 0;
double alpha = 0.75;
int period = 100;
double change = 0.0;
double minval = 0.0;
void setup () { Serial.begin (9600); }
void loop () {
static double oldValue = 0;
static double oldChange = 0;
int rawValue = analogRead (sensorPin);
double value = alpha * oldValue + (1 - alpha) * rawValue;
Serial.print (rawValue);
Serial.print (",");
Serial.println (value);
oldValue = value;
delay (period);
}