Heart beat Pulse measurement.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Heart beat Pulse measurement.

Post by Derrihj »

Hi every one,i came across this chinese Heart beat pulse sensor known as EASY PULSE V 1.1 does any one know how we can interface it with a pic in flowcode to show the Heart bpm On a 16x2 LCD.Here is the website you can find good information about it. http://embedded-lab.com/blog/easy-pulse ... ew-part-1/

stefan.erni
Posts: 568
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: Heart beat Pulse measurement.

Post by stefan.erni »

Hi Derrihj

You can easily make connections from:
VCC sensor to VCC processor board
Enable sensor to VCC processor board (or digital output pin)
AO sensor to analog input pin processor board
DO sensor to digital input pin processor board
GND sensor to GND processor board
At the beginning you can only use the DO pin. It's best to use a input pin with an interrupt. So you can check your heart rate.
Later you can also use the analog input, then you can also read the oxygen activation from your blood.
Another little hint. The LED on the board flashes with your heart rate without a processorboard.
You can also post your FC program if you want further help.

regards
Stefan
HR1.PNG
(27.6 KiB) Downloaded 1754 times

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Thanks stefan.erni sincerely speakng i have NO FC program written yet coz i don't know how to do it that is why am looking for a helper to write the FC program and we go thru it as that is the best way to learn for newbies like me.Thanks again.

stefan.erni
Posts: 568
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: Heart beat Pulse measurement.

Post by stefan.erni »

Hi Derrihj

Do you have a hardware? A Pic-board?

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

No i donot have it because i want to first get the FC program written then i make the PCB and try it out but i want to use exactly the same easy pulse v1.1 board together with a PIC but first before i make the PCB i need to be sure i have the Flowcode prog written.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Heart beat Pulse measurement.

Post by medelec35 »

Personally, If it was me, I would go ahead and purchase hardware as the Flowcode side will be fairly easy to implement.
For example I would use an interrupt to time for 250mS.
Then use the digital output and count the pulses using INT interrupt.
Then after 250ms timer interrupt has elapsed, times count by 4 that will give you the pulse.
If you do purchase software there will be help at hand.
You will be steered in the right direction.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

250mS x 4 wont that be beats per second instead of beats per minute?

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Thanks medelec35 ,i think your idear will work.Can i use a transistor to pull down INT pin once a digtal siginal is detected?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Heart beat Pulse measurement.

Post by medelec35 »

Derrihj wrote:250mS x 4 wont that be beats per second instead of beats per minute?
Yes lol.
So used to dealing in Hz, per minute is a new concept to me. :lol:
Could time for 5 seconds then x 12.
or 6 secs then x 10 etc. :)
Derrihj wrote:Can i use a transistor to pull down INT pin once a digtal siginal is detected?
No need, as the count variable is reset after elapsed time and pulse calculation.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Am going to use a pullup resistor 10k on INT pin my question is how do i pulldown INT pin inorder to cause the External interrupt,in response to the digital siginal,can i use the digital output siginal to drive an npn transistor which in turn pullsdown the INT pin in order to cause the interrupt and then count the number of external interrupts until Timer0 overflows according to timing and multiply the count by 4?

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

medelec35 please help look at my FC Prog and see how you can modify it to work better.Here am timing for 15 seconds and then multiply Count by 4 to give me Heart bpm.
Attachments
Heart Beat bpm.fcfx
(13.36 KiB) Downloaded 38 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Heart beat Pulse measurement.

Post by medelec35 »

Have have made some changes to your flowchart.
1.

Code: Select all

Count = 0
is required after

Code: Select all

Counter = Count * 4
otherwise Result will Keep increasing until rollover.

2. Changed

Code: Select all

Time
variable from Byte to integer since value will be greater then 255.
If

Code: Select all

ByteVariable = 255
then result of

Code: Select all

ByteVariable =  ByteVariable +1
is 0
ByteVariable has just rolled over as range is 0 to 255.

3. Changed timer from timer 0 to timer 2 as the latter is far more accurate and no C code is required:
Timer 2 int.png
(26.91 KiB) Downloaded 1659 times
4. Conversion to string is not necessary, just takes extra resources.
Attachments
Heart Beat bpm1.fcfx
(12.86 KiB) Downloaded 45 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Thank you very much medelec35 for the help but i would like to learn why do you use Rollover Value as 250 and not 255.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Heart beat Pulse measurement.

Post by medelec35 »

Derrihj wrote:i would like to learn why do you use Rollover Value as 250 and not 255.
With interrupts the rollover value forces the interrupt register to rollover when it reaches the set value, thus causing the interrupt to be triggered.
The rollover, Prescaller & Postscaller rates are specifically chosen to give the ideal interrupt frequency.
The ideal frequency in our case is a low as possible and as near to xx.000 as we can get it.
250 gives us that value.
With a frequency of exactly 25Hz then the interrupt is accessed exactly 25 times a second.
For 15 seconds the interrupt is accessed exactly 275 times
If you change the 250 to 255 then the interrupt frequency will be 24.510Hz.
For 15 seconds then the interrupt is accessed 367.65 times, so not as accurate!

When I mentioned rollover to do with bytes, it had noting to do with rollover value of interrupt.
Bytes rollover at 1 + 255 ,so they never reach 256.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Wawoo!!! thanks medelec35 i really like people who teach the simple way for everyone to understand and thanks for not getting tired of many questions asked.You know when you look at the Arduino many sketches are written out there and people can just download and edit as they require with flowcode we can also do it .As we ask many questions and are solved people will get to a time were everything they need has already been asked and solved so they have to just download and edit flowchats as they require so medelec35 ,you are doing a very good job.If you still have some free time,in this same area we can look at how to handle the Analog siginal (AO) too instead of the digital sothat we see how it is done for this project if one prefers to use the analog siginal.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Heart beat Pulse measurement.

Post by medelec35 »

Thanks Derrihj,
You are welcome.
Derrihj wrote:n this same area we can look at how to handle the Analog siginal (AO) too instead of the digital sothat we see how it is done for this project if one prefers to use the analog siginal.
I was thinking we can use both methods.
We can make sure interrupt works, than add ADC functionality?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

Is there a way of disabling and enabling Timer2 of PIC16F628A in a Whle1 Loop sothat it starts its timing at any point i desire and stoped at any point in code that i desire? If yes please help show me how.I really need this stoping and enabling sothat i dont miss out some seconds when the start button is pressed.That is to say,i want Timer2 to start its timing only when the start bpm count button is pressed but not when on standby in the main loop.

Hokum52
Posts: 6
Joined: Sat Dec 28, 2019 7:34 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Hokum52 »

Thanks for the explanation of the difference between 250 and 255hz, I did have trouble understanding that as well, as a newbie... It's slowly getting clearer and clearer!

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

I forgot to mention that this project was a success too i will post the pictures and video for it as soon as am done with its packaging infact i believe it will be used in our hospitals here,But first i need to order its plastic case from china ,the Ear sensor and Finger tip sensor together with an LCD bezel.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Heart beat Pulse measurement.

Post by Derrihj »

At first i had made this PCB with the PIC16f628A but it was limiting me due to space couldn't add my custom characters and some of the code that i wanted to add so i remade the PCB with a bigger MCU and of course this time with an external crystal oscillator thanks to Martin coz at first i had used an internal oscillator which is not good enough for timing projects and since this project needs accurate timing tho for only 15 seconds, the external oscillator was a valuable Bet.I used two buttons to enter data (Age of patient) as i got that look up table from some website and also some tips from Mayo Clinic website so those two buttons are multi function buttons to input Months,Years of patient,Clear and Enter functions.I remade this project with a PIC16F886 for all my code to fit in there and my custom characters to make the all project look professional.Promised to post the finished project as soon as i raise money and buy the required but also what is going on in China warries me, sorry to our brothers and sisters there we Pray to the Almighty GOD to protect the people there and to stop the virus from spreading coz thats were i buy my staf at a cheaper price that i can afford.The circuit has many test pin-out point reason is that i was building this for the first time so i need to know values and behavior of the circuit at different points but the final product will not have all those test pins.I took the pics below as i was building the circuit with my phone a day before my phone was stolen by some bad guys at night back home in a public taxi.
Attachments
pulse2.jpg
pulse2.jpg (82.46 KiB) Viewed 1100 times
pulse1.jpg
pulse1.jpg (85.8 KiB) Viewed 1100 times

Post Reply