Heart Rate Monitor

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

BANGLADESH UNIVERSITY OF ENGINEERING AND TECHNOLOGY

HEART RATE MONITOR


INSTRUMENTATION AND MEASUREMENT SESSIONAL COURSE NUMBER: ME 362 GROUP NUMBER: A27 DATE OF SUBMISSION : 18-06-2013 DEPARTMENT OF MECHANICAL ENGINEERING

ACCOMPLISHED BYMd. Noor- E- Shahan Raz (0910037) Abdul Munim (0910046) Md. Zobayer Hossain (0910053) Md. Moyarraf Hossain Miraj (0910060)
1

Copyright 2013 by Md. Noor- E- Shahan Raz , Abdul Munim , Md. Zobayer Hossain, Md. Moyarraf Hossain Miraj and Bangladesh University of Engineering And Technology. All Rights reserved. The content of this paper is a property of authors and Bangladesh University of Engineering and Technology. Any part of this document (electronic , printed or photocopy) cannot be rebuilt or reproduced without the permission of authors or Bangladesh University of Engineering and Technology.

Dedicated toOur beloved parents

ACKNOWLEDGEMENT:

Our heartiest gratitude goes to our course teachers who helped us in every aspect Dr. M A RASHID SARKAR, PROFESSOR , DEPT. OF MECHANICAL ENGINEERING MR. KAZI ARAFAT RAHMAN,

LECTURER, DEPT. OF MECHANICAL ENGINEERING MR. ADNAN MORSHED, LECTURER, DEPT. OF MECHANICAL ENGINEERING MR. AMINUL ISLAM KHAN, LECTURER, DEPT. OF MECHANICAL ENGINEERING MR. CYRUS ARUP RATAN ATIS LECTURER, DEPT. OF MECHANICAL ENGINEERING

ABSTRACT:
The purpose of the project is to design a simple low cost microcontroller based device for measuring heart rate with LCD output. The main challenges include amplifying the desired weak signal in presence of noise from other muscles, various optical and electric sources. The designed device has the advantage of portability over other tape based recording systems. Heart rate of the subject is measured from the finger using a IR based sensor and the rate is displayed on a text based LCD

TABLE OF CONTENTS
Page No.
1. Introduction10 2. Methodology..,12 2.1 Principle.12 2.1.1 The Measurement Device..12 2.2 Block Diagram...13 2.3 Circuit Design14 2.3.1 Noise filtering, amplification & signal Processing15 2.4 Electrical construction16 3. Data Analysis....23 3.1 Calibration...23 3.2 Data Table And Comparison...23 3.3 Discussion24 4. Conclusion.25 5. Reference...26 6. Appendix27 6.1 Appendix A: Cost Analysis..27 6.2 Appendix B: Program Codes28

List of Figures

name

caption Finger placed on IR sensor


Block diagram of the measuring device A PPG (photoplethysmography) waveform Circuit Diagram

page 12 13 14 15 16 16 17 18 18 19 20 20 20 21 21

Fig 2.1.1 Fig 2.2


Figure 2.3

Figure 2.4 Figure 2.3.1 Figure 2.3.2 Figure 2.3.3 Figure 2.3.4 Figure 2.3.5 Figure 2.3.6 Figure 2.3.7 Figure 2.3.8 Figure 2.3.9 Figure 2.3.10 Figure 2.3.11

A Typical Breadboard IR Sensor (Receiver and Transmitter) A typical 1K resistor


(a) ATMega 32a (b) Pin configuration

An LCD display. 7805 IC and its pins SPST (2 pin) push switch A 9V Battery A 5K POT (a) LM324 IC (b) LM324 pin configuration LEDs

Figure 2.3.12 Figure 2.3.13

Capacitors Male male connectors

22 22

List of Tables
Table 1: Data Table and comparison with actual data Table 2: Cost Analysis page 22 page 26

1.INTRODUCTION

Heart rate measurement is one of the very important parameters of the human cardiovascular system. The heart rate of a healthy adult at rest is around 72 beats per minute (bpm). Athletes normally have lower heart rates than less active people. Babies have a much higher heart rate at around 120 bpm, while older children have heart rates at around 90 bpm. The heart rate rises gradually during exercises and returns slowly to the rest value after exercise. Heart rate is simply and traditionally measured by placing the thumb over the subjects arterial pulsation, and feeling, timing and counting the pulses usually in a 30 second period. Heart rate (bpm) of the subject is then found by multiplying the obtained number by 2. This method although simple, is not accurate and can give errors when the rate is high. More sophisticated methods to measure the heart rate utilize electronic techniques. Electro-cardiogram (ECG) is one of frequently used and accurate methods for measuring the heart rate. ECG is an expensive device and its use for the measurement of the heart rate only is not economical. Low-cost devices in the form of wrist watches are also available for the instantaneous measurement of the heart rate. Such devices can give accurate measurements but their cost is usually very high, making them uneconomical. In this project we described the design of a very low-cost device which measures the heart rate of the subject by placing fingers on the sensor and then displaying the result on a text based LCD. Advantage of such a design is that it can be expanded and can easily be connected to a recording device or a PC to collect and analyze the data for over a period of time. The building cost of the proposed device is around 2000 Tk. In the following chapters we will describe Methodology Principle Block Diagram Circuit Design Electrical/Electronic Construction
10

Data Analysis Conclusion References Appendices Calibration Data Table and Comparison with Actual Data Discussion (Findings and Limitations)

11

2.METHODOLOGY
2.1 Principle : This project is based on the principle of photoplethysmography (PPG)
which is a non-invasive method of measuring the variation in blood volume in tissues using a light source and a detector. Since the change in blood volume is synchronous to the heart beat, this technique can be used to calculate the heart rate. 2.1.1 The Measurement Device: The device consists of an infrared transmitter LED and an infrared sensor photo-transistor. A finger is placed on the transmitter-sensor pair (fig 2.1.1). The LED emits infrared light to the finger of the subject. The photo-transistor detects this light beam and measures the change of blood volume through the finger artery. This signal, which is in the form of pulses is then amplified and filtered suitably and is fed to a low-cost microcontroller for analysis and display. The microcontroller counts the number of pulses over a unit time interval or frequency and thus obtains the heart rate of the subject by multiplying the frequency by 60 .The calculated heart rate is displayed on an LCD in beats-per-minute in the following format: Rate = nnn bpm Where nnn is an integer between 1 and 999.

Fig 2.1.1: Finger placed on IR sensor ( Transmitter & Receiver)

12

2.2 Block Diagram:

Fig 2.2 : Block diagram of the measuring device

13

2.3 Circuit Design: Signal found from IR sensor consists of a large DC component, which is
attributed to the total blood volume of the examined tissue, and a pulsatile (AC) component, which is synchronous to the pumping action of the heart. The AC component, which carries vital information including the heart rate, is much smaller in magnitude than the DC component. A typical PPG waveform is shown in the figure below (not to scale).

Figure 2.3: A PPG (photoplethysmography) waveform

14

Figure 2.4: Circuit Diagram


2.3.1 Noise Filtering, Amplification & Signal Processing: To remove unwanted noise associated

with signal we use an operational amplifier LM324 which acts as a band pass filter and separate the ac component from the dc component. After this stage, the signal is very weak. So we need to amplify the signal. Another LM324 is used here to amplify the signal. We used 10K pot to adjust the gain factor of the two operational amplifiers. Amplified signal is fed into ATmega32a microcontroller. Digital output from the microcontroller is displayed on a 16 X2 text based LCD in bpm(beats per minute).

15

2.4 Electrical Construction: Different components used in this project are Breadboard: Breadboard is a construction base for making and prototyping electronic
circuit. It is a solder less circuit board. Since it is solder less it can be reused. It is the most advantageous side of a breadboard. The construction of a breadboard is quite simple. The strips of a breadboard are divided into terminal strips and bus strips. The terminal strip is the main area where circuit components sit. In this region the strips longitudinally situated are internally shorted. There is notch running between two parts of the terminal strip. The notch is there to help install an IC which can have parallel pins. The bus strips are situated along the boundary of the breadboard. Bus strips do have two types of terminals running parallel to each other. Either of these terminals can be used as the positive and ground. There is a bus strip in each of the four quadrants. These strips are not internally connected. Several breadboards can be joined together by hinge mechanism provided.

Figure 2.3.1 : A Typical Breadboard.

Infrared Transmitter and Receiver: This pair is the main sensor part in our circuit
design. Infrared transmitters are nothing but diodes.

Figure 2.3.2: IR Sensor (Receiver and Transmitter)

16

Resistors: Resistors are the most commonly used circuit component probably. These
are widely used to generate and divide voltages, to control currents etc. In our project we used resistors of two different values: one of 1kiloohm and another is of 470 ohm. These resistors do not come by with their names imprinted on them. Rather there is a color code reading which one can interpret the rating of a resistor.

Figure 2.3.3: A typical 1K resistor. Microcontroller: A microcontroller is functionally a computer on a single IC containing a processor core, a memory and programmable input/ output peripherals. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. Different types of microcontroller are used for different purposes. In our project weve used AVR ATmega32a type microcontroller. This microcontroller has 40 pins, 32 kilobyte of programmable flash memory, 1024 Bytes of EEPROM, 2K Byte Internal SRAM, two 8 bit timer or counter with separate prescaler and compare modes , One 16-bit Timer or counter with separate prescaler, compare mode, and capture mode and 10 bit ADC.
17

(a)

(b)

Figure 2.3.4: (a) ATMega 32a

(b) Pin configuration

LCD Display: In our project we used a 16 X 2 LCD (Liquid crystal display) to


display the result. LCD displays can be of several types and can be programmed using many libraries. We used a blue screen LCD display where the output comes in white characters. The LCD can show 16 characters in 2 rows. The module size is 80mm X 36 mm X 13.5mm. It works on +5v supply.

Figure 2.3.5: An LCD display.


18

Voltage Regulator (7805): In our project we used a 7805 IC as the linear voltage regulator. The power was supplied by a 9 volt battery which was then connected to the voltage regulator which gave almost constant 5 volt output. An image of the 7805 is shown here. It has three pins. The two terminal pins are output and input pins while the pin in the middle is the ground pin. The input of the IC must be a DC voltage ranging from 5V to 18V. For the input mentioned the regulated output may be of 4.8V to 5.2V. The current rating of this IC is up to 1.5 amp. The operating temperature of such circuit is from 0o to 1250 C. One problem associated with such IC is the temperature generated in the working condition. This high temperature often hampers its functionality. The high temperature is the result of voltage reduction in the form of power and this electrical power converts to heat energy during operation.

Figure 2.3.6: 7805 IC and its pins. Switch: In our project we have provided a switch to facilitate the reset operation. Every measuring project should have some way of circling back to the starting point at any moment. This was done by adding reset switch to our circuit. It is a very simple mechanism. A SPST 2 pin push switch was attached to the reset pin of the LCD display. The hardware reset has been set by this switch. The software reset also depends on the LCD characteristic. One major characteristic of an LCD is that it can hold the last output it shows. After a certain amount of stagnation the output screen will be cleared and the system will be at the initial situation. The switch has 12V 50mA current rating.

19

Figure 2.3.7: SPST (2 pin) push switch

Battery: In our project a 9 Volt DC battery has been used.

Figure 2.3.8: A 9V Battery

Potentiometer: 5k Potentiometer was used to adjust the gain factor of the Op Amp (LM324)

Figure 2.3.9: A 5K POT


20

Operational Amplifier (LM324): LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Opamps are high gain electronic voltage amplifier with differential input and, usually, a single-ended output. The output voltage is many times higher than the voltage difference between input terminals of an op-amp.These op-amps are operated by a single power supply LM324 and need for a dual supply is eliminated. They can be used as amplifiers, comparators, oscillators, rectifiers etc. We used LM324 as a filter in our project.

(a)

(b)

Figure 2.3.10: (a) LM324 IC (b) LM324 pin configuration LED: A semiconductor diode that emits light when a voltage is applied to it and used especially in electronic devices and circuits as an indicator.

21

Figure 2.3.11: LEDs Capacitors: We used 100nF and 1F capacitors in this project.

Figure 2.3.12: Capacitors Others: We used male to male and jumper wires, male rail, breadboard wires etc.

Figure 2.3.13: Male Male connectors

22

3.DATA ANALYSIS:
This section provides detail analysis of the data accumulated during the testing and operation of the heart rate monitor. The heart rate monitor was calibrated using an Android app that uses similar technique for measuring heart rate.

3.1 Calibration: At some point during the preparation of a measuring system, known
magnitudes of the input quantity must be fed into the sensor transducer system and the systems output behavior must be observed. Such comparison allows the magnitude of the output to be correctly interpreted in terms of the magnitude of the input. This process of comparison is known as the Calibration process. We first measured the heart rate by an Android app Runtastic heart rate which is a one of the most widely used heart rate measurement app. Then we measured the heart rate with heart rate monitor. Then we compared the heart rate obtained by heart rate monitor with the heart rate measured by the app. The app uses flashlight as the transmitter and camera lens as the receiver.

3.2 Data table and comparison with actual data:


Person 1 2 3 4 5 Actual Heart Rate 69 70 71 67 72 HRM reading 72 71 74 69 75 Error 4.34% 1.43% 4.22% 2.98% 4.16%

23

3.3 Discussion: From the date table we see that the result obtained from HRM is slightly
deviated from the actual result . The percentage of error is very low. So heart rate obtained from the device is acceptable. To obtain a more accurate comparison, we measured the heart rates of different persons. It is seen that, HRM recorded values are very close to the actual value obtained for each person. During the course of the project we also found out some limitations of the HRM. These are In presence of sunlight, IR reciever sensor behaves abnormally, that is, IR based HRM is sensitive to sunlight. In this project we implemented our circuit in breadboard and circuit connections were achieved by wire. In any circuit output which is sensitive to noise, the length of wires will contribute to noise receiving signals like an antenna. For additional safety to the user, an isolation amplifier or circuit protection can be implemented between the input terminals of the amplification stage and the probes instead of the current limiters in the circuit. The introduction of isolation amplifier causes a step up in the cost. As the whole circuit is implemented on the bread board , rough handling might loosen up the connections and cause error. Some suggestions can be made to improve the performance of HRM. These are A cap or an insulation can be used at the receiving end to filter sunlight and other optical noises. Implementing the circuit on PCB ( printed circuit boards) can give better performance than breadboard. Sound can be added to the device so that a sound is output each time a pulse is received. Commercial implementation should be much more compact and user friendly.

24

4.CONCLUSION:
In this project our aim was to build a low cost heart rate monitor by avr microcontroller. So the primary objective was to make it as cheap as possible. This implementation of a heart rate monitor involves low cost amplifier and filter components coupled with a sophisticated microcontroller and LCD screen. Another goal was to make it portable and easy to use. Because the device is most useful if it is portable it was designed with use of one or two 9V batteries. Tests have shown excellent agreement with actual heartbeat rates. The importance of a portable and low cost HRM is tremendous to a health conscious person. This device can be used in clinical and nonclinical environments. It can also be easily used by an individual user. Its working procedure is tried to make as simple as possible so that it can be used by a nonprofessional person at home to measure the heart rate easily and safely. As it is portable, athletes can also carry it with them and measure heart rates during training . Another advantage of such a design is that it can be expanded and can easily be connected to a recording device or a PC to collect and analyze the data for over a period of time. This device can also be improved in the following areas The maximum and minimum heart rates over a period of time can be displayed. Serial outputs can be attached to the device so that the heart rates can be sent to a pc for further online or offline analysis. Warning or abnormalities (such as very high or very low heart rates) can be indicated by an LED or a buzzer.

25

5.REFERENCES:

1)Dogan Ibrahim, Kadri Buruncuk,Heart Rate Measurement from the Finger using a low cost Microcontroller http://www.emo.org.tr/ekler/a568a2a a8c19a31_ek.pdf 2) Microcontroller Based Heart Rate Monitor using Fingertip Sensors pdf by Sharief F. Babiker, Liena Elrayah Abdel-Khair, Samah M. Elbasheer 3) Analogue electronics- Heart Rate Monitor pdf by Ken Li CHONG, David HOLDEN, Tim OLIN. 4) Opamp Instrumentation Amplifier eCircuit Centre 2002 http://www.ecircuitcenter.com/Circuits/instamp1/instamp1.htm 5) http://www.alldatasheet.com/datasheet-pdf/pdf/77378/ATMEL/ATMEGA32.html 6) http://www.alldatasheet.com/view.jsp 7) http://www.engineersgarage.com/embedded/avr-microcontroller-projects/interface-lcd-circuit

26

6. APPENDICES:
6.1 Appendix A: Cost analysis
Name of components Breadboard ATmega32a LM324 LM7805 Connecting wires LCD display 10k POT, IR sensors SPST switch 1 9V battery Others total 2 10 130 200 1580 tk Pcs 2 1 1 1 20 1 1 price 500 350 20 20 100 220 30

27

Appendix B: Program codes#include <avr/io.h> #include <util/delay.h> #include "lcd.h" #include <avr/interrupt.h> unsigned long int freq=0; int main(void) { InitLCD(LS_BLINK); LCDClear(); LCDWriteStringXY(1,0,"Heart Rate"); _delay_ms(1000); LCDClear(); LCDWriteStringXY(1,0,"bpm="); int n=0; TCCR1B|=(1<<CS10)|(1<<CS12);//|(1<<ICES1);//|(1<<CS11); TCNT1=0; TIMSK|=(1<<TICIE1); sei(); while(1) { LCDWriteIntXY(5,0,freq/100,3); _delay_ms(1); }
28

// prescalar 64

/* if(PIND==1) { PORTC=0; LCDWriteStringXY(n,1,"-"); n++; _delay_ms(50); } else { PORTC=0xFF; LCDWriteStringXY(n,1,"_"); n++; _delay_ms(50); } if(n>15) { n=0; } */ return 0; } ISR(TIMER1_CAPT_vect) {

29

freq=(int)((unsigned long) 97600/(unsigned long) TCNT1); // 8000000/64=125000 TCNT1=0 }


#include <avr/io.h> #ifndef F_CPU #define F_CPU 1000000UL #endif #include <util/delay.h> #include "myutils.h" #ifndef _LCD_H #define _LCD_H /*____________________________________________________________________ _____________________*/ /************************************************ LCD CONNECTIONS *************************************************/ #define LCD_DATA A #define LCD_E B #define LCD_E_POS #define LCD_RS B #define LCD_RS_POS #define LCD_RW B #define LCD_RW_POS //Port PC0-PC3 are connected to D4-D7 //Enable OR strobe signal PB2 //Position of enable in above port PB0 PB1

//************************************************ #define LS_BLINK 0B00000001 #define LS_ULINE 0B00000010

/*************************************************** F U N C T I O N S ****************************************************/

30

void void void void

InitLCD(uint8_t style); LCDWriteString(const char *msg); LCDWriteInt(int val,unsigned int field_length); LCDGotoXY(uint8_t x,uint8_t y);

//Low level void LCDByte(uint8_t,uint8_t); #define LCDCmd(c) (LCDByte(c,0)) #define LCDData(d) (LCDByte(d,1)) void LCDBusyLoop();

/*************************************************** F U N C T I O N S E N D ****************************************************/ /*************************************************** M A C R O S ***************************************************/ #define LCDClear() LCDCmd(0b00000001) #define LCDHome() LCDCmd(0b00000010); #define LCDWriteStringXY(x,y,msg) {\ LCDGotoXY(x,y);\ LCDWriteString(msg);\ } #define LCDWriteIntXY(x,y,val,fl) {\ LCDGotoXY(x,y);\ LCDWriteInt(val,fl);\ } /***************************************************/

/*____________________________________________________________________ _____________________*/

#endif

31

You might also like