Heart Rate Pulse Sensor Display with Arduino: A Beginner’s Guide to Heart Rate Monitoring
Objective
The objective of this Heart Rate Pulse Sensor Display with Arduino project is to help beginners create a heart rate monitoring system using a pulse sensor. The project introduces biometric sensing, Arduino programming, and heart rate display.
Project Goal for Heart Rate Pulse Sensor Display with Arduino
- Learn to interface a pulse sensor with Arduino.
- Understand how to measure heart rate and display it on an LCD.
- Build a basic heart rate monitor to track the pulse rate in real-time.
Requirement Components for Heart Rate Pulse Sensor Display with Arduino
Here is the list of components needed to build the Heart Rate Pulse Sensor Display with Arduino:
- Arduino Uno — Buy on Amazon
- Pulse Sensor (e.g., Pulse Sensor Amped) — Buy on Amazon
- 16x2 LCD Display with I2C Module — Buy on Amazon
- Breadboard — Buy on Amazon
- Jumper Wires — Buy on Amazon
- USB Cable — Buy on Amazon
Sensor Basics for Heart Rate Pulse Sensor Display with Arduino
What is a Pulse Sensor?
The pulse sensor measures the heart rate by detecting changes in blood volume through an LED and photodiode. It is commonly used in wearable devices and heart rate monitoring systems.
How Does the Pulse Sensor Work?
- The sensor shines light on the skin and measures the light reflected, which varies with the blood volume.
- The signal is amplified and filtered, providing an analog output corresponding to the heartbeat.
Pinout of Pulse Sensor
- The pulse sensor typically has three main wires:
- VCC (Red wire): Connects to the 5V pin on Arduino.
- GND (Black wire): Connects to the GND pin on Arduino.
- Signal (Purple wire): Connects to an analog input pin (e.g., A0) on Arduino.
Sensor Real-Life Applications
- Wearable Health Devices: Tracks heart rate in fitness bands and smartwatches.
- Medical Monitoring: Monitors patient heart rate in hospitals.
- Sports Training: Measures athlete heart rate during exercise.
- Health Research: Collects heart rate data for medical studies.
Circuit Connection for Heart Rate Pulse Sensor Display with Arduino (In Detail)
- Connect the Arduino Uno: Use the USB cable to connect the Arduino Uno to your computer.
- Connect the Pulse Sensor:
- Connect the VCC (Red wire) of the pulse sensor to the 5V pin on Arduino.
- Connect the GND (Black wire) of the pulse sensor to the GND pin on Arduino.
- Connect the Signal (Purple wire) of the pulse sensor to analog pin A0 on Arduino.
- Connect the 16x2 LCD with I2C Module:
onnect the VCC of the LCD to the 5V pin on Arduino.
- Connect the GND of the LCD to the GND pin on Arduino.
- Connect the SDA pin of the LCD to the A4 (SDA) pin on Arduino.
- Connect the SCL pin of the LCD to the A5 (SCL) pin on Arduino.
Circuit Connection Analysis: How the Heart Rate Pulse Sensor Works
- The pulse sensor detects heartbeat signals and sends analog data to the Arduino.
- The Arduino processes the signal to calculate the heart rate in beats per minute (BPM).
- The 16x2 LCD displays the real-time heart rate.
Safety Tips for Heart Rate Pulse Sensor Display with Arduino
- Ensure proper contact between the pulse sensor and the skin for accurate readings.
- Use a stable power source to avoid noise interference.
- Disconnect the power supply when making or modifying circuit connections.
Arduino Programming Section for Heart Rate Pulse Sensor Display with Arduino
Arduino Syntax (Used in this Project)
- analogRead(pin); — Reads the analog value from the specified pin.
- lcd.print(text); — Displays text on the LCD.
- if (condition) { } — Executes code if the condition is true.
Arduino Code for Heart Rate Pulse Sensor Display with Arduino
Before using this code, install the LiquidCrystal_I2C library in the Arduino IDE by going to ‘Sketch’ > ‘Include Library’ > ‘Manage Libraries’, then search for “LiquidCrystal_I2C” and install it.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set LCD address to 0x27 for a 16x2 display
const int pulsePin = A0; // Pulse sensor connected to analog pin A0
int pulseValue; // Variable to store pulse sensor value
int threshold = 500; // Set threshold to detect heartbeat
unsigned long startTime = 0; // To track time for calculating BPM
int bpm = 0; // Variable to store beats per minute
int beatCount = 0; // Variable to count beats
void setup() {
lcd.begin(); // Initialize the LCD
lcd.backlight(); // Turn on the LCD backlight
pinMode(pulsePin, INPUT); // Set pulse sensor pin as input
lcd.setCursor(0, 0);
lcd.print("Heart Rate Monitor");
delay(2000); // Wait for 2 seconds
lcd.clear();
}
void loop() {
pulseValue = analogRead(pulsePin); // Read pulse sensor value
// Check if pulse exceeds threshold
if (pulseValue > threshold) {
beatCount++; // Increment beat count
delay(300); // Debounce delay to avoid multiple counts
}
// Calculate BPM every 10 seconds
if (millis() - startTime >= 10000) {
bpm = beatCount * 6; // Calculate BPM (beats in 10 seconds * 6)
beatCount = 0; // Reset beat count
startTime = millis(); // Reset start time
}
// Display BPM on LCD
lcd.setCursor(0, 0);
lcd.print("Heart Rate:");
lcd.setCursor(0, 1);
lcd.print(bpm);
lcd.print(" BPM");
delay(100); // Small delay for stability
}
Steps to Upload Code for Heart Rate Pulse Sensor Display with Arduino
- Open the Arduino IDE on your computer.
- Connect the Arduino Uno using the USB cable.
- Install the LiquidCrystal_I2C Library: Go to ‘Sketch’ > ‘Include Library’ > ‘Manage Libraries’, search for “LiquidCrystal_I2C”, and install it.
- Select the Board: Go to ‘Tools’ > ‘Board’ > ‘Arduino Uno’.
- Select the Port: Go to ‘Tools’ > ‘Port’ and select the correct port.
- Upload the Code: Copy the code above, paste it into the IDE, and click ‘Upload’.
Check Output of Heart Rate Pulse Sensor Display with Arduino
After uploading the code, place the pulse sensor on your finger or earlobe and observe the LCD. It should display the real-time heart rate in BPM.
Code Explanation for Heart Rate Pulse Sensor Display with Arduino
- analogRead(pulsePin);: Reads the analog value from the pulse sensor.
- if (pulseValue > threshold): Detects a heartbeat when the sensor value exceeds the threshold.
- bpm = beatCount * 6;: Calculates the beats per minute by multiplying the beats counted in 10 seconds by 6.
Troubleshooting Tips for Heart Rate Pulse Sensor Display with Arduino
- No response from the pulse sensor? Check the sensor connections and ensure it is properly positioned.
- Inaccurate readings? Adjust the threshold value and ensure good contact with the skin.
- No display on the LCD? Verify the I2C address and connections.
- Code not uploading? Confirm the correct board and port settings in the Arduino IDE.
Suggestion for Beginners
Book Recommendation
For a comprehensive guide on Arduino programming, I recommend Arduino Programming for Absolute Beginners. This book covers projects like the Heart Rate Pulse Sensor, offering clear instructions and practical examples.
Free Tutorials
For more tutorials on Arduino, ESP8266, ESP32, and Raspberry Pi projects, visit mechatronicslab.net.
Start building your own Heart Rate Pulse Sensor Display with Arduino and explore more health-based projects!