Heart rate monitor with SMS alert (Using 8051 and GSM module).

This project is about a heart rate monitor that senses the heart rate from the finger tip an sends it as a message to a cell pone number. This project is based on an 8051 microcontroller and a GSM module. Heart rate is sensed from the finger tip using a photo transistor / IR LED pair. This method is called photoplethysmography. Photoplethysmography is the volumetric assesment of  an organ / tissue using light. IR reflection photoplethysmography is the exact method used here. In this method IR waves are send to the tissue and reflected wave is picked using a photo transistor. When the heart beats the volume of blood will be more in the tissue. This time more light gets reflected on to the photo transistor. When the heart is not beating the volume of blood inside the tissue will be less and so less light gets reflected on to the photo transistor. The result will be a pulse waveform at the collector of the photo transistor. The rate of this pulse waveform will be equal to the heart rate. The waveform is amplified, filtered, squared and fed to the microcontroller for counting. Circuit diagram of this heart rate monitor is shown below.

GSM Module – Buyers Guide – are you looking to buy a GSM module? There are a handful of product variants for GSM module – like SIM900, SIM300, SIM800 etc. We have created this buyers guide to help you select the right GSM module for your project needs.

Circuit diagram.

heart rate monitor with SMS

The GSM module is interfacing with the microcontroller using serial communication. RX pin of the GSM module is connected to the TX pin of the microcontroller. A relay is connected to P2.0 through a driving transistor. This relay can be used to switch an alarm or any other device when the heart rate goes above 80 beats per minute. The heart rate is also displayed on a 16×2 LCD module. LCD module is interfaced through Port 0 and Port 2 of the microcontroller. S2 is a reset switch.

Program.

    RS EQU P2.7
    RW EQU P2.6
    E  EQU P2.5
    ORG 000H  
MOV DPTR,#LUT              
MOV P2,#00000000B          
MOV P0,#00000000B         
ACALL INIT
ACALL TEXT1 
ACALL LINE2
ACALL TEXT3         
MAIN: MOV R6,#228D
      SETB P3.5            
      MOV TMOD,#01100001B  
      MOV TL1,#00000000B  
      MOV TH1,#00000000B   
      SETB TR1   
        
BACK: MOV TH0,#00000000B   
      MOV TL0,#00000000B   
      SETB TR0             
HERE: JNB TF0,HERE         
      CLR TR0             
      CLR TF0             
      DJNZ R6,BACK
      CLR TR1              
      CLR TF0              
      CLR TF1             
      MOV A,TL1
      MOV B,#4D
      MUL AB
      MOV R7,A
      CJNE A,#80D,SKIP 
SKIP: JC SKIP1
      SETB P2.0
SKIP1:JNC CONT
      CLR P2.0
 CONT:CLR PSW.7
      ACALL SPLIT 
      ACALL INIT
      ACALL TEXT1
      ACALL LINE2
      ACALL TEXT2
      ACALL BPM 
      ACALL GSM 
     
SJMP MAIN  

GSM:     
MOV TMOD,#00100001B
MOV TH1,#253D
MOV SCON,#50H
SETB TR1
MOV A,#"A"
ACALL SEND
MOV A,#"T"
ACALL SEND
MOV A,#0DH
ACALL SEND
ACALL DELAY1


MOV A,#"A"
ACALL SEND
MOV A,#"T"
ACALL SEND
MOV A,#"+"
ACALL SEND
MOV A,#"C"
ACALL SEND
MOV A,#"M"
ACALL SEND
MOV A,#"G"
ACALL SEND
MOV A,#"F"
ACALL SEND
MOV A,#"="
ACALL SEND
MOV A,#"1"
ACALL SEND
MOV A,#0DH
ACALL SEND
ACALL DELAY1


MOV A,#"A"
ACALL SEND
MOV A,#"T"
ACALL SEND
MOV A,#"+"
ACALL SEND
MOV A,#"C"
ACALL SEND
MOV A,#"M"
ACALL SEND
MOV A,#"G"
ACALL SEND
MOV A,#"S"
ACALL SEND
MOV A,#"="
ACALL SEND
MOV A,#34D
ACALL SEND
MOV A,#"+"
ACALL SEND
MOV A,#"9"
ACALL SEND
MOV A,#"1"
ACALL SEND
MOV A,#"9"
ACALL SEND
MOV A,#"8"
ACALL SEND
MOV A,#"4"
ACALL SEND
MOV A,#"7"
ACALL SEND
MOV A,#"2"
ACALL SEND
MOV A,#"4"
ACALL SEND
MOV A,#"2"
ACALL SEND
MOV A,#"9"
ACALL SEND
MOV A,#"6"
ACALL SEND
MOV A,#"1"
ACALL SEND
MOV A,#34D
ACALL SEND
MOV A,#0DH
ACALL SEND
ACALL DELAY1


MOV A,#"B"
ACALL SEND
MOV A,#"P"
ACALL SEND
MOV A,#"M"
ACALL SEND
MOV A,#"="
ACALL SEND
MOV A,R1
ACALL ASCII
ACALL SEND
MOV A,R2
ACALL ASCII
ACALL SEND
MOV A,R3
ACALL ASCII
ACALL SEND
ACALL DELAY1

MOV A,#1AH
ACALL SEND
ACALL DELAY1
RET

SEND:CLR TI
     MOV SBUF,A
WAIT:JNB TI,WAIT
     RET

DELAY1:MOV R6,#15D       
BACK1: MOV TH0,#00000000B   
       MOV TL0,#00000000B   
       SETB TR0             
HERE1: JNB TF0,HERE1        
      CLR TR0              
      CLR TF0             
      DJNZ R6,BACK1
      RET

   
INIT: 
    MOV A,#0FH 
    ACALL CMD
    MOV A,#01H 
    ACALL CMD
    MOV A,#06H 
    ACALL CMD
    MOV A,#83H 
    ACALL CMD
    MOV A,#3CH 
    ACALL CMD
    RET

TEXT1:
    MOV A,#"H"
    ACALL DISPLAY
    MOV A,#"e"
    ACALL DISPLAY
    MOV A,#"a"
    ACALL DISPLAY
    MOV A,#"r"
    ACALL DISPLAY
    MOV A,#"t"
    ACALL DISPLAY
    MOV A,#" "
    ACALL DISPLAY
    MOV A,#"R"
    ACALL DISPLAY
    MOV A,#"a"
    ACALL DISPLAY
    MOV A,#"t"
    ACALL DISPLAY
    MOV A,#"e"
    ACALL DISPLAY
    RET

LINE2:
    MOV A,#0C0H 
    ACALL CMD
    RET
    
 TEXT2:   
    MOV A,#"b"
    ACALL DISPLAY
    MOV A,#"p"
    ACALL DISPLAY
    MOV A,#"m"
    ACALL DISPLAY
    MOV A,#" "
    ACALL DISPLAY
    RET
    
 TEXT3:
    MOV A,#"c"
    ACALL DISPLAY
    MOV A,#"o"
    ACALL DISPLAY
    MOV A,#"u"
    ACALL DISPLAY
    MOV A,#"n"
    ACALL DISPLAY
    MOV A,#"t"
    ACALL DISPLAY
    MOV A,#"i"
    ACALL DISPLAY
    MOV A,#"n"
    ACALL DISPLAY
    MOV A,#"g"
    ACALL DISPLAY
    MOV A,#"."
    ACALL DISPLAY
    MOV A,#"."
    ACALL DISPLAY
    MOV A,#"."
    ACALL DISPLAY
    RET
 
 BPM:   
    MOV A,R1
    ACALL ASCII
    ACALL DISPLAY
    MOV A,R2
    ACALL ASCII
    ACALL DISPLAY
    MOV A,R3
    ACALL ASCII
    ACALL DISPLAY
    RET
    
  
   
 CMD: MOV P0,A
    CLR RS
    CLR RW
    SETB E
    CLR E
    ACALL DELAY
    RET

 DISPLAY:MOV P0,A
    SETB RS
    CLR RW
    SETB E
    CLR E
    ACALL DELAY
    RET

 DELAY: CLR E
    CLR RS
    SETB RW
    MOV P0,#0FFh
    SETB E
    MOV A,P0
    JB ACC.7,DELAY
    CLR E
    CLR RW
    RET
    
   

SPLIT: MOV B,#10D
       DIV AB
       MOV R3,B
       MOV B,#10D
       DIV AB
       MOV R2,B
       MOV R1,A
       RET
      
ASCII: MOVC A,@A+DPTR
       RET

    
LUT: DB  48D
     DB  49D
     DB  50D
     DB  51D
     DB  52D
     DB  53D
     DB  54D
     DB  55D
     DB  56D
     DB  57D
   
    END

Read the projects Heart rate monitor using 8051 and Interfacing GSM module to 8051 before attempting these projects. Some GSM module are available with other supply voltages such as 5V, 12V etc. So power them according to the rated supply voltage. Please don’t forget to couple the ground lines of all modules together.

Author

1 Comment

  1. Dr Mark Glickman

    You forgot to put a feedback resistor from output to negative terminal on LM324 operational amplifier – U4c. The operational amplifier output will saturate due to offset current.

    Thanks,
    Dr Mark Glickman