Project #15: Environment - KY-039 - Mk32
Web
https://www.donluc.com/?p=4482
https://www.facebook.com/share/v/16cNykhZMa/
YouTube
#DonLucElectronics #DonLuc #KY039 #ESP32 #Arduino #EEPROM #Display #Elecrow #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant



KY-039 Heartbeat Sensor Module
This project uses bright infrared (IR) LED and a phototransistor to detect the pulse of the finger, a red LED flashes with each pulse.
Pulse monitor works as follows: The LED is the light side of the finger, and phototransistor on the other side of the finger, phototransistor used to obtain the flux emitted, when the blood pressure pulse by the finger when the resistance of the phototransistor will be slight changed.
We chose a very high resistance resistor R1, because most of the light through the finger is absorbed,it is desirable phototransistor sensitive enough.Resistance can be selected by experiment to get the best results. The most important is to keep the shield stray light into the phototransistor. For home lighting that is particularly important because the lights at home mostly based 50HZ or 60HZ fluctuate, so faint heartbeat will add considerable noise.
DL2506Mk04
1 x Crowduino Uno - SD
1 x Crowtail - Base Shield
1 x Crowtail - I2C LCD
1 x KY-039 Heartbeat Sensor Module
1 x Crowtail - LED(Green)
1 x USB Battery Pack
1 x USB Mini-B Cable
Crowduino Uno - SD
SCL - A5
SDA - A4
KYH - A0
LED - 6
VIN - +5V
GND - GND
DL2506Mk04p
DL2506Mk04p.ino
/****** Don Luc Electronics © ******
Software Version Information
Project #15: Environment - KY-039 - Mk31
DL2506Mk04p.ino
DL2506Mk04
1 x Crowduino Uno - SD
1 x Crowtail - Base Shield
1 x Crowtail - I2C LCD
1 x KY-039 Heartbeat Sensor Module
1 x Crowtail - LED(Green)
1 x USB Battery Pack
1 x USB Mini-B Cable
*/
// Include the Library Code
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>
// Wire
#include <Wire.h>
// Liquid Crystal
#include "LiquidCrystal.h"
// KY-039 Heartbeat
int iHeartbeat = A0;
// Pulse
float pulse;
// Sum
int sum = 0;
// Liquid Crystal
// Connect via i2c
LiquidCrystal lcd(0);
// LED Green
int iLEDGreen = 6;
// EEPROM Unique ID Information
String uid = "";
// Software Version Information
String sver = "15-31";
void loop() {
// Heartbeat
// isHeartbeat
isHeartbeat();
// Display Heartbeat
isDisplayHeartbeat();
// Delay
delay( 100 );
}
getDisplay.ino
// getDisplay
// Crowbits - OLED 128X64 UID
// Display UID
void isDisplayUID(){
// Set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
// Cursor
lcd.setCursor(0, 0);
lcd.print("Don Luc Electron");
// Cursor
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print( sver );
}
// Display Heartbeat
void isDisplayHeartbeat(){
// Clear
lcd.clear();
// Set the cursor to column 0, line 0
lcd.setCursor(0, 0);
lcd.print( "Heartbeat" );
// Set the cursor to column 0, line 1
lcd.setCursor(0, 1);
lcd.print( pulse );
}
getEEPROM.ino
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
getHeartbeat.ino
// KY-039 Heartbeat
// isHeartbeat
void isHeartbeat(){
// Sum
sum = 0;
// KY-039 Heartbeat
for (int i = 0; i < 20; i++){
sum += analogRead(iHeartbeat);
}
// Pulse
pulse = sum / 200.00;
}
setup.ino
// Setup
void setup()
{
// Delay
delay(100);
// isUID EEPROM Unique ID
isUID();
// Delay
delay(100);
// Initialize the LED Green
pinMode(iLEDGreen, OUTPUT);
// LED Green
digitalWrite(iLEDGreen, HIGH);
// Delay
delay(100);
// KY-039 Heartbeat
pinMode(iHeartbeat, INPUT);
// Delay
delay( 100 );
// Display UID
isDisplayUID();
// Delay 10 Second
delay( 10000 );
}
People can contact us: http://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consulting
-Programming Language
-Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc...)
-IoT
-Wireless (Radio Frequency, Bluetooth, WiFi, Etc...)
-Robotics
-Automation
-Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
-Unmanned Vehicles Terrestrial and Marine
-Machine Learning
-Artificial Intelligence (AI)
-RTOS
-Sensors, eHealth Sensors, Biosensor, and Biometric
-Research & Development (R & D)
-Consulting
-Etc...
Follow Us
Luc Paquin – Curriculum Vitae - 2025
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
