Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Query about Heart beat sensor NSK

Status
Not open for further replies.

Krupa J Thomas

Newbie level 2
Newbie level 2
Joined
Feb 1, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
26
Hi, Has anyone got any idea about the heart beat sensor module from NSK working. There is no datasheet available on this. I've seen posts here telling that Heart beat sensor from NSK dont give proper output .

Also I will attach my code I tried to debug this but I'm getting pulse count unstable and 40000 and 50000 range values for 10sec viz correct.

My CODE is attached


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <reg51.h>
#include <stdio.h>
void UART_Init();
void UART_sendchar(unsigned char );
void UART_Tx(unsigned char* );
void  delay_ms(int );
 
 
sbit HBout=P3^5;  //sensor output
unsigned int beats=0;
int i;
unsigned char BPM[10];
 
void main()
{
    P3|=0x20; //0010 0000
    TMOD =0x01; //16 bit timer
    UART_Init();
    while(1)
    {   TH0=0x3C ;//65536-50000=15536=3CB0H  generates a delay for 50ms
        TL0=0xB0;    
        beats=0;
        TR0=1;
        for(i=0; i<200;i++)     //delay of 10sec         20x60
        {   
            TH0=0x3C ;//generates a delay for 50ms
            TL0=0xB0;
            do{ 
                while(HBout==0);
                beats++;        
                }while(!TF0);
            TF0=0;  
        }
        TR0=0;  
        TF0=0;
        TI=1;
        printf("beats after while: %u", beats);
         beats = beats*6;
        UART_Tx("Pulse rate per min:\n");
             if(beats/100 == 0)
             {
                BPM[0] =(beats/10) + 0x30;
                BPM[1] =(beats%10) + 0x30;
                BPM[2] ='\0';
              TI=1;
            printf("\n*********1**********\n");
             }
             else if (beats/1000 ==0)
            {   BPM[0] =(beats/100) + 0x30;
                BPM[1] =(beats%100)/10 + 0x30;
                BPM[2] =(beats%100)%10 + 0x30;
                BPM[3]='\0';
                TI=1;
        printf("\n*********2**********\n");
            }
            else if(beats/1000)
            {
                BPM[0] =(beats/1000) + 0x30;
                BPM[1] =((beats%1000)/100) + 0x30;
                BPM[2] =((beats%1000)%100)/10 + 0x30;
                BPM[3]=((beats%1000)%100)%10 + 0x30;
                TI=1;
        printf("\n*********3**********\n");
            }
 
         else
        {       TI=1;
                printf("Dead beats\n");
         }
        
    TI=1;
                printf("beats :%d\nBPM: %s\n", beats, BPM);
                beats=0;
 
    }
 
 
}
void UART_Init()
{
    TMOD|=0x20;
    SCON=0x50;
    TH1=0xFD;
    TR1=1;
}
 
void UART_sendchar(unsigned char c)
{
    SBUF = c;
    while (!TI);
    TI=0;
}
 
void UART_Tx(unsigned char* str)
{
    while(*str)
        UART_sendchar(*str++);  
}
/*void  delay_ms(int ms)
{
    int i,j;
    for(i=0;i<ms;i++)
        for(j=0;j<1275;j++);
}  */


Connexons :sensor vcc-->5v, gnd--->gnd, O/p --P3.5 of AT89S52

- - - Updated - - -

I meant viz absolutely wrong. that was a typo sorry!!
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top