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 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:
Components List:
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:
LiquidCrystal
library is used to control the LCD.setup()
function initializes the LCD and serial communication.loop()
function continuously reads the pulse sensor value.BPM = 60000 / timeDifference
.