Archive for March, 2011

March 3rd, 2011

Detection of Anger through BPM Beats Per Minuets (Heart rate) with MicroController

Title of the Project:
MicroController PIC16f877 based Anger Detection and Display of Beats per Minuets:-
Detection of Anger through BPM Beats Per Minuetus(Heart rate) with MicroController PIC16F877The status of anger can produce bad effect towards heart rate, blood pressure, levels of adrenaline and noradrenalin and other physical effects. Or we can say that heart rate is normally high in the state of anger. This project is design to detect the anger of a person through detection of heart rate or beats per minutes or blood pressure of the patient. The microcontroller PIC 16f877 is used to monitor the blood pressure of the person. This Project is done at the request of a student,who was doing the project of anger detection by various method. This post is actually written to help the student to complete the thesis.
The project is divided into two parts.
1. Analog section:
The analog section is consisting of some operational amplifiers and analog components. The sensor or transducer to sense the heart rate is interfaced to this section. A pair of LED and LDR is used as transducer. The signal from the sensor is feed to operational amplifier stage where it is amplified and comparator produces the digital signal of the corresponding analog signal. these digital signal is then feed to microcontroller.
2. Digital part:
In the digital section of the microcontroller the TTL pulses are processed and resulted heart rate is displayed on the LCD screen.
BPM blood pressure monitor with microcontroller PIC16f877 Detection of Anger through BPM Beats Per Minuets (Heart rate) with MicroController
BPM blood pressure monitor with microcontroller PIC16f877The code is written in Hitech c language as is given below
#include // plz include pic . h file here this file is available in hitech
#ifndef _XTAL_FREQ
// Unless specified elsewhere, 4MHz system frequency is assumed
#define _XTAL_FREQ 4000000
#endif
#define rs RD7
#define e RD6
#define lcd_data PORTB
#define buzzer RC1
void beep (void);
void delayms(unsigned int itime);
void blink(void);
void send_config(unsigned char data);
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);
unsigned int read_an(unsigned char channel);
void prog1(void);
void display(unsigned char c);
unsigned long no=0;
void main (void)
{
TRISA5=0;
TRISC=0;
TRISB=0;
TRISD0=1;
TRISD1=0;
TRISD7=0;
TRISD6=0;
TRISD3=0;
init_lcd();
while(1)
{
prog1();
}

}
void prog1(void)
{
unsigned int temp1=0,temp2=0;
unsigned char i;
unsigned int hb=1;
while(RD0);
while(!RD0){
hb++;
__delay_ms(1);
}
hb=30000/hb;
lcd_goto(2);
send_string(“H.B.R: bpm”);
lcd_goto(8);
dis_num(hb,3);
if(hb>87&&RD3==1) //if value of Heart Beat >87 and sound > 85dB
{
beep();
lcd_goto(16);
send_string(” Stay Calm!! “);
RD3=0;
}
else if(hb>87)
{
lcd_goto(16);
send_string(” Stay Calm!! “);
}
else
{
buzzer=0;
lcd_goto(16);
send_string(” Normal :) “);
}

}
void delayms(unsigned int itime)
{
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 //cursor will be at the upper line
//if the given value is (20-35) the send_config
//cursor will be at the lower line
//location of the lcd cursor(2X16):
}
void lcd_clr(void) //clear the lcd
{ send_config(0×01); 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; __delay_us(40); //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=0×30; //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=0×20; pulse(); //Latch initial code //configure
lcd send_config(0×28); //Set 4-bit mode, 2 lines
send_config(0xF); //Switch off display
send_config(0×01); //Clear Display
send_config(0×06); //Enable cursor auto increase //
send_config(0×80); //Zero display address
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);
}

void beep(void)
{
buzzer=1;
delayms(300);
buzzer=0;
delayms(200);
buzzer=1;
delayms(300);
buzzer=0;
delayms(200);
buzzer=1;
delayms(300);
buzzer=0;
delayms(200);
buzzer=1;
delayms(300);
buzzer=0;
delayms(200);
buzzer=1;
delayms(300);
buzzer=0;
delayms(200);
}blood pressure, heart rate, heart rate physiology,heart rate drug effects,
blood pressure physiology,Blood Pressure Monitor,Bpm Monitor,Automatic beats-per-minuets, Microcontroller based heart rate meter, anger detection unit, transducer of beats, heart pulses detection system, LCD display of heart beats, high blood monitor, digital beats monitors