Sie sind auf Seite 1von 5

Heartbeat monitor using AT89C51

ON: AUGUST 22, 2012, BY: ADMIN, IN: 8051 MICROCONTROLLER, 11 COMMENTS

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.
?
1 #include<at89x52.h> // plz ad the reg51 . h file
#include<string.h> // plz ad the string . h file
2
//heart beat monitor 8051 based
3 #define lcdport P2 // chnage it for ur hardware
4 sbit rw = P3^7; // LCD connection may be different
5 sbit rs=P3^6; // LCD interface with microcontroller
6 sbit en=P3^5; // Enable pin of LCD
unsigned char sec,sec100;
7 unsigned int bt,tick,r,bpm;
void lcdinit();
8
void lcdcmd(unsigned char);
9 void lcddata(unsigned char);
10 void send_string(unsigned char *s);
11 void msdelay(unsigned int);
12
13 void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse
{
14 bt=tick; // number of ticks are picked
15 tick=0; // reset for next counting
16 }
17 void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
18 {
TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
19 sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
20 tick++; // This variable counts the time period of incoming pulse in Sec/100
21 if(tick>=3500){tick=0;} // tick are limited to less trhan 255 for valid calculatio
22 if(sec100 >=100) // 1 sec = sec100 * 100
{
23 sec++;
24 sec100=0;
25 }
26 }
27
28 void main()
{
29 P0=0xff;
30 P1=0xff;
31 P2=0xff;
32 P3=0xff;
33 rw=0;
EA = 1;
34 TMOD = 0x21;
35 IT0 = 1;
36 EX0 = 1;
37 ET0 = 1;
TR0 = 1;
38
39 msdelay(1000);
40 lcdinit();
41 msdelay(1000);
42 send_string("Heart beat ");
43 msdelay(1500);
44
msdelay(500);
45
46 //delay(15000);
47 bpm=0;bt=0;
48
49 while(1)
50 {
51
if(sec >=1)
52
{
53 sec=0;
/*
54
55
The sampling time is fixed 1 sec.
56 A variable "tick" is incremented with one tick per 100mSc in the timer 0 interrupt
57 Each on occurring of external interrupt the value in the "tick" is picked up
58 and it is set to zero for recounting.
59 The process continues till next external interrupt.
Formula for calculating beats per minutes (microcontroller based heartbeat monitor
60
61 as tick is the time period in Sec/100. so extract the frequency of pulses at exter
62 Frequency = (1/tick)* 100 i.e pulses /sec
63 Then
64 bpm = frequency * 60 for one minutes i.e pulses per minute
65 in short we can do it as
bpm = 6000/ bt
66
67 */
68 lcdcmd(0x02);
69 if(bt >=7){
70 bpm = 6000/bt; // for valid output bt is limited so that it should be greater than
msdelay(500);
71 send_string("Pulse. ");
72 lcddata((bpm/100)+0x30);
73 r=bpm%100;
74 lcddata((r/10)+0x30);
75 lcddata((r%10)+0x30);
send_string(" bpm ");
76 }
77 else {
78 send_string("out of range");} // otherwise bpm will be shown zero, if limit does n
79 change it.
80 }
}
81 }
82 void lcdinit()
83 {
84 msdelay(100);
lcdcmd(0x01);
85 msdelay(500);
86 lcdcmd(0x38);
87 msdelay(500);
88 lcdcmd(0x38);
89 msdelay(500);
lcdcmd(0x38);
90 msdelay(500);
91 lcdcmd(0x06);
92 msdelay(500);
93 lcdcmd(0x0c);
msdelay(500);
94
lcdcmd(0x03);
95 msdelay(500);
96 msdelay(500);
97 }
98 void lcdcmd(unsigned char value)
{
99 rs=0;
lcdport=value;
100
msdelay(100);
101 en=1;
102 msdelay(100);
103 en=0;
104 msdelay(100);
rs=1;
105 }
106 void lcddata(unsigned char value)
107 //heart beat monitoring system using microcontroller
108 {
109 rs=1;
lcdport=value;
110 msdelay(10);
111 en=1;
112 msdelay(100);
113 en=0;
rs=0;
114 }
115 void msdelay(unsigned int i)
116 {
117 //unsigned int i;
118 while(i --);
}
119 void send_string(unsigned char *s)
120 {
121 unsigned char l,i;
122 l = strlen(s); // get the length of string
123 for(i=1;i <=l;i++)
{
124 lcddata(*s); // write every char one by one
125 s++;
126 }
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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
https://www.youtube.com/watch?v=3tdumuwHgxc&feature=youtu.be
https://dadorran.wordpress.com/category/matlab-code/page/2/
http://eleceng.dit.ie/dorran/matlab/ecg.txt
https://www.physionet.org/physiobank/database/fantasia/subset/