How do I use the KY-039 sensor?

Hi there,

I'm very new to the arduino and it's sensors. I was hoping you could help me out a little.
I'm trying to measure the heartbeat with the KY-039 sensor:

So, my question is how would I set this up with the arduino Uno and a breadboard so I can read out the data? And where can I find a console that let me read out this data?

Thanks in advance! :slight_smile:

UKHeliBob on this very forum suggests:

Try the code on this page
http://www.ebay.co.uk/itm/NEW-KY-039-Finger-Measuring-Heartbeat-Sensor-Module-for-Arduino-/331127966386

bigred1212:
UKHeliBob on this very forum suggests:

Try the code on this page
http://www.ebay.co.uk/itm/NEW-KY-039-Finger-Measuring-Heartbeat-Sensor-Module-for-Arduino-/331127966386

Thanks for you answer.
I have tried that code, but all I get is data that is around 1000. That is, if I'm looking in the right place. It doesn't change when I place my finger on the sensor. I also tried to shield it from light, but no luck.
I couldn't find the answer in this thread: KY039 Arduino Heart rate code - Programming Questions - Arduino Forum
So, perhaps I might be setting it up wrong. Or do you think it has to do with something else?

TerraroQ:
So, perhaps I might be setting it up wrong.

Looking from the top as "Keyes" reads, left pin signal, middle Vcc, right Gnd?

hey, I have the same problem.
in the example code it state that pin 13 should be blinking but it doesn't :confused:
I have tried so many things i even used another module because i thought mine is not working.
what I do is: I put my finger between the transmitter and receiver, is that wrong?
also i connect the "S" to A0 and the middle pin to +5 v and the last one to GND.

I have a couple of these and have never been able to get them to work.

I sell a lot of the Keyes Electronic Bricks and they are good and good value, but I decided to NOT sell this one! If anyone gets it to work, PLEASE tell us how.

Some perspective on the Brick Stuff HERE:

DISCLAIMER: Mentioned stuff from my own shop..!

I had the same question and it seemed most people said this sensor module just doesn't work.

I fooled around with the connections and managed to make a blob pulse according to my pulse with processing.
(it's quite subtle but it's mostly in synch with my pulse)

Arduino Code:
I used the one recommended earlier in this thread
http://www.ebay.co.uk/itm/NEW-KY-039-Finger-Measuring-Heartbeat-Sensor-Module-for-Arduino-/331127966386

Made a simple Processsing code:
(I'm a beginner, pls advise if something's off ^^;)

void setup(){
myPort = new Serial(this, Serial.list()[6], 115200);
size(300, 300);
background(0);
noStroke();
smooth();
}

void draw() {

while (myPort.available() > 30) {
int inByte = myPort.read();
println(inByte);

if(inByte>35){
ellipse(width/2, height/2, inByte2, inByte2);
}
else{
background(0);
}
}
}

Connections:
Most importantly, I connected the A0 to the S pin & Ground to - pin.
Leaving out the whole 5V all together. (why, I hv no clue. the pin fell out and it worked better without too much flickering)

Should there be light coming from the Led when you apply power to the sensor?

johnjameson:
Should there be light coming from the Led when you apply power to the sensor?

No. It's infrared light so invisible to the naked eye, but you should be able to see it using a digital camera.

Hi!! I see this code only works for detecting the heartbeat but i want to calculate heart rate.Can you please suggest me the code