ky-039 heartbeat sensor
Short description :
KY-039 heartbeat sensor module can be used to detect the heartbeat signal using a finger..
Working with (Compatible)
Arduino, ESP32, Nodemcu, ESP8266, Raspberry Pi, and ......
ARDUINO IDE CODE
Example description :
The KY-039 heartbeat sensor module can be used to detect the heartbeat signal using a finger. This sensor has an analog output. By placing your finger on the module, you can see the heartbeat signal through the analog output pin. In order to reduce the effect of noise on the output, the average of the last 20 output data is used. By placing your finger on the module, you can see how it works.
void setup() {
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop() {
float pulse;
int sum = 0;
for (int i = 0; i < 20; i++)
sum += analogRead(A0);
pulse = sum / 20.00;
Serial.println(pulse);
delay(100);
}