Required Parts:
Software:
1.Arduino IDE
Hardware:
1.Arduino Uno
2.16x2 LCD display
3.Heart Rate Module
Heart Rate Serial Monitor:
Circuit Diagrams:
int rate;
int in = 8;
unsigned long time2,time1;
unsigned long time;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int k=0;
while(k<5)
{
if(digitalRead(in))
{
if(k==0)
time1=millis();
k++;
while(digitalRead(in));
}
}
time2=millis();
rate=time2-time1;
rate=rate/5;
rate=60000/rate;
Serial.println(rate);
}
Serial Monitor Output:
Heart Rate Monitor with LCD display:
Circuit Diagrams:
Arduino Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int rate=0;
int in = 6;
unsigned long time2,time1;
unsigned long time;
byte heart[8] =
{
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000
};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setCursor(3, 0);
lcd.print("NEMP Group");
delay(5000);
lcd.clear();
lcd.createChar(1, heart);
lcd.setCursor(12, 0);
lcd.write(1);
lcd.setCursor(0, 0);
lcd.print("Your Heart");
}
void loop() {
// put your main code here, to run repeatedly:
int k=0;
while(k<5)
{
if(digitalRead(in))
{
if(k==0)
time1=millis();
k++;
while(digitalRead(in));
}
}
time2=millis();
rate=time2-time1;
rate=rate/5;
rate=60000/rate;
Serial.println(rate);
lcd.setCursor(13,0);
lcd.print(rate);
delay(10);
if((rate>60) && (rate<100))
{
lcd.setCursor(2,1);
lcd.print(" Normal Beat ");
}
else if(rate<60)
{
lcd.setCursor(1,1);
lcd.print(" Low Beat ");
}
else if(rate>100)
{
lcd.setCursor(1,1);
lcd.print("Abnormal Beat");
}
}
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int rate=0;
int in = 6;
unsigned long time2,time1;
unsigned long time;
byte heart[8] =
{
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000
};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setCursor(3, 0);
lcd.print("NEMP Group");
delay(5000);
lcd.clear();
lcd.createChar(1, heart);
lcd.setCursor(12, 0);
lcd.write(1);
lcd.setCursor(0, 0);
lcd.print("Your Heart");
}
void loop() {
// put your main code here, to run repeatedly:
int k=0;
while(k<5)
{
if(digitalRead(in))
{
if(k==0)
time1=millis();
k++;
while(digitalRead(in));
}
}
time2=millis();
rate=time2-time1;
rate=rate/5;
rate=60000/rate;
Serial.println(rate);
lcd.setCursor(13,0);
lcd.print(rate);
delay(10);
if((rate>60) && (rate<100))
{
lcd.setCursor(2,1);
lcd.print(" Normal Beat ");
}
else if(rate<60)
{
lcd.setCursor(1,1);
lcd.print(" Low Beat ");
}
else if(rate>100)
{
lcd.setCursor(1,1);
lcd.print("Abnormal Beat");
}
}
No comments:
Post a Comment