Schematic Heart rate (beats) Meter with Microcontroller AT89c51 | Controller Circuit

Friday, February 10, 2012

Schematic Heart rate (beats) Meter with Microcontroller AT89c51

This is revised version of heart beat monitor located in this blog ob post.
http://microcontroller.circuitlab.org/2010/07/heart-beat-monitor-with-microcontroller.html
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.

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.
Circuit diagram of the heart rate monitor is shown below.

Heart beat monitor circuit with Microcontroller AT89c51, LCD display, heart pulses circuit diagram, microcontroller based heart beat monitor
The code is written in keil C51 compiler. The c code listing for heart rate (beat) monitor is given below.
#include // plz ad the reg51 . h file
#include // plz ad the string . h file

#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 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)
{
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,

No comments:

Post a Comment