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 Arduino: A BPM Project

Monitoring heart rate is crucial in various health and fitness applications. BPM, or Beats Per Minute, is a measure of heart rate that indicates the number of heartbeats in one minute. This project aims to create a simple heart rate monitor using an Arduino microcontroller, which can be beneficial for fitness enthusiasts, medical professionals, and hobbyists interested in bio-sensing technology. By leveraging the Arduino environment, we can easily interface sensors and display units to measure and display BPM.

Project: The objective of this project is to build a heart rate monitor that measures the BPM using a pulse sensor and displays the result on an LCD screen. The functionalities include:

  1. Reading heart rate data from a pulse sensor.
  2. Calculating the BPM.
  3. Displaying the BPM on an LCD screen.
  4. Providing real-time updates of the heart rate.

Components List:

  1. Arduino Uno - 1
  2. Pulse Sensor - 1
  3. 16x2 LCD Display - 1
  4. Breadboard - 1
  5. Jumper Wires - As needed
  6. 10k Potentiometer - 1 (for LCD contrast adjustment)
  7. Resistors - 220 ohm (for LCD backlight)

Examples: Below is the Arduino code to read the heart rate from a pulse sensor and display the BPM on an LCD screen.

#include <LiquidCrystal.h>

// Initialize the LCD library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Pin where the pulse sensor is connected
const int pulsePin = A0;

// Variables to hold BPM calculations
int pulseValue = 0;
int BPM = 0;
unsigned long lastBeatTime = 0;
unsigned long currentTime = 0;
int beatCount = 0;

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  lcd.print("BPM Monitor");

  // Set up the pulse sensor pin
  pinMode(pulsePin, INPUT);

  // Serial monitor for debugging
  Serial.begin(9600);
}

void loop() {
  // Read the pulse sensor value
  pulseValue = analogRead(pulsePin);

  // Check if a beat is detected
  if (pulseValue > 550) {
    // Calculate the time between beats
    currentTime = millis();
    unsigned long timeDifference = currentTime - lastBeatTime;

    // If time difference is reasonable, calculate BPM
    if (timeDifference > 300) {
      BPM = 60000 / timeDifference;
      lastBeatTime = currentTime;
      beatCount++;

      // Update the LCD display every 5 beats
      if (beatCount >= 5) {
        lcd.clear();
        lcd.print("BPM: ");
        lcd.print(BPM);
        beatCount = 0;
      }
    }
  }

  // Debugging output to Serial Monitor
  Serial.print("Pulse Value: ");
  Serial.print(pulseValue);
  Serial.print(" BPM: ");
  Serial.println(BPM);

  delay(20); // Small delay to stabilize the readings
}

Explanation of the Code:

  • The LiquidCrystal library is used to control the LCD.
  • The pulse sensor is connected to pin A0.
  • The setup() function initializes the LCD and serial communication.
  • The loop() function continuously reads the pulse sensor value.
  • When a heartbeat is detected (pulse value > 550), the time difference between beats is calculated.
  • BPM is calculated using the formula BPM = 60000 / timeDifference.
  • The LCD is updated every 5 beats to display the current BPM.

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.