Heart rate measurement from fingertip



Introduction

Heart rate measurement indicates the soundness of the human cardiovascular system. This project demonstrates a technique to measure the heart rate by sensing the change in blood volume in a finger artery while the heart is pumping the blood. It consists of an infrared LED that transmits an IR signal through the fingertip of the subject, a part of which is reflected by the blood cells. The reflected signal is detected by a photo diode sensor. The changing blood volume with heartbeat results in a train of pulses at the output of the photo diode, the magnitude of which is too small to be detected directly by a microcontroller. Therefore, a two-stage high gain, active low pass filter is designed using two Operational Amplifiers (OpAmps) to filter and amplify the signal to appropriate voltage level so that the pulses can be counted by a microcontroller. The heart rate is displayed on a 3 digit seven segment display. The microcontroller used in this project is PIC16F628A.

Heart rate measuring device using PIC16F628A

Theory

Heart rate is the number of heartbeats per unit of time and is usually expressed in beats per minute (bpm). In adults, a normal heart beats about 60 to 100 times a minute during resting condition. The resting heart rate is directly related to the health and fitness of a person and hence is important to know. You can measure heart rate at any spot on the body where you can feel a pulse with your fingers. The most common places are wrist and neck. You can count the number of pulses within a certain interval (say 15 sec), and easily determine the heart rate in bpm.

This project describes a microcontroller based heart rate measuement system that uses optical sensors to measure the alteration in blood volume at fingertip with each heart beat. The sensor unit consists of an infrared light-emitting-diode (IR LED) and a photodiode, placed side by side as shown below. The IR diode transmits an infrared light into the fingertip (placed over the sensor unit), and the photodiode senses the portion of the light that is reflected back. The intensity of reflected light depends upon the blood volume inside the fingertip. So, each heart beat slightly alters the amount of reflected infrared light that can be detected by the photodiode. With a proper signal conditioning, this little change in the amplitude of the reflected light can be converted into a pulse. The pulses can be later counted by the microcontroller to determine the heart rate.

Fingertip placement over the sensor unit

Circuit Diagram

The signal conditioning circuit consists of two identical active low pass filters with a cut-off frequency of about 2.5 Hz. This means the maximum measurable heart rate is about 150 bpm. The operational amplifier IC used in this circuit is MCP602, a dual OpAmp chip from Microchip. It operates at a single power supply and provides rail-to-rail output swing. The filtering is necessary to block any higher frequency noises present in the signal. The gain of each filter stage is set to 101, giving the total amplification of about 10000. A 1 uF capacitor at the input of each stage is required to block the dc component in the signal. The equations for calculating gain and cut-off frequency of the active low pass filter are shown in the circuit diagram. The two stage amplifier/filter provides sufficient gain to boost the weak signal coming from the photo sensor unit and convert it into a pulse. An LED connected at the output blinks every time a heart beat is detected. The output from the signal conditioner goes to the T0CKI input of PIC16F628A.

IR sensors and signal conditioning circuit

The control and display part of the circuit is shown below. The display unit comprises of a 3-digit, common anode, seven segment module that is driven using multiplexing technique. The segments a-g are driven through PORTB pins RB0-RB6, respectively. The unit’s, ten’s and hundred’s digits are multiplexed with RA2, RA1, and RA0 port pins. A tact switch input is connected to RB7 pin. This is to start the heart rate measurement. Once the start button is pressed, the microcontroller activates the IR transmission in the sensor unit for 15 sec. During this interval, the number of pulses arriving at the T0CKI input is counted. The actual heart rate would be 4 times the count value, and the resolution of measurement would be 4. You can see the IR transmission is controlled through RA3 pin of PIC16F628A. The microcontroller runs at 4.0 MHz using an external crystal. A regulated +5V power supply is derived from an external 9 V battery using an LM7805 regulator IC.

Microcontroller and Display Circuit

Update (04/20/2013)

The sensor and signal conditioning unit used in this project is improved further and the new design is available for purchase as Easy Pulse (see picture on left). The Easy Pulse sensor is designed for hobby and educational applications to illustrate the principle of photoplethysmography (PPG) as a non-invasive optical technique for detecting cardio-vascular pulse wave from a fingertip. It uses an infrared light source to illuminate the finger on one side, and a photodetector placed on the other side measures the small variations in the transmitted light intensity. The variations in the photodetector signal are related to changes in blood volume inside the tissue. The signal is filtered and amplified to obtain a nice and clean PPG waveform, which is synchronous with the heart beat. Click here for more info.

Software

The firmware does all the control and computation operation. In order to save the power, the sensor module is not activated continuously. Instead, it is turned on for 15 sec only once the start button is pressed. The pulses arriving at T0CKI are counted through Timer0 module operated in counter mode without prescaler. The complete program written for MikroC compiler is provided below. An assembled HEX file is also available to download.

/*
  Project: Measuring heart rate through fingertip
  Copyright @ Rajendra Bhatt
  January 18, 2011
  PIC16F628A at 4.0 MHz external clock, MCLR enabled
*/

sbit IR_Tx at RA3_bit;
sbit DD0_Set at RA2_bit;
sbit DD1_Set at RA1_bit;
sbit DD2_Set at RA0_bit;
sbit start at RB7_bit;
unsigned short j, DD0, DD1, DD2, DD3;
unsigned short pulserate, pulsecount;
unsigned int i;
//-- ------------ Function to Return mask for common anode 7-seg. display
unsigned short mask(unsigned short num) {
 switch (num) {
 case 0 : return 0xC0;
 case 1 : return 0xF9;
 case 2 : return 0xA4;
 case 3 : return 0xB0;
 case 4 : return 0x99;
 case 5 : return 0x92;
 case 6 : return 0x82;
 case 7 : return 0xF8;
 case 8 : return 0x80;
 case 9 : return 0x90;
 } //case end
}

void delay_debounce(){
 Delay_ms(300);
}

void delay_refresh(){
 Delay_ms(5);
}

void countpulse(){
 IR_Tx = 1;
 delay_debounce();
 delay_debounce();
 TMR0=0;
 Delay_ms(15000);  // Delay 1 Sec
 IR_Tx = 0;
 pulsecount = TMR0;
 pulserate = pulsecount*4;
}

void display(){
  DD0 = pulserate%10;
  DD0 = mask(DD0);
  DD1 = (pulserate/10)%10;
  DD1 = mask(DD1);
  DD2 = pulserate/100;
  DD2 = mask(DD2);
  for (i = 0; i<=180*j; i++) {
    DD0_Set = 0;
    DD1_Set = 1;
    DD2_Set = 1;
    PORTB = DD0;
    delay_refresh();
    DD0_Set = 1;
    DD1_Set = 0;
    DD2_Set = 1;
    PORTB = DD1;
    delay_refresh();
    DD0_Set = 1;
    DD1_Set = 1;
    DD2_Set = 0;
    PORTB = DD2;
    delay_refresh();
    }
  DD2_Set = 1;
}

void main() {
 CMCON = 0x07;    // Disable Comparators
 TRISA = 0b00110000; // RA4/T0CKI input, RA5 is I/P only
 TRISB = 0b10000000; // RB7 input, rest output
 OPTION_REG = 0b00101000; // Prescaler (1:1), TOCS =1 for counter mode
 pulserate = 0;
 j = 1;
 display();
 do {
  if(!start){
   delay_debounce();
   countpulse();
   j= 3;
   display();
  }
 } while(1);  // Infinite loop
}

Download Source and HEX files

Output

The use of this device is very simple. Turn the power on, and you will see all zeros on display for few seconds. Wait till the display goes off. Now place your forefinger tip on the sensor assembly, and press the start button. Just relaxed and don’t move your finger. You will see the LED blinking with heart beats, and after 15 sec, the result will be displayed.

References

The following papers were used as reference in making this project.

Design and development of a heart rate measuring device using fingertip by Hashem, M.M.A.  Shams, R.  Kader, M.A.  Sayed, M.A., International conference on computer and communication engineering, 2010.

Heart rate measurement from the finger using a low cost microcontroller by Dogan Ibrahim and Kadri Buruncuk.

Important note:

I am adding these paragraphs to provide further detail on the sensor and signal conditioning part of this project.

The harder part in this project is the signal conditioning circuit that uses active low pass filters using OpAmps to boost the weak reflected light signal detected by the photo diode. The IR transmitting diode and the photo diode are placed closely but any direct crosstalk between the two are avoided. Look at the following pictures to see how I have blocked the direct infrared light from falling into the adjacent photo diode. Besides, surrounding the sensor with an opaque material makes the sensor system more robust to changing ambient light condition. I have used separate IR diode and photo diode, but you can buy reflective optical sensor systems that have both the diodes assembled together. Here’s an example from Tayda Electronics.

The 150 ? resistance in series with the IR diode is to limit the current and hence the intensity of the transmitted infrared light. The intensity of IR light should not be too high otherwise the reflected light will be sufficient enough to saturate the photo detecting diode all the time and no signal will exist. The value of this current limiting resistor could be different for different IR diodes, depending upon their specifications. Here’s my practical test circuit that I used to find the appropriate value of the series resistor for the IR diode I used.

First I used a 68 ? resistor with a 470 ? potentiometer in series with the IR diode. Placing a fingertip over the sensor assembly, I slowly varied the potentiometer till I found the output LED blinking with heartbeat. Then I measured the equivalent resistance R and replaced the 68 ? and the potentiometer with a single resistor closest to R. But you can also keep the potentiometer in your circuit so that you can always adjust it when needed. You should keep your fingertip very still over the sensor while testing. Once you see the pulses at the output of the signal conditioning circuit, you can feed them to a microcontroller to count and display.

See the revised version of this project,

Easy Pulse: A DIY photoplethysmographic sensor for measuring heart rate

Easy Pulse board

 

682 comments

  • hello sir
    you can send me the complete circuit of the project?
    mehmetemincakiroglu@gmail.com

    thanks

  • Can anyone plz tell me how do we connect the heart beat sensor to AT89C51 controller… Plz its really very urgent

  • hi,
    you can send me the complete circuit of the project?
    fede0022@icloud.com
    thanks

  • hi.i’m from korea. i really want your project. so please Please send me details of your project…….
    I’m willing to do a similar project in your project… please please…. ㅠㅠ

  • GOOD WORK! COULD you please give the specific numbers identifying the IR and the photo diode. we cant just pick any. help. urgent please. my email : juliusmuriithi90@yahoo.com

  • GOOD WORK! COULD you please give the specific numbers identifying the IR and the photo diode. we cant just pick any. help. urgent please.

  • Yaw Owusu Mensah

    Please Sir, i would like to know if we could use PIC16F877A for this project.

  • Can I use LM358 in stead of mcp602

  • please I need help , I was trying to apply this project but on PIC16F877A , the OP-AMP works very well but when I connect its output to RA4 (TMR0) of the pic it doesn’t work , this is part of the code :

    void main ()
    { TRISA = 0b00010000;
    TRISB = 0b11000000;
    PORTB = 0;
    OPTION_REG = 0b10110000; // prescaler(1:1) , TOCS = 1 (counter mode)
    INTCON = 0×20;
    CMCON = 0×07; // disable comparators

    while(1)
    {
    if(portb.f6==1)
    {
    TMR0 = 0;
    Lcd_Cmd(_LCD_CURSOR_OFF);
    delay_ms(500);
    Lcd_out(1,4,”Please Wait”);
    sensor = 1;
    delay_ms(30000); // wait for 30 seconds
    Lcd_Cmd(_LCD_CLEAR);
    sensor = 0;
    HR1_30sec = TMR0;
    HR1 = HR1_30sec*2;
    intToStr(HR1,show_HR1);
    delay_ms(500);
    Lcd_out(1,1,”Rest HR =”);
    Lcd_Out_Cp(show_HR1); }
    }
    it is supposed to write Rest HR = # on the LCD , but it shows Rest HR = 0
    can some one tell me how to solve this problem ?? please I need someone’s help as soon as possible

  • hello sir,
    please help me about the software intallation in PIC16F628A, i am unable to do this pls help me by step by step process. awaiting for your reply.please send me details as soon as possible.

    thanking you,

  • i have done the all only thing is the software i doesn’t know how to copy the program to PIC16F628A pls help me my mail id is viknesh440@gmail.com

  • muhammad usman iliyasu jen

    pls sir send the full materials for the project including complete circuit diagram.
    here is my mail jamilmammailmanjen@yahoo.com

  • I need this project document can someone send me this document please ?

  • I need this projects component list ,so please help me with that.

  • pls burn how to burn program in pic16f628a

    its urgent :)

  • Sir
    Can I use the LM358 in signal conditioning part and IC chip 89S51 as micro-controller part in the same circuit.
    if possible then what will be program and the hex code. please reply at moni.lipsa@gmail.com

  • display part is not working properly when transistors are connected

  • ohkay.. so i made the above design but i want to use it ATMEGA MCU not PIC controller. Im giving the output to the ADC of the controller and it not working right.

    Am i suppose to give the output of the conditioning circuit to the RX pin? Or to any other pin as a digital input?

    Would you please guide me with that?

    thank you :)

  • Sir..can I get the complete circuit that build using ISIS?
    because I used this for my final project..
    I’m begging u..I have face some problem when I built using ISIS..
    hope u can help me u can send it here : helmieyjb93@rocketmail.com

  • Sir,please help me.I want to do this project.so can you sent full details of the project. This is my email amerzab90@gmail.com

  • you can easily replace mcp602 by a HA17358 & PIC by a 8bit uc AT89C2051

  • sir,I build the Microcontroller and Display Circuit using Isis 7 professional.
    the problem is..the PIC16F628A in this software does not have 5 & 14. also does not have 3 digits CA-displays
    can u help me how to build the complete circuit using ISIS 7 professional.need A.S.A.P
    thx

  • can u send me a complete circuit using ISIS, if you please?
    this is my e-mail sasoy86@gmail.com

  • Hi….really love this project….my group and I are developing it for our final project….but the codes you’ve attatched was incomplete (our prof told us) … could u provide us with the complete codings, if you would send it here dyl_band93@yahoo.com….it would really help us… Thanks

  • sir, can you plese send me the list of component used in this project and ckt diagram

  • Sir,can u send me a complete circuit using ISIS?

  • can i get list all component uses in this project? thx

  • i am using mled. separately it is working.but when i connected in the circuit it s not working.please help me.

  • Hi

    You can take the BL600 Bluetooth Low Energy programmable module from Laird and replace the PIC with it.
    You then program it using BASIC language to to all the sensing and calculations.
    Then instead of displaying it, it sends the data wirelessly which can then be displayed/logged etc on an iPhone or any Bluetooth Smart Ready phone or tablet.

    The BL600 BLE module is not that expensive in 1-off quantities either and can be bought from many distributors.

  • Hello,Can I Get Name Of All Component Uses In This Project.
    Thx :)

  • sir can u post me the cir for this proj if u have any ppt or pdf pls my id (parthiban.j04@gmail.com)

  • nice idea, i like it … just wanted to ask u, is it possible to place the sensor at the foot or at the leg ? or it only work the best with the finger tip ?

    thanks alot,

  • i build this cct on proteius but sensor or optocoupler is not availble is proteius components list sooooooooo plzzzz tell me the better way or alternate the sensor plzzzzzzz

  • can we make it in hardware.if yes please send the ciruit diagram

  • Hello.
    Sir can i directly use SPO2 probe instead of IR sensor. Or can i send o/p signal to the GSM module instead of using 7-segment display?

  • The MCP6004/2 are not readily available where I live. Can i construct the signal conditioning circuits using an LM358 ?

  • sir, plz send me the circuit for amplification using instrumentation amplifier.. thanks

  • Can any one help me to make this type of project instead of using finger probe I want to use piezoelectric sensor does the input frequency remains the same? plz help my email is sa4shery@gmail.com thanks!

  • ami apnar project nie kaj korte chai (Heart rate measurement ) i have got a problem in 3 digit 7 segment display
    1. common anode 10 pins is not available in market , kon pin D0, D1,D2, abcdefg i dont indicate its.
    2. i have a 3 digit 10 pins common cathode 7 segment display , i also dont indicate D0,D1,D2 and abcdefg also (so ami ki 3 digit 10 pins common cathode er input invert kore babohar korle project milbe ) again ami pin gulo chinte parchina konta D0,D1,D2 and abcdefg

    i also dont have any data sheet of these ,
    please help me as soon.

    • I have a 7 segment display has 10 pins input.
      which pin is D0,D1,D2 and a,b,c,d,e,f,g of the ” 3 digit common cathode 7 segment display (HX04301BHB)” , 10 pins ?

  • please if any want to help on this mail msjarwo0@gmail.com
    I beg to send data to complete because the final project in my college.
    please

  • plz tel me wats the use of IR tx

  • sir i am greatly impressed by this project.i wanna utilize it.please send me the components as soon as possible.it’s urgent sir

  • Sir,please help me.I want to do this project.so can you sent full detais of the project..my mail:anandpp04@gmail.com

  • Hello. I’m willing to do a similar project in your project. Please send me details of your project.

  • hey can we do this project using an atmega128 development board?
    If some one can help me with the layout please.
    thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *