Arduino HeartBeat Monitor KY-039 lcd1602

Arduino HeartBeat Monitor
Hello again! Today i made a example for the KY-039.
I had a hard time getting this sensor to work, then i found out i am not the only one having a hard time with it.
Anyways i somehow got it to work with someone’s code So i did not wrote this one,
the code did not work at all at first but it seems it does work now.
Anyways IF someone creates something perfectly working with it then Please let me know.

Arduino HeartBeat Monitor, ky-039 pulse sensor

Parts list:
Arduino Uno, I used the robotdyn uno.
KY-039 Heart beat sensor.
10k Potentiometer.
LCD 1602 A (You can also use one with a I2C, i pre-set the lines in the code)
Jumper wires. MM/FF/MF


Arduino HeartBeat Monitor
This example will show you how to use the KY-039 heart bear sensor.
Its a simple basic heart beat monitor with a LCD1602A. In this example i did not use a I2C for those who don't have it.
#include <Wire.h>
#include <LiquidCrystal.h> 
//#include <LiquidCrystal_I2C.h>//uncomment when using a I2C

//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);// Uncomment when using a I2C
//make sure you set the right address. here are the most common ones.
//PCF8574 = 0x20, PCF8574A = 0x38, PCF8574AT = 0x3F.

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
   double alpha=0.75;
   int period=20;
   double refresh=0.0;
void setup(void)
//   lcd.backlight(); //Uncomment when using a I2C

void loop(void)
   static double oldValue=0;
   static double oldrefresh=0;
   int beat=analogRead(A0);
   double value=alpha*oldValue+(0-alpha)*beat;
   lcd.print(" Heart Monitor "); 
   lcd.print("          ");

Danny van den Brande

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *