Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Heart Rate Monitor with I2C LCD Display using Arduino UNO

View and Edit Project In Cirkit DesignerImage of Heart Rate Monitor with I2C LCD Display using Arduino UNO

Circuit Documentation

Summary

This circuit is designed to monitor heart rate using a Heart Pulse Sensor and display the results on a 16x2 I2C LCD. The Arduino UNO serves as the microcontroller, processing the sensor data and controlling the LCD display. The circuit is powered by the Arduino's 5V output, and both the sensor and the LCD are connected to the Arduino via I2C communication.


Component List

Arduino UNO

16x2 I2C LCD

Heart Pulse Sensor


Wiring Details

Arduino UNO


16x2 I2C LCD


Heart Pulse Sensor


Documented Code

/*
 * Arduino Sketch for Heart Pulse Sensor with LCD Display
 * 
 * This code reads data from a heart pulse sensor connected to the Arduino UNO
 * and displays the pulse rate on a 16x2 I2C LCD. The sensor's signal pin is 
 * connected to the A0 pin of the Arduino. The code utilizes the PulseSensor 
 * library to process the sensor data and the LiquidCrystal_I2C library to 
 * display the BPM on the LCD.
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <PulseSensorPlayground.h>

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

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

// Initialize the LCD with the I2C address 0x27 and 16 columns x 2 rows
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize serial communication at 9600 bits per second
  Serial.begin(9600);

  // Initialize the LCD
  lcd.begin(16,2);
  lcd.backlight();

  // Configure the pulse sensor
  pulseSensor.analogInput(PULSE_SENSOR_PIN);
  pulseSensor.setSerial(Serial);
  pulseSensor.setThreshold(535); 

  // Start the pulse sensor
  if (pulseSensor.begin()) {
    Serial.println("Pulse sensor started successfully.");
    lcd.setCursor(0, 0);
    lcd.print("Pulse Sensor OK");
  } else {
    Serial.println("Pulse sensor failed to start.");
    lcd.setCursor(0, 0);
    lcd.print("Sensor Fail");
  }
}

void loop() {
  // Read the pulse sensor
  int myBPM = pulseSensor.getBeatsPerMinute();

  // If a valid BPM is detected, print it to the console and display on LCD
  if (pulseSensor.sawStartOfBeat()) {
    Serial.print("BPM: ");
    Serial.println(myBPM);
    lcd.setCursor(0, 1);
    lcd.print("BPM: ");
    lcd.print(myBPM);
    lcd.print("   "); // Clear any leftover digits
  }

  // Add a small delay to stabilize readings
  delay(10);
}

This documentation provides a comprehensive overview of the circuit, detailing the components used, their connections, and the code that drives the functionality of the heart rate monitoring system.