RAJESH SINHA
Published © CERN-OHL2

Pulse Rate (BPM) Monitor using Arduino & Pulse Sensor

"Monitor pulse rate in real-time using Arduino, Pulse Sensor, and 16x2 LCD display for an easy, accurate BPM reading. "

IntermediateFull instructions provided10 hours605
Pulse Rate (BPM) Monitor using Arduino & Pulse Sensor

Things used in this project

Story

Read more

Schematics

rajesh_kumar_(1)_xbJvnPf2rO.png

Code

Untitled file

Arduino
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
 
 
// Constants
const int PULSE_SENSOR_PIN = 0;  // Analog PIN where the PulseSensor is connected
const int LED_PIN = 13;          // On-board LED PIN
const int THRESHOLD = 550;       // Threshold for detecting a heartbeat
 
// Create PulseSensorPlayground object
PulseSensorPlayground pulseSensor;
 
void setup()
{
  // Initialize Serial Monitor
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
 
  // Configure PulseSensor
  pulseSensor.analogInput(PULSE_SENSOR_PIN);
  pulseSensor.blinkOnPulse(LED_PIN);
  pulseSensor.setThreshold(THRESHOLD);
 
  // Check if PulseSensor is initialized
  if (pulseSensor.begin())
  {
    Serial.println("PulseSensor object created successfully!");
  }
}
 
void loop()
{
  lcd.setCursor(0, 0);
  lcd.print("Heart Rate");
  
  // Get the current Beats Per Minute (BPM)
  int currentBPM = pulseSensor.getBeatsPerMinute();
 
  // Check if a heartbeat is detected
  if (pulseSensor.sawStartOfBeat())
  {
    Serial.println("Hrart : ");
    Serial.print("BPM : ");
    Serial.println(currentBPM);
 
    lcd.clear();
    lcd.setCursor(0, 1);
    lcd.print("BPM: ");
    lcd.print(currentBPM);
  }
 
  // Add a small delay to reduce CPU usage
  delay(20);
}

Credits

RAJESH SINHA
14 projects • 11 followers
Hey there! I'm Rajesh. I'm passionate about building innovative projects.mail id:- rajeshkumar15022004@gmail.com
Contact

Comments

Please log in or sign up to comment.