The project I made right now was just for fun. I wanted to make a simple heart rate sensor that would work well for most users. This is not my original idea so I would like to give credit to XTronical for making the following video:
This is a very simple sensor as you will not not need any libraries.
Optical Biometrics: Human Pulse Sensor
Reading a temperature sensor is passive. Reading the complex biology of a human being requires active algorithmic filtration. The Simple Heart Rate Sensor uses an optical technique called Photoplethysmography (PPG) to 'see' the invisible microscopic expansion of capillaries inside a human fingertip synced to the heart.
The Optical Reflection Principle
The PulseSensor module looks like a tiny red sticker you strap to your finger or earlobe.
- The Transceiver: It contains a super-bright Green LED and an ambient light sensor looking back at the skin.
- The Physics: When your heart pumps, a microscopic surge of blood rushes into your finger capillary. Blood absorbs green light.
- Therefore, every single time your heart beats, the light sensor detects a tiny, fraction-of-a-second drop in the reflected green light!
Calculating BPM via Peak Detection
The raw analog signal coming into Arduino Pin A0 is a chaotic, squiggly wave full of physiological noise (breathing, moving, electrical hum).
- You cannot just write
if (analogRead(A0) > 500). It will fail. - You must use an algorithmic Threshold Peak Detector.
- The code establishes a dynamic threshold. When the squiggly wave sharply spikes over the threshold line, the Arduino tags it as
Beat 1. - It captures the
millis()timestamp. - When the wave spikes again, it captures
Beat 2. - The Equation: Time between beats = 800 milliseconds.
BPM = 60,000 / 800 = 75 Beats Per Minute! - The Arduino flashes an external LED exactly in sync with the blood flow!
Biometric Build Components
- Arduino Uno/Nano (Excellent 10-bit analog conversion).
- PulseSensor Amped Module (A generic photoresistor will NOT work because it requires complex onboard operation-amplifier noise filtering chips!).
- An OLED Display or 16x2 LCD to print the huge
BPM: 75text. - A velcro finger-strap (Keeping the sensor perfectly still against the skin is mandatory).