Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Monitoring Heart Rate with PulseSensor and Arduino

In this article, we will explore how to use a PulseSensor with an Arduino to monitor heart rate. The PulseSensor is a plug-and-play heart-rate sensor that can be used to measure the pulse rate of an individual. It is particularly useful in health monitoring systems, fitness trackers, and biofeedback applications. By integrating the PulseSensor with an Arduino, we can create a simple yet effective heart rate monitoring system. This project will guide you through the setup process, the necessary components, and the code required to get the PulseSensor working with an Arduino.

Project: In this project, we will create a heart rate monitoring system using a PulseSensor and an Arduino. The objective is to measure the heart rate and display it on the serial monitor. The system will read the analog signal from the PulseSensor, process it to detect heartbeats, and calculate the beats per minute (BPM). This project is ideal for beginners looking to get started with bio-sensing technology and Arduino.

Components List:

  1. Arduino Uno (1)
  2. PulseSensor (1)
  3. Breadboard (1)
  4. Jumper Wires (assorted)
  5. USB Cable (1) - to connect Arduino to the computer

Examples:

// Include the PulseSensor library
#include <PulseSensorPlayground.h>

// Constants
const int PulseSensorPin = A0; // PulseSensor connected to analog pin A0
const int LED13 = 13;          // The on-board Arduino LED, close to pin 13

// Variables
int BPM;                       // Variable to hold the heart rate value
boolean pulseDetected = false; // Flag to indicate if a pulse is detected

// Create an instance of the PulseSensorPlayground object
PulseSensorPlayground pulseSensor;

void setup() {
  // Initialize the serial communication
  Serial.begin(9600);

  // Configure the PulseSensor
  pulseSensor.analogInput(PulseSensorPin);
  pulseSensor.blinkOnPulse(LED13); // Blink on-board LED with heartbeat
  pulseSensor.setThreshold(550);   // Adjust the threshold value as needed

  // Start the PulseSensor
  if (pulseSensor.begin()) {
    Serial.println("PulseSensor started successfully!");
  } else {
    Serial.println("PulseSensor failed to start.");
  }
}

void loop() {
  // Read the PulseSensor
  BPM = pulseSensor.getBeatsPerMinute();
  pulseDetected = pulseSensor.sawStartOfBeat();

  // If a pulse is detected, print the BPM value
  if (pulseDetected) {
    Serial.print("BPM: ");
    Serial.println(BPM);
  }

  // Delay for a short period to avoid overwhelming the serial monitor
  delay(20);
}

Explanation:

  1. Library Inclusion: The PulseSensorPlayground library is included to simplify the use of the PulseSensor.
  2. Constants: The PulseSensorPin is set to analog pin A0, and the on-board LED pin is set to 13.
  3. Variables: BPM holds the heart rate value, and pulseDetected is a flag to indicate pulse detection.
  4. Setup Function:
    • Serial communication is initialized.
    • The PulseSensor is configured with the analog input pin and the on-board LED for heartbeat indication.
    • The threshold value is set to 550, which can be adjusted based on the sensor's sensitivity.
    • The PulseSensor is started, and a success or failure message is printed to the serial monitor.
  5. Loop Function:
    • The heart rate is read from the PulseSensor.
    • If a pulse is detected, the BPM value is printed to the serial monitor.
    • A short delay is added to avoid overwhelming the serial monitor with data.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.