A pair of LED and LDR is used as sensor for sensing the pulses of heart. The signal is generated when a finger is placed between LED and LDR. OP amp LM358 is used for the further processing of the signal generated from the LDR, if finger is placed and some obstacle for light is created, which it self is varying with the pressure of blood in the veins of finger.
The output of two operational amplifiers is TTL pulses. For a healthy person, these pulses should be nearly equal to 70 to 80 BPM and if we convert it into frequency then we will get 1.2 to 1.4 Hz.
The microcontroller PIC16f84 senses these TTL pulses generated from the analog circuit and count then using a very simple algorithm converts them into beats per minuets.
The results of the beats are shown on LCD with unit BPM.
For display of heart beat monitor , a general purpose LCD is used. Students can use any single line or two line LCD available in their local market. As, in the program, only first 16 characters and first line is used to display any message on LCD. If any student got 2 line and 20 characters LCD, it will also works good.
Here is circuit diagram of the heart beat monitor using PIC microcontroller 16f84.
below is c language code for the heart rate monitor using PIC microcontroller 16f84, the c code is written Hi-Tech C.
//# define
# include < pic . h>
#define rs RA2
#define e RA1
#define lcd_data PORTB
#define _XTAL_FREQ 4000000
void delayms(unsigned int itime);
void pulse(void);
void send_char(unsigned char data);
void lcd_goto(unsigned char data);
void lcd_clr(void);
void send_string(const char *s);
void init_lcd(void);
void dis_num(unsigned int data,unsigned char digit);
void prog1(void);
unsigned long no=0;
void main (void)
{
TRISA=0;
TRISB=0;
TRISA3=1;
init_lcd();
delayms(10);
lcd_clr();
delayms(10);
send_string("Heart rate meter");
delayms(1000);
lcd_clr();
delayms(10);
while(1)
{
prog1();
}
}
void prog1(void)
{
unsigned int temp1=0,temp2=0;
unsigned char i;
unsigned int hb=1;
while(RA3);
while(!RA3){
hb++;
delayms(1);
}
hb=30000/hb;
lcd_goto(2);
send_string("H.B.R: bpm");
lcd_goto(8);
dis_num(hb,3);
}
void delayms(unsigned int itime)
{
unsigned int i;
for(;itime>0;itime--)
{
__delay_ms(1);
}
}
void send_config(unsigned char data) //send lcd configuration
{
rs=0; //set lcd to configuration mode
lcd_data=data&0xf0; //lcd data port = data
pulse();
lcd_data=(data<<4)&0xf0;
pulse();
}
void pulse(void)
{
e=1; //pulse e to confirm the data
delayms(1);
e=0;
delayms(1);
}
void lcd_goto(unsigned char data) //set the location of the lcd cursor
{ //if the given value is (0-15) the
send_config(0x80+data); //cursor will be at the lower line
}
void lcd_clr(void) //clear the lcd
{
send_config(0x01);
delayms(2);
}
void send_string(const char *s) //send a string to display in the lcd
{
rs = 1;
while (*s)send_char (*s++);
}
void send_char(unsigned char data) //send lcd character
{
rs =1;
delayms(1); //set lcd to display mode
lcd_data=data&0xf0; //lcd data port = data
pulse();
lcd_data=(data<<4)&0xf0;
pulse();
}
void init_lcd(void)
{
rs=0;e=0; //command mode
delayms(10); //delay 10ms
lcd_data=0x30; //load initial nibble
pulse(); //Latch initial code
delayms(5); //delay 5ms
pulse(); //Latch initial code
delayms(1); //delay 1ms
pulse(); //Latch initial code
lcd_data=0x20;
pulse(); //Latch initial code
//configure lcd
send_config(0x28); //Set 4-bit mode, 2 lines
send_config(0xF); //Switch off display
send_config(0x06); //Enable cursor auto increase
}
void dis_num(unsigned int data,unsigned char digit)
{
if(digit>3)
send_char('0'+(data/1000)%10);
if(digit>2)
send_char('0'+(data/100)%10);
if(digit>1)
send_char('0'+(data/10)%10);
if(digit>0)
send_char('0'+(data/1)%10);
}




8 comments:
Dear Dr Rana,
Good Day!
I'm a student at University of Newcastle. I'm currently doing a university final year project "heartbeat monitoring system using PIC microcontroller). I have come across your website and found that it is very similar to what I am going to do.
I dunno how to start to do this project. Could you give me some guidance on this project?
I'm tried to draw your schematic onto NI multisim8 but i can't seem to find any LDR symbol in it. What software do you use to draw the schematic?
PS: I have limited knowledge on electronic as I am a mechanical student. I took up this project as a challenge.
Regards,
Sai Mun
@ Sai Mun :-
I use PROTEUS ISIS for designing and drawing the circuit diagram for my project using microcontroller and other electronic circuits.
The Proteus ISIS is also good simulation software and we can check the project and code at PC without soldering the actual components.
If you want to do microcontroller project as degree final year project, then you should know the basic electronics and DLD. The knowledge of some programming and at least one programming language is also required.
I have added you in my yahoo, for live discussion on project.
i have drawn the schematic using multisim. i have replace the LDR1 with a potentmeter to simulate the blood flow. How does the U1:A & B works and how come U1 doesn't require vcc & earth?
@ leongsaimun :-
I use proteus ISIS for simulation. In this software, there is facility that all microcontrollers and digital IC and other chips like OP-AMP are baised internally. In other words, these chips are connected to power supply lines by their own. HOWEVER YOU WANT TO SHOW THEM OR CONNTECT MANUALLY, YOU CAN USE OPTION OR CONFIGURATION OF SELECTED DEVICES UNDER PROPERTIES.
Dear Dr Rana,
Good Day!
Im student at UTP... i need to design pulse rate wirelessly... did u have an idea how to design it??? can u email me...
seol_g@yahoo.com
urgent
@ SEOL :-
Thanks, YOu will need wireless transmitter and recievers to be interfaced with microcontroller , then one microcontroller will be used main heart rate monitor.
Sir/mam i need your help to create an weather station ( tem, pressure, humidity , wind vane, wind speed using 16F877A w/ GSM module) can you help me about the schematic and program.
@ Renz Joseph Sebastian (weather station):-
To develop any application based on microcontroller, following steps are usually taken in sequence.
Step-1: Identify you inputs, outputs to the system, try to findout the datasheets of sensors being used as input and then design appropraiate circuit to match the signal requirements. Thus first of all you should try to find out the sensors of all parameters which are required to meaure. Then try to understand how those will be interfaced with microcontroller.
Step-2: Draw the circuit diagram of your project. keeping in view of inputs and outputs.
Step-3: Write the software for microcontroller.
Step-4:Test you project and do necessary changes.
So, how i can send you the circuit diagram and software of any project, where as i donot know the requirements of project, i donot know the inputs, and outputs. I have no information about the sensors you are using in your project. What will be the output each sensor, normally different transducers or sensor give output in different formate, a variety of options are available, like serial RS232 or RS485, current loop 4-20m, voltage output like 0-10v, resistance.
So, there will different components required to use depends on selectionof sensor and there output format.
I think, you and other student will understand the process of project development.
Post a Comment
Hi: This is PICINF.blogspot.com comments section. Here you are requested to write your question or problems in detail. Write the question in such a way that, it have all necessary information, sothat i can understand and reply.If you want to send pictures and codes then e-mail me (rghkk@hotmail.com).Thanks.