Heartbeat monitor using AT89C51


This is revised version of heart beat monitor using 8051 heart beat monitor located in this blog ob post. There were some question asked related to this project. So i decided to redesign the project and make some necessary changes in the algorithm to measure the heart pulses per minute. microcontroller based heartbeat monitor with lcd display ir led and ldr based heartbeat monitor with display on computer and microcontroler LCD display.

The heart rate meter is used to measure the heart beats per minute from finger placing between the sensor. The sensor is made of simple photo resistor and LED. The pulses from the circuit are them amplified and converted into TTL logic pulses using comparator Operational Amplifier.
The analog section of the project is same and taken as such from the last post on this project. Student can take the circuit diagram from that post, if it is not clear. However the LCD connection to Microcontroller are changed in this post. As describe earlier this post is written in the response of student questions so the hardware is slightly changed. If you are familiar of electronics and lcd PIN connection, then you will notice there are not major changes. for LCD details like PIN connection and interfacing with microcontroller, you can just read some related post in this blog. Sufficient material is uploaded for the interfacing of LCD with microcontroller.
In this project, we have used one line 16 character LCD, but any other similar LCD can be connected.heart beat monitor (8051based)
Circuit diagram of the heart rate monitor(micro controller based heartbeat monitor ) is shown below.how we can calculate the heart beat with photo resistance


The code is written in keil C51 compiler. The c code listing for heart rate (beat) monitor is given below.

 

#include<at89x52.h> // plz ad the reg51 . h file
#include<string.h> // plz ad the string . h file
//heart beat monitor 8051 based
#define lcdport P2 // chnage it for ur hardware
sbit rw = P3^7; // LCD connection may be different
sbit rs=P3^6; // LCD interface with microcontroller
sbit en=P3^5; // Enable pin of LCD
unsigned char sec,sec100;
unsigned int bt,tick,r,bpm;
void lcdinit();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void send_string(unsigned char *s);
void msdelay(unsigned int);

void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse
{
bt=tick; // number of ticks are picked
tick=0; // reset for next counting
}
void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
{
TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
tick++; // This variable counts the time period of incoming pulse in Sec/100
if(tick>=3500){tick=0;} // tick are limited to less trhan 255 for valid calculation
if(sec100 >=100) // 1 sec = sec100 * 100
{
sec++;
sec100=0;
}
}

void main()
{
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
rw=0;
EA = 1;
TMOD = 0x21;
IT0 = 1;
EX0 = 1;
ET0 = 1;
TR0 = 1;

msdelay(1000);
lcdinit();
msdelay(1000);
send_string("Heart beat ");
msdelay(1500);

msdelay(500);

//delay(15000);
bpm=0;bt=0;

while(1)
{

if(sec >=1)
{
sec=0;
/*

The sampling time is fixed 1 sec.
A variable "tick" is incremented with one tick per 100mSc in the timer 0 interrupt routine.
Each on occurring of external interrupt the value in the "tick" is picked up
and it is set to zero for recounting.
The process continues till next external interrupt.
Formula for calculating beats per minutes (microcontroller based heartbeat monitor ) is

as tick is the time period in Sec/100. so extract the frequency of pulses at external interrupt
Frequency = (1/tick)* 100 i.e pulses /sec
Then
bpm = frequency * 60 for one minutes i.e pulses per minute
in short we can do it as
bpm = 6000/ bt

*/
lcdcmd(0x02);
if(bt >=7){
bpm = 6000/bt; // for valid output bt is limited so that it should be greater than 6
msdelay(500);
send_string("Pulse. ");
lcddata((bpm/100)+0x30);
r=bpm%100;
lcddata((r/10)+0x30);
lcddata((r%10)+0x30);
send_string(" bpm ");
}
else {
send_string("out of range");} // otherwise bpm will be shown zero, if limit does not fit for your project you can change it.
}
}
}
void lcdinit()
{
msdelay(100);
lcdcmd(0x01);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x06);
msdelay(500);
lcdcmd(0x0c);
msdelay(500);
lcdcmd(0x03);
msdelay(500);
msdelay(500);
}
void lcdcmd(unsigned char value)
{
rs=0;
lcdport=value;
msdelay(100);
en=1;
msdelay(100);
en=0;
msdelay(100);
rs=1;
}
void lcddata(unsigned char value)
//heart beat monitoring system using microcontroller
{
rs=1;
lcdport=value;
msdelay(10);
en=1;
msdelay(100);
en=0;
rs=0;
}
void msdelay(unsigned int i)
{
//unsigned int i;
while(i --);
}
void send_string(unsigned char *s)
{
unsigned char l,i;
l = strlen(s); // get the length of string
for(i=1;i <=l;i++)
{
lcddata(*s); // write every char one by one
s++;
}
}

This post is related to following topics:
biomedical instrumentation, easy way to monitor pulses from heart on finger, measure heart beats pulses with microcntroller 8051, pulse rate of a human heart,A heart rate monitor is a personal monitoring device which allows a subject to measure his heart rate in real time or record his heart rate,
Digital heart rate meter using microcontroller 8051.

microcontroller based heart rate meter,8051 pin diagram,invention heart rate meter,heart meter watch,heart beat monitor project,microcontroller based heart beat monitor,8051 isp programmer,heartbeat monitor and display on LCD,heart beat rate monitor with sensor,training heart rate monitor with comaprators ans sensor,8051 microcontroller application,optocoupler based sensor of runner heart rate monitor,how to measure heart beat, calculate heartbeat just in one second,8051 rtos,limitations of heart rate monitors, quick display of heart monitor,advantages of electronic medical records,electronic medical billing,used electronic test equipment,electronic document management solution,fetal heart rate monitor,wrist heart rate monitor,avr 8051,baby heart monitor,heart beat counter using microcontroller 8051, block diagram for ir led and ldr based heartbeat monitor with display on computer, MICROCONTROLLER AT89C2051 BASED HEART BEAT MONITOR (PULSE RATE wth assembly code),ir led and ldr based heartbeat monitor with display on computer,wireless biomedical monitoring system using 89S52 microcontroller,wireless biomedical monitoring system using 89S52 microcontroller,8051microcontroller based heart beat monitor,heart pulse system project

Related posts:

About author

This article was written by admin

Admin has over twenty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles. Working presently as Development Manager in India. A firm Believer in Knowledge grows when it shared.

Comments

Comments (6)
  1. Wiedza i życie says - Posted: September 15, 2012

    I have been browsing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the internet will be a lot more useful than ever before.

    • anna.share2012 says - Posted: September 15, 2012

      Thanks Wedza, Thanks for your appreciation and comments ….thank you!

      • syed umair shah says - Posted: November 2, 2013

        Sir we have implemented your code along with the circuit provided in proteus but we getting msg this “out of range” all the time, can u please make sure that this project will work in proteus simulation?…….

  2. emmi says - Posted: December 7, 2012

    I am working on this circuit but it doesn’t show any result on zit just show squares on bottom line of lcd ,i have checked all the thngs but still couldn’t resolve the problem

  3. sreedevi says - Posted: October 9, 2013

    sir actyually in this code it is not reading the pulse count which is generated while interrupt occurs but it directly display out of range on lcd

Leave a Reply