How to make a Pulse Rate Detector Using Arduino

pulse rate detector

Hey guys welcome back to the techatronic. Today we are going to make a very useful project the name of this project is pulse rate detector so this project we will make by using arduino. Where using arduino because the pulse rate sensor easy to interface with the Arduino. We have made pulse detector before but it was a folder version of our project so this time were upgrading our first detector project. So in this project I am going to share each detail and each step which help you to make this project where easily. So if you want to learn for me your own pulse detector project. So we need to read for full article to learn and make this project.

Introduction

So here he will talk about the pulse rate detector. What is the pulse rate detector and how does it work and where it can be used. So pulse rate detector is a device which can detect or monitor pulse rate. Pulse rate is a number of our heart pump the blood per minute. So it is basically the normal range is 72 pals per minute. It can be very from person to person like if you are in you may have the high pulse rate. So if you want to buy a pulse rate monitor device. Which can cost you around $100. So in this article I am sharing all the details from require material to required software.

HTML Image as link
Qries
Pulse Rate Detector

Which can help you to make this pulse rate detector easily in very cheap price. Pulse rate detector use a special kind of sensor which is known as Pulse sensor it can sense the pulse from our body. So all we have one question how does the sensor works. So here is a sensor and a light emitting diode which Emirates the light on our skin and turn back to the sensor continuously. In our skin we have a very small veins which carry the blood.

When our heart pump the blood the flow of blood in the veins increase suddenly which can cause the light more absorb by the more blood so now the sensor will get the less light when the blood is more in the veins so when the heart pump the blood the sensor will get the high value then its sense the blood flow increased in the ways which is a pulse. That is a pulse which can be detect by the pulse.

The pulse sensor send the data in analog form which can be detected or received by the Arduino analog pin. Now we are having the data which are receiving by the pulse sensor. So we can count how many pulse are there in 1 minute. So now we can display this data on our OLED screen. After some manipulation in the data received by the sensor we will directly show the data to the OLED screen.

Also we have insert an led and a buzzer to the project which makes sound and light when the pulse is detected so now our project is very reliable and very useful. So we will start making this project so first of all we would like to know what are the material we are required to make this. So we are going to make a list of material.

Required Material for Pulse Rate Detector

  • Arduino Nano
  • Pulse sensor
  • OLED Screen 1306
  • Zero Pcb /Bread Board
  • Hookup Wire /Jumper Wire
  • 9V Battery
  • Led
  • 220 ohm Resistor
  • Buzzer
ComponentsBuy Link
Arduino nano Buy Link
Pulse SensorBuy Link
OLED ScreenBuy Link
Zero PCBBuy Link
BreadboardBuy Link
Hookup wire Buy Link
Jumper Wire Buy Link
9V BatteryBuy Link
LED Buy Link
220 ohm ResistorBuy Link
BuzzerBuy Link

You can buy this full kit – BUY FULL KIT + MANUAL

Also, you cann buy this project – BUY READY MADE PROJECT

So, now we have shared all the components and their buy link. Now we have required the Circuit to make this project work.

Pulse Rate Detector Circuit Diagram

Pulse Rate Detector Circuit Diagram

Connections Explanation pulse rate detector

 Pulse Sensor

  • The pulse sensor has 3 wires:
    • Red → 5V (Power)
    • Black → GND (Ground)
    • Purple → A0 (Analog Input Pin on Arduino)
  • This sensor reads the heartbeat signal from your finger.

 2. SSD1306 OLED Display (I2C)

  • Has 4 pins: GND, VCC, SCL, SDA
    • GND → GND on Arduino
    • VCC → 5V on Arduino
    • SCL (Clock) → A5
    • SDA (Data) → A4
  • This OLED display will show the pulse rate in BPM (beats per minute).

 3. LED with Resistor

  • LED is used to give visual feedback (e.g., blink with each heartbeat).
    • Positive (Anode) → Digital Pin D2 (via current-limiting resistor)
    • Negative (Cathode) → GND

4. Buzzer

  • Used to give an audio beep on each heartbeat or alert.
    • Positive (Red wire) → D3

• • Negative (Black wire) → GND

Here, we have share all the connections detail. now we will make the Arduino code for our project.

I have assembled the whole circuit on a breadboard. As you know breadboard assembly is not effective for this type of project. So, PCBWay offers Rapid PCB Prototyping for Your Research Work. I personally, recommend PCBWay because you can get your first-try boards right in 24 hours!

Screenshot 2025 03 03 at 11.27.17 AM

The prototyping stage is the most critical period of time for engineers, students, and hobbyists. PCBWay not only makes your boards quick but also makes your job right as well as cost-effective. This greatly reduces your cost and shortens the time for developing your electronic

PCBWay can provide 2 Layer PCBs to highly advanced HDI and flex boards. Even though the PCBs they produce differ a lot regarding functionality and areas of use. I am impressed with the quality of the boards, the delivery time, and the cost-effectiveness

Pulse Rate Detector Arduino code



// Include Library

#include <SPI.h>

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

// 


// Configure OLED screen size in pixels

#define SCREEN_WIDTH 128 //--> OLED display width, in pixels

#define SCREEN_HEIGHT 64 //--> OLED display height, in pixels

// 


// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// 


// Variable Declarations

unsigned long previousMillisGetHR = 0; //--> will store the last time Millis (to get Heartbeat) was updated.

unsigned long previousMillisResultHR = 0; //--> will store the last time Millis (to get BPM) was updated.


const long intervalGetHR = 20; //--> Interval for reading heart rate (Heartbeat) = 10ms.

const long intervalResultHR = 10000; //--> The reading interval for the result of the Heart Rate calculation is in 10 seconds.


int PulseSensorSignal; //--> Variable to accommodate the signal value from the sensor

const int PulseSensorHRWire = 0; //--> PulseSensor connected to ANALOG PIN 0 (A0 / ADC 0).

const int LED_A1 = A1; //--> LED to detect when the heart is beating. The LED is connected to PIN A1 on the Arduino UNO.

int UpperThreshold = 530; //--> Determine which Signal to "count as a beat", and which to ingore.

int LowerThreshold = 500; 


int cntHB = 0; //--> Variable for counting the number of heartbeats.

boolean ThresholdStat = true; //--> Variable for triggers in calculating heartbeats.

int BPMval = 0; //--> Variable to hold the result of heartbeats calculation.


int x=0; //--> Variable axis x graph values to display on OLED

int y=0; //--> Variable axis y graph values to display on OLED

int lastx=0; //--> The graph's last x axis variable value to display on the OLED

int lasty=0; //--> The graph's last y axis variable value to display on the OLED

// 



// 'Heart_Icon', 16x16px

// I drew this heart icon at : http://dotmatrixtool.com/

const unsigned char Heart_Icon [] PROGMEM = {

  0x00, 0x00, 0x18, 0x30, 0x3c, 0x78, 0x7e, 0xfc, 0xff, 0xfe, 0xff, 0xfe, 0xee, 0xee, 0xd5, 0x56, 

  0x7b, 0xbc, 0x3f, 0xf8, 0x1f, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00, 0x00

};

// 


//  void setup

void setup() {

  pinMode(LED_A1,OUTPUT); //--> Set LED_3 PIN as Output.

  Serial.begin(9600); //--> Set's up Serial Communication at certain speed.

  

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally

  // Address 0x3C for 128x32 and Address 0x3D for 128x64.

  // But on my 128x64 module the 0x3D address doesn't work. What works is the 0x3C address.

  // So please try which address works on your module.

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { 

    Serial.println(F("SSD1306 allocation failed"));

    for(;;); //--> Don't proceed, loop forever

  }

  // 

  

  // Show initial display buffer contents on the screen

  // the library initializes this with an Adafruit splash screen.

  display.display();

  delay(1000);

  // 

  

    

  // Displays BPM value reading information

  display.clearDisplay();

  display.setTextSize(1);

  display.setTextColor(WHITE);

  

  display.setCursor(0, 12); //--> (x position, y position)

  display.print("     Please wait");

  

  display.setCursor(0, 22); //--> (x position, y position)

  display.print("     10  seconds");

  

  display.setCursor(0, 32); //--> (x position, y position)

  display.print("       to get");

  

  display.setCursor(0, 42); //--> (x position, y position)

  display.print(" the Heart Rate value");

  

  display.display(); 

  delay(3000);

  // 

  

  // Displays the initial display of BPM value

  display.clearDisplay(); //--> for Clearing the display

  display.drawBitmap(0, 47, Heart_Icon, 16, 16, WHITE); //--> display.drawBitmap(x position, y position, bitmap data, bitmap width, bitmap height, color)

  

  display.drawLine(0, 43, 127, 43, WHITE); //--> drawLine(x1, y1, x2, y2, color)

  

  display.setTextSize(2);

  display.setTextColor(WHITE);

  display.setCursor(20, 48); //--> (x position, y position)

  display.print(": 0 BPM");

  display.display(); 

  // 

  

  Serial.println();

  Serial.println("Please wait 10 seconds to get the BPM Value");

}

//  


//  void loop

void loop() {

  GetHeartRate(); //--> Calling the GetHeartRate() subroutine

}

//  


//  void GetHeartRate()

// This subroutine is for reading the heart rate and calculating it to get the BPM value.

// To get a BPM value based on a heart rate reading for 10 seconds.

void GetHeartRate() {

  // Process of reading heart rate.

  unsigned long currentMillisGetHR = millis();


  if (currentMillisGetHR - previousMillisGetHR >= intervalGetHR) {

    previousMillisGetHR = currentMillisGetHR;


    PulseSensorSignal = analogRead(PulseSensorHRWire); //--> holds the incoming raw data. Signal value can range from 0-1024


    if (PulseSensorSignal > UpperThreshold && ThresholdStat == true) {

      cntHB++;

      ThresholdStat = false;

      digitalWrite(LED_A1,HIGH);

    }


    if (PulseSensorSignal < LowerThreshold) {

      ThresholdStat = true;

      digitalWrite(LED_A1,LOW);

    }

    

    DrawGraph(); //--> Calling the DrawGraph() subroutine

  }

  // 


  // The process for getting the BPM value.

  unsigned long currentMillisResultHR = millis();


  if (currentMillisResultHR - previousMillisResultHR >= intervalResultHR) {

    previousMillisResultHR = currentMillisResultHR;


    BPMval = cntHB * 6; //--> The taken heart rate is for 10 seconds. So to get the BPM value, the total heart rate in 10 seconds x 6.

    Serial.print("BPM : ");

    Serial.println(BPMval);

    

    display.fillRect(20, 48, 108, 18, BLACK);

    

    display.drawBitmap(0, 47, Heart_Icon, 16, 16, WHITE); //--> display.drawBitmap(x position, y position, bitmap data, bitmap width, bitmap height, color)   

    display.drawLine(0, 43, 127, 43, WHITE); //--> drawLine(x1, y1, x2, y2, color)

  

    display.setTextSize(2);

    display.setTextColor(WHITE);

    display.setCursor(20, 48); //--> (x position, y position)

    display.print(": ");

    display.print(BPMval);

    display.print(" BPM");

    display.display(); 

    

    cntHB = 0;

  }

  // 

}

//  


//  Subroutines for drawing or displaying heart rate graphic signals

void DrawGraph() {

  // Condition to reset the graphic display if it fills the width of the OLED screen

  if (x > 127) {

    display.fillRect(0, 0, 128, 42, BLACK);

    x = 0;

    lastx = 0;

  }

  // 


  // Process signal data to be displayed on OLED in graphic form

  int ySignal = PulseSensorSignal; 

  

  if (ySignal > 850) ySignal = 850;

  if (ySignal < 350) ySignal = 350;


  int ySignalMap = map(ySignal, 350, 850, 0, 40); //--> The y-axis used on OLEDs is from 0 to 40

  

  y = 40 - ySignalMap;

  // 


  // Displays the heart rate graph

  display.writeLine(lastx,lasty,x,y,WHITE);

  display.display(); 

  // 

  

  lastx = x;

  lasty = y;

  

  x++;

}

Now, you need to upload the code into the Arduino nano by using the Arduino IDE.

If you have any doubt for how to upload the code you cas see our tutorial on it.

here we have shared the video on youtube.

Leave a Reply

Your email address will not be published. Required fields are marked *