Track Heart Rate: a Guide to Pulse Sensor and Arduino Integration

by AKP in Circuits > Arduino

7 Views, 0 Favorites, 0 Comments

Track Heart Rate: a Guide to Pulse Sensor and Arduino Integration

pulse-sensor-arduino-tutorial.png

The Pulse Sensor is an elegantly crafted heart-rate sensor with low power consumption, ideal for use with Arduino. It’s perfect for anyone seeking to integrate live heart-rate data into their projects, including students, artists, athletes, creators, and developers of games and mobile applications.

What’s particularly noteworthy is its seamless integration with Arduino; simply plug it in and attach it effortlessly to a fingertip or earlobe. Additionally, its compact size, resembling a button, and the presence of sewing holes make it convenient for embedding into fabric.

Hardware Overview

Pulse-Sensor-Front-Side-Hardware-Overview.jpg
Pulse-Sensor-Back-Side-Hardware-Overview.jpg

At the forefront of the sensor is the area designated for placing your finger, marked with a heart logo. Adjacent to it is a minuscule circular aperture from which the Kingbright’s reverse mounted green LED emits light.

Just below the circular aperture resides a small ambient light photo sensor – the APDS-9008 from Avago. This sensor functions similarly to those found in cell phones, tablets, and laptops, adjusting screen brightness according to ambient lighting conditions.

Situated on the reverse side of the module are components including the MCP6001 Op-Amp from Microchip, along with a selection of resistors and capacitors constituting the R/C filter network. Additionally, a reverse protection diode is incorporated to prevent potential damage in case of accidental reversal of power leads.

The module operates within a DC power supply range of 3.3 to 5V and consumes less than 4mA of current.


How Does a Pulse Sensor Work?

Light-Sensor-LED-Pulse-Detection-Photoplethysmogram.png
Pulse-Detection-Heart-Rate-Sensor-Working-Photoplethysmogram.jpg

The principle behind optical heart-rate sensors is quite straightforward. If you’ve ever shone a flashlight through your fingers and observed the pulsation of your heartbeat, you can easily grasp the concept of optical heart-rate pulse sensors.

A pulse sensor, like any other optical heart-rate sensor, operates by emitting a green light (~550nm) onto the finger and gauging the quantity of reflected light with a photosensor.

This method of optical pulse detection is termed a Photoplethysmogram.

Oxygenated hemoglobin in arterial blood has the property of absorbing green light. The more red the blood (indicating higher hemoglobin levels), the greater the absorption of green light. With each heartbeat, blood flows through the finger, inducing a change in reflected light, thereby generating a waveform at the output of the photosensor.

Continuously illuminating the finger and capturing photosensor readings allows for swift acquisition of a heartbeat pulse reading.

The output signal from the photosensor is typically small and prone to noise; thus, it undergoes filtration via an R/C filter network and subsequent amplification with an Op-Amp, resulting in a significantly larger, cleaner, and more detectable signal.

Connecting a Pulse Sensor to an Arduino

Wiring-Connecting-Pulse-Sensor-with-Arduino.jpg

Linking the Pulse Sensor to an Arduino is a straightforward task. You’ll only need to connect three wires: two for power and one for reading the sensor value.

The module can be powered with either 3.3V or 5V. Positive voltage is attached to ‘+,’ while ground connects to ‘-.’ The third wire marked ‘S’ is the analog signal output from the sensor, which will be linked to the Arduino’s A0 analog input.

Below is the wiring diagram for Pulse Sensor experiments:

Arduino Example 1 – Heartbeat Blink

Open the GettingStartedProject sketch from the example sketches in your Arduino IDE. This is a simple Arduino sketch. Upload the code to your Arduino board and attach the sensor to your fingertip or earlobe. You will observe the onboard LED of the Arduino blinking in sync with your heartbeat!

int const PULSE_SENSOR_PIN = 0;   // 'S' Signal pin connected to A0

int Signal; // Store incoming ADC data. Value can range from 0-1024
int Threshold = 550; // Determine which Signal to "count as a beat" and which to ignore.

void setup() {
pinMode(LED_BUILTIN,OUTPUT); // Built-in LED will blink to your heartbeat
Serial.begin(9600); // Set comm speed for serial plotter window
}

void loop() {

Signal = analogRead(PULSE_SENSOR_PIN); // Read the sensor value

Serial.println(Signal); // Send the signal value to serial plotter

if(Signal > Threshold){ // If the signal is above threshold, turn on the LED
digitalWrite(LED_BUILTIN,HIGH);
} else {
digitalWrite(LED_BUILTIN,LOW); // Else turn off the LED
}
delay(10);
}


See Full Article Here