WorldFamousElectronics / PulseSensor_Amped_Arduino

PulseSensor Arduino code for BPM and Processing-Visualizer
MIT License
237 stars 206 forks source link

Detecting BPM without touching the sensor? #13

Open george-i opened 8 years ago

george-i commented 8 years ago

This is my code on GitHub: https://github.com/george-i/Adafruit-Flora---PulseSensorAmped

I've adapted the code to work with Flora, however, on the serial it prints various values without even touching the sensor. After I touch the sensor, it looks like the bpm is adjusting, but then suddenly changes.

Any idea what's going on?

biomurph commented 8 years ago

There isn't very much noise reduction in the Pulse Sensor Amped code. So it is reacting to small noise fluctuations in the ambient light when it's not touching your finger. To fix this, you will need to add some noise cancelling code. There is a varialbe, called 'amp' in the interrupt code. That variable is updated every time the Pulse Sensor finds a beat. You can use a threshold on that value to limit the size of the 'pulse' signal that you want the sensor to react to. This is something that we're working on...

george-i commented 8 years ago

I understand.

On the other hand, when I touch the sensor the value is very high. I have a strap heart rate monitor and I figured it out that I have to divide to 2, to have similar value. I don't know why...

biomurph commented 8 years ago

what development board are you using with the Pulse Sensor? You may need to change some of the code to get the bpm right.

Making the world safe for robots

On Wed, Oct 28, 2015 at 2:58 PM, George Ilie <notifications@github.com>
wrote:

> I understand.
>
> On the other hand, when I touch the sensor the value is very high.
> I have a strap heart rate monitor and I figured it out that I have to
> divide to 2, to have similar value.
> I don't know why...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/issues/13#issuecomment-151955522>
> .
>
george-i commented 8 years ago

Adafruit Flora, based on ATmega32u4. I did the changes (detailed here: http://forum.arduino.cc/index.php?topic=355957.0).

Edit: I was using the interrupt setup from Leonardo instead of Flora.

I still can't get rid of the noise. Sometimes it shows the real BPM, but sometimes it shows all sorts of values. That "amp" variable has no effect. I've tried different values to all those, but without any luck.

biomurph commented 8 years ago

You don't need to use the analogReference(EXTERNAL); unless you are using two different power supplies. If the whole system is running at 3.3V, then don't include that line of code. What clock speed is the Flora running at?

J

Making the world safe for robots

On Thu, Oct 29, 2015 at 1:11 AM, George Ilie <notifications@github.com>
wrote:

> Adafruit Flora, based on ATmega32u4.
> I did the changes (detailed here:
> http://forum.arduino.cc/index.php?topic=355957.0).
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/issues/13#issuecomment-152077074>
> .
>