[MikroC Prog Help] Pulse Rate Detector

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
HK11
Posts: 4
Joined: 17 Mar 2015 18:33

[MikroC Prog Help] Pulse Rate Detector

#1 Post by HK11 » 17 May 2015 12:21

I have a project to submit on Tuesday.

It's about a Pulse Rate Detector, I place my finger between 2 sensors and an LED will light up each time a pulse is detected.

What I need help on: MikroC programming.

The output will be connected to a PIC16F877A microcontroller and then a Timer 0 (TMR0) will be used as a timer for measurement and Timer1 (TMR1) will be used as a counter. Each time the timer measures the pulses for 10 seconds (Through a defined integer) , the number will be multiplayed by 6, which will give the number of pulses in 1 minute.

(Then maybe here there will be an interrupt to stop counting the pulses and display the output on the LCD)

The output must be displayed on a 20x4 Alphanumeric LCD (LM044L) connected to Port B on the microcontroller (The output port).
No. Of Pulses : (int)


A code for this work will be appreciated a lot! Thank you.

jayanthd
Posts: 630
Joined: 08 May 2013 18:31
Location: Bangalore

Re: [MikroC Prog Help] Pulse Rate Detector

#2 Post by jayanthd » 18 May 2015 11:18

That is a very bad idea that is waiting for 10 second to get the pulse rate. You have to catch the first pulse then start a timer and then catch the second pulse and stop the timer. Calculate the time between two pulses and based on that calculate no. of pulses in 1 minute.

Here I have done a Heartrate monitor. It works fine. If you want some other way then specify and I will help you do the project.

http://www.edaboard.com/thread333492.html
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT

jayanthd
Posts: 630
Joined: 08 May 2013 18:31
Location: Bangalore

Re: [MikroC Prog Help] Pulse Rate Detector

#3 Post by jayanthd » 18 May 2015 20:03

Try the attached project. Proteus 8.2 SP2 format file is also included. 4 MHz external crystal is used for PIC16F877A.
Attachments
hrm.png
hrm.png (35.36 KiB) Viewed 5985 times
Heartrate Monitor PIC16F877A.rar
(94.16 KiB) Downloaded 393 times
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT

HK11
Posts: 4
Joined: 17 Mar 2015 18:33

Re: [MikroC Prog Help] Pulse Rate Detector

#4 Post by HK11 » 19 May 2015 20:26

Hello again, I apologize for the late reply.

I looked at the Easy Pulse you made, I do not want a ready product.

But then I looked at the proteus you sent me and the code and it worked fine, thanks a lot!

The thing is, I never really dealt with the external clock and the POT-HG? Is this a wireless connection? I'm missing something here, if I were to implement this in reality where should I place my finger? This is the first time I deal with sensors.

Also the code is quite hard for a newbie like me, but I guess I will have to learn it anyways, thanks a lot, and an explanation would be much appreciated.

One last thing, since I have an LED and PIC already, I would like to know which clock to buy from the market, and the POT-HG as well, what is that?

HK11
Posts: 4
Joined: 17 Mar 2015 18:33

Re: [MikroC Prog Help] Pulse Rate Detector

#5 Post by HK11 » 20 May 2015 07:43

I realized after looking around that it is not wireless but in fact just a little trick to not make a mess with wires.

I don't see anything sensor related on your code, nor do I see a counter.

jayanthd
Posts: 630
Joined: 08 May 2013 18:31
Location: Bangalore

Re: [MikroC Prog Help] Pulse Rate Detector

#6 Post by jayanthd » 20 May 2015 10:41

Hi

I used EasyPulse sensor from Elecrow. It gives pulse and analog output based on heartbeat. I have connect pulse output of sensor to INT0 pin of PIC. POT-HG is a pot for LCD contrast adjustment. In Proteus there is no sensor and hence I have used Clock model to feed 2 Hz pulse to INT0 pin. You have to make your own heartbeat sensor which gives clear pulse output and connect it to INT0 pin. Also GND of sensor has to be connected to PIC GND. This will read the time between two pulses and calculate BPM. You can use Elecrow sensor or make your own sensor based on photo detector and IR Led. Some circuits are available on the net.
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT

jephzty
Posts: 1
Joined: 04 Oct 2015 06:23

Re: [MikroC Prog Help] Pulse Rate Detector

#7 Post by jephzty » 10 Oct 2015 15:03

i use a heart rate sensor same schematic of the easy pulse sensor. my problem is the output is continously and never stop unless the power will reset. how can i change that or i just wait a time until my finger will remove?? if that is the answer how long my finger put in the sensor? thanks in advance :)

Post Reply

Return to “User Projects”