Arduino Nano Heartbeat Module

The Heartbeat Module project showcases how to utilize an Arduino Nano to measure and display heartbeat data using a heart rate (pulse) sensor. This project is valuable for health monitoring, fitness tracking, and educational purposes, providing insights into heart rate measurement techniques.

Components Needed

  • Arduino Nano
  • Heartbeat / Pulse Sensor (e.g. Pulse Sensor Amped or similar module)
  • Breadboard and Jumper Wires

Circuit Setup

1. Connect Heartbeat Sensor to Arduino Nano:

Connect the Vcc pin of the Heartbeat sensor to the 5V pin on the Arduino Nano.

Connect the GND pin of the Heartbeat sensor to the GND pin on the Arduino Nano.

Connect the output pin of the Heartbeat sensor to analog pin A0 on the Arduino Nano.

How the Heartbeat Module Works

The sensor shines an LED into the skin and measures small changes in reflected light caused by blood pulses. The Arduino reads the analog signal, detects each heartbeat, and calculates beats per minute (BPM) over a short time window.

Program: Arduino Nano Heartbeat Module (Basic BPM Monitor)
// Heartbeat sensor on analog pin A0
const int sensorPin = A0;

// Threshold to detect a pulse (fine‑tune based on your sensor)
const int threshold = 600;

// Variables for pulse detection
int lastValue = 0;
int currentValue = 0;
int pulseCount = 0;
unsigned long startTime = 0;
unsigned long currentTime = 0;

void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
  Serial.println("=== HEARTBEAT MODULE READY ===");
  Serial.println("Raw  | Event    | BPM (approx)");
  
  startTime = millis();
  lastValue = analogRead(sensorPin);
}

void loop() {
  // Read the sensor
  currentValue = analogRead(sensorPin);
  
  // Simple pulse detection when signal crosses threshold
  if (currentValue > threshold && lastValue <= threshold) {
    pulseCount++;
  }
  
  // Update time
  currentTime = millis();
  long elapsedTime = (currentTime - startTime) / 1000;
  
  // Compute approximate BPM every 5 seconds
  if (elapsedTime >= 5 && elapsedTime % 5 == 0) {
    int approxBPM = 0;
    if (pulseCount > 0) {
      approxBPM = (pulseCount * 60) / elapsedTime;
    }
    
    Serial.print(currentValue);
    Serial.print("  | PULSE    | ");
    Serial.println(approxBPM);
    
    pulseCount = 0;
    startTime = currentTime;
  }
  
  // Smooth last value
  lastValue = currentValue;
  
  delay(50);
}

Instructions

1. Circuit Setup:

Wire the Heartbeat sensor to the Arduino Nano as described in the circuit setup section.

2. Code Upload:

Connect the Arduino Nano to your computer using a USB cable.

Launch the Arduino IDE and paste the provided heartbeat module code.

Choose the appropriate board (Arduino Nano) and port from the Tools menu.

Upload the code to the Arduino Nano.

3. Testing:

After uploading the code, place the heart rate sensor on your fingertip or earlobe and keep your hand still.

Monitor the Serial Monitor for the displayed beats per minute (BPM) readings every 5 seconds.

Applications

Health Monitoring: Utilize heartbeat data for real‑time health assessment and monitoring, such as checking resting pulse or recovery after exercise.

Fitness Tracking: Track exercise intensity and performance by monitoring heart rate during workouts.

Educational Purposes: Explore heart rate measurement principles and sensor interfacing with microcontrollers in labs and hobby projects.

Troubleshooting and Tips

  • No BPM output? Adjust the threshold value or try a different finger or earlobe; each sensor and person behaves slightly differently.
  • Erratic BPM values? Keep your hand still and avoid bright external light falling on the sensor.
  • Signal is too low or clipped? Reduce finger pressure or move the sensor slightly for better blood‑flow detection.

Best Practices and Notes

  • Use a commercial pulse/heartbeat module (e.g. Pulse Sensor Amped) for more stable and accurate readings.
  • Apply gentle pressure on the sensor; pressing too hard can block blood flow and distort the heartbeat signal.
  • Place the sensor on a clean, warm, and dry finger or earlobe for optimal performance.
  • This project is for educational and hobby use, not for medical diagnosis.

Expansions and Ideas

You can extend this project by adding an LED that blinks with each heartbeat, sending data to a computer or smartphone for real‑time graphs, or combining it with an LCD to display BPM directly on the device.