akk47
Published © MIT

Heart Beat sensing and displaying device

In now days pandemic it will be helpful if you can check your heart rate, so I have created this.

AdvancedFull instructions provided5,130
Heart Beat sensing and displaying device

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SparkFun Single Lead Heart Rate Monitor - AD8232
SparkFun Single Lead Heart Rate Monitor - AD8232
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fritzing

Story

Read more

Schematics

Heart rate sensing device

Code

My own heart rate detecting and displaying device

C/C++
This a device helpful to measure your heart rate
#define samp_siz 4
#define rise_threshold 4

int sensorPin = A0;

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
    Serial.begin(9600);
    lcd.begin(16, 2);
    lcd.print("heart rate: ");
}

void loop(){
    float reads[samp_siz], sum;
    long int now, ptr;
    float last, reader, start;
    float first, second, third, before, print_value;
    bool rising;
    int rise_count;
    int n;
    long int last_beat;

    for (int i = 0; i < samp_siz; i++)
      reads[i] = 0;
    sum = 0;
    ptr = 0;

    while(1)
    {
      n = 0;
      start = millis();
      reader = 0.;
      do
      {
        reader += analogRead(sensorPin);
        n++;
        now = millis();
      }
      while (now < start + 20);  
      reader /= n;  
      sum -= reads[ptr];
      sum += reader;
      reads[ptr] = reader;
      last = sum / samp_siz;
      
      if (last > before)
      {
        rise_count++;
        if (!rising && rise_count > rise_threshold)
        {
          
          rising=true;
          first=millis()-last_beat;
          last_beat=millis();
          print_value=60000/(0.035*first + 0.05*second + 0.1*third);
          
          delay(1500);
          Serial.print(print_value/2);
          Serial.print('\n');
              
          lcd.setCursor(0, 1);
          lcd.print(print_value/ 2); 
          
          third = second;
          second = first;
          
        }
      }
      else
      {
        rising = false;
        rise_count = 0;
      }
      before = last;
      
      
      ptr++;
      ptr %= samp_siz;
    }
      
}

Credits

akk47

akk47

7 projects • 9 followers

Comments