The HW-827 module is a heart rate monitor. They can be used in various projects such as health monitoring, biofeedback or wearable medical devices. The part of the sensor with the heart-shaped logo is where you place your finger.

How does the heart rate sensor work?

A pulse sensor, like any other optical heart rate sensor, works by projecting green light (~ 550nm) onto the finger and measuring the amount of reflected light using a photosensor.
Oxygenated hemoglobin in arterial blood has the property of absorbing green light. The redder the blood (the higher the hemoglobin), the greater the absorption of green light. With each heartbeat, blood is pumped into the finger, resulting in a change in the amount of reflected light, which in turn produces a waveform at the output of the photosensor.
By continuing to illuminate and take measurements from the photosensor, you soon start to get a heartbeat measurement.

  • HW-827 sensor pins

Signal: Connect to one of the analog pins

Vcc: Connect to +3.3V on Arduino board

Ground : Connect to GND on Arduino board

Electronic diagram

Here is the circuit diagram for connecting the heart sensor to the Arduino Uno board:


To use the heart rate sensor you’ll need to install the PulseSensor library:

Here is the program that uses the PulseSensor library to read your heartbeat in BPM :

#define USE_ARDUINO_INTERRUPTS true // Configure low-level interrupts for accurate BPM calculation.
#include <PulseSensorPlayground.h> // Includes PulseSensorPlayground library. 

// Variables
const int PulseWire = 0; // VIOLET wire of pulse sensor connected to ANALOGUE TIP 0
const int LED = LED_BUILTIN; // The built-in Arduino LED, near PIN 13.
int Threshold = 550; // Determines which signal to "count as a beat" and which to ignore.
PulseSensorPlayground pulseSensor; 

void setup() { 
Serial.begin(9600); // For Serial Monitor
pulseSensor.blinkOnPulse(LED); // Automatically blinks the Arduino LED at heart rate.
if (pulseSensor.begin()) {
 Serial.println("Starting the heart rate sensor!"); // This is printed once when the Arduino is started or reset.

void loop() {
if (pulseSensor.sawStartOfBeat()) { // Constantly checks whether there has been a "beat".
int myBPM = pulseSensor.getBeatsPerMinute(); 
Serial.print("Pulse BPM: "); // If the test is "true", prints a message indicating "a heartbeat has occurred". 


As this program optically detects heart rate, it may produce erroneous results. Please DO NOT USE FOR ANY MEDICAL DIAGNOSIS.


The result can be seen on the serial monitor: