All About Circuits Forum  

Go Back   All About Circuits Forum > Electronics Forums > The Projects Forum

Notices

The Projects Forum Working on an electronics project and would like some suggestions, help or critiques? If you would like to comment or assist others with their projects, this is the place to do it.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 03-26-2011, 03:47 PM
sakurarandom sakurarandom is offline
New Member
 
Join Date: Mar 2011
Posts: 8
Default How to calculate heart pulse?

My group is given a project namely Heat Beat Monitoring System. We need to come out finger clip sensor that connect to PIC and then connect to PC using USB. Currently, my group has set up the finger clip sensor in breadboard, PIC is loaded with bootloader and Window Forms have been designed using Visual Studio 2008 in C++ language. Now I am facing problem how to calculate the heart rate in PIC using MPLAB in C language. May I know how do determine the output from sensor to PIC is in what form? And in MPLAB, how do i write the coding to calculate the heart beat?

Hereby attach my circuit. There is some error on the PIC connection so kindly ignore it. Thank you so much.
circuit.jpg
Reply With Quote
  #2  
Old 03-26-2011, 04:26 PM
Audioguru Audioguru is offline
Banned
 
Join Date: Dec 2007
Location: Ontario, Canada
Posts: 9,411
Default

Look in Google for the HEMON circuit. HEMON is short for Heart Monitor.
The code for the microcontroller is shown.
Reply With Quote
  #3  
Old 03-26-2011, 07:59 PM
russpatterson's Avatar
russpatterson russpatterson is offline
Senior Member
 
Join Date: Feb 2010
Location: Carlsbad, California
Posts: 351
Default

I've made a bunch or photoplethysmographic heart rate monitors. I've usually used a phototransistor but if your LDR works then that's great.

Can you see your heart rate on your PIC's pin 2 if you hook a scope to it? Do you have a blinking LED that goes off when your heart beats?

If your asking for the calculation for beats per minute it's something like:

Count the milliseconds between heart beat pulses on your pic. Then use a formula like: BPM = 60/(milliseconds/1000)

So if there's 1000 mS between beats your heart rate is 60 BPM, one beat per second. If there's 500 mS between beats your BPM is 120.

Last edited by russpatterson; 03-26-2011 at 11:27 PM.
Reply With Quote
  #4  
Old 03-27-2011, 03:08 AM
sakurarandom sakurarandom is offline
New Member
 
Join Date: Mar 2011
Posts: 8
Default

Quote:
Originally Posted by russpatterson View Post
I've made a bunch or photoplethysmographic heart rate monitors. I've usually used a phototransistor but if your LDR works then that's great.

Can you see your heart rate on your PIC's pin 2 if you hook a scope to it? Do you have a blinking LED that goes off when your heart beats?

If your asking for the calculation for beats per minute it's something like:

Count the milliseconds between heart beat pulses on your pic. Then use a formula like: BPM = 60/(milliseconds/1000)

So if there's 1000 mS between beats your heart rate is 60 BPM, one beat per second. If there's 500 mS between beats your BPM is 120.
For the sensor on my breadboard, I am not sure it blink with heart beat or not. I connect pin2 to oscilloscope..it end up a waveform about this shape http://www.picotech.com/experiments/...e/results.html but peak to peak voltage is 53micro second. Kind of weird therefore my group member is going to transfer it to PCB board. One disadvantage of this circuit is that different ppl test the sensor, trigger always have to be made and therefore output voltage from pin2 is different. Thanks for your formula. In C lanaguage for my PIC, how my PIC about to count the period between my beats? This is what bothering me..
Reply With Quote
  #5  
Old 03-27-2011, 03:09 AM
sakurarandom sakurarandom is offline
New Member
 
Join Date: Mar 2011
Posts: 8
Default

Quote:
Originally Posted by Audioguru View Post
Look in Google for the HEMON circuit. HEMON is short for Heart Monitor.
The code for the microcontroller is shown.
Oh ok. Thanks ya
Reply With Quote
  #6  
Old 03-28-2011, 05:08 PM
sakurarandom sakurarandom is offline
New Member
 
Join Date: Mar 2011
Posts: 8
Default

Is anyone know or have software to convert assembly code to c code? I intend to convert pic 16f84 code to c language code. Thanks
Reply With Quote
  #7  
Old 03-29-2011, 05:19 PM
russpatterson's Avatar
russpatterson russpatterson is offline
Senior Member
 
Join Date: Feb 2010
Location: Carlsbad, California
Posts: 351
Default

Get the sample C files for your pic from the HITECH C install. It's free, just google HITECH C DOWNLOAD. To get the timing (there are many ways but here's one) setup an interrupt on a timer (like timer0) set it to go off 128 times per second or something. You can use a counter in that interrupt to know how much time has gone past. You can also just look at the timer values when you detect a beat and reset. That would be more accurate. Anyway getting the PIC working and getting timing values are something you should learn. Get the sample C code working then start reading the datasheet for your pic. Oscillator, timers, and interrupts are what you need to figure out for this.

That wave form you posted certainly looks like it could be heart rate ~60 BPM.
Reply With Quote
  #8  
Old 05-13-2011, 09:40 AM
sakurarandom sakurarandom is offline
New Member
 
Join Date: Mar 2011
Posts: 8
Default

Thank you all. My project was successfully done.
Reply With Quote
The Following User Says Thank You to sakurarandom For This Useful Post:
russpatterson (05-13-2011)
Reply   Post New Thread

Tags
, ,


Related Site Pages
Section Title
Worksheet Time constant calculations
Worksheet Physical effects of electricity


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pulse Counter that outputs one pulse per n-pulses tuscarora The Projects Forum 18 03-09-2010 07:20 PM
LM555 Timing and Pulse Width Modulation 1337Hendrix The Projects Forum 6 12-02-2009 07:40 PM
how to calculate the frequency of a pulse train in 8051 mantsali Embedded Systems and Microcontrollers 2 10-30-2009 04:53 AM
Heart Rate Pulse quantumlab The Projects Forum 3 03-03-2009 01:42 PM
Servo Motors Mazaag The Projects Forum 2 11-10-2006 07:18 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:46 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.