PULSE RATE SENSOR
PULSE RATE SENSOR
Application:
- Heart rate data is difficult to read, however the Pulse Sensor Amped help us to read heart rate.
- The Pulse Sensor is a plug-and-play heart-rate sensor for Arduino. It can be used by students, artists, athletes, makers, and game & mobile developers who want to easily incorporate live heart-rate data into their projects.
Sample Project With Arduino:
Materials required:
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h>
const int OUTPUT_TYPE = SERIAL_PLOTTER;
const int PIN_INPUT = A0;
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
const int PIN_FADE = 5;
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
PulseSensorPlayground pulseSensor;
Serial.begin(115200);
pulseSensor.analogInput(PIN_INPUT);
pulseSensor.blinkOnPulse(PIN_BLINK);
pulseSensor.fadeOnPulse(PIN_FADE);
pulseSensor.setSerial(Serial);
pulseSensor.setOutputType(OUTPUT_TYPE);
pulseSensor.setThreshold(THRESHOLD);
//
Now that everything is ready, start reading the PulseSensor signal.
if
(!pulseSensor.begin()) {
for(;;) {
// Flash the led to show things didn't work.
digitalWrite(PIN_BLINK, LOW);
delay(50);
digitalWrite(PIN_BLINK, HIGH);
delay(50);
} } }
void loop() {
/*Wait
a bit. We don't output every sample, because our baud rate won't support that
much I/O */
delay(20);
pulseSensor.outputSample();
if
(pulseSensor.sawStartOfBeat()) {
pulseSensor.outputBeat();
}}
Comments
Post a Comment