4521Views5Replies

Author Options:

Counting Heartbeat with Arduino: Help with Code? Answered

I got a premade heartbeat sensor which uses an IR led and an IR receiver to sense heartbeat. It gives out an analog signal, which i have connected to my Arduino's A0 pin, and uploaded the analogRead sketch to it(sends values to serial port too).

Then to visualize the heartbeat i used a processing graph program that took the values from the serial port. When i place my finger on the sensor,  i get this graph shown below:  

Yes its very clear, but can anyone help me with the code? it just needs to measure the beats per minute, and store it in a variable.

**The spike in the grph showing the pulse varies in height sometimes. So the code should calbrate and all. Also there is a 1-2 second delay before the clean pulse comes...

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
RD5
RD5

6 years ago

Hi, I'm working on a very similar project and I would like to know if you found a solution..

How can we measure the BPM??

Please help :)

0
steveastrouk
steveastrouk

6 years ago

You could clean the signal up with a comparator and use the freqmeas library for the arduino.

0
DangerousTim
DangerousTim

Answer 6 years ago

it already usues 2 opamps... i would love it if someone showed how to clean the signal in the software itself

0
steveastrouk
steveastrouk

Answer 6 years ago

work out the mean of the signal, if level > mean result=1 if level <= mean result=0