hi guys
I am currently trying to build a heart rate monitor but don't know where to start with the coding, does anybody have a skeleton version for a heart rate monitor with macros and instructions so i can tailor it to my sensor.
Thanks very much
Keevash
Heart Rate monitor help needed
Moderator: Benj
-
- Posts: 3
- Joined: Wed Feb 08, 2017 1:20 pm
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Heart Rate monitor help needed
Hello Keevash,
The should be fairly straight forward depending on which sensor you're using.
A light sensor and a LED should suffice for a sensor but you may want something that's more of an all in one package.
I would simply use an ADC input to monitor the voltage coming from the sensor. The ADC would be sampled at a reasonably high rate and we would look for the major peaks and maybe also the troughs. Once you have a base line you set a threshold level with a tolerance and then count how many times the signal goes over the threshold in a specific fixed time frame. Using some simple calculations this should then give you a usable BPM.
If the sensor provides a digital output then you can simply use this to drive an interrupt pin and just count the number of interrupts in a time frame, there is an example of this here.
http://www.matrixtsl.com/wikiv7/index.p ... Interrupts
Have a go and post your program so far and we can comment on what you can do to try and improve things.
The should be fairly straight forward depending on which sensor you're using.
A light sensor and a LED should suffice for a sensor but you may want something that's more of an all in one package.
I would simply use an ADC input to monitor the voltage coming from the sensor. The ADC would be sampled at a reasonably high rate and we would look for the major peaks and maybe also the troughs. Once you have a base line you set a threshold level with a tolerance and then count how many times the signal goes over the threshold in a specific fixed time frame. Using some simple calculations this should then give you a usable BPM.
If the sensor provides a digital output then you can simply use this to drive an interrupt pin and just count the number of interrupts in a time frame, there is an example of this here.
http://www.matrixtsl.com/wikiv7/index.p ... Interrupts
Have a go and post your program so far and we can comment on what you can do to try and improve things.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel