Introduction: Arduino Pulse Sensor Cardio Graph

About: Will write code for food. :) If you need help with any of your embedded Arduino applications please send me a message.

The Arduino Pulse Sensor Cardio Graph application illustrates heart beat information in graphical form. The application displays different heart rate variation graphs: Beats Per Minute (BPM), Interbeat Intervals (IBI), Heart Rate Frequency (Hz), Power Spectral Density (PSD), LF vs HF (Low Frequency vs High Frequency). A Fast Fourier Transform is used to determine the Power Spectrum for a data set of heart beats. Here's a video introduction describing the application.

Things you will need

Arduino

Pulse Sensor Amped Arduino Module

Processing 3 IDE - Download here

A computer to run the Processing application.

Step 1: Pulse Sensor Amped Preperation and Arduino Setup

Connecting the Pulse Sensor Amped module to your Arduino is simple. The the sensor has 3 wire leads. One wire is for the signal, one for ground and one for 5v power. The back of the pulse sensor module shows which wire is S (signal), - (ground), and + (5v). (See the photos)

The ground wire connects to the GND port on the Arduino. The + wire connects to the 5v output on the Arduino. The signal wire connects to A0 on the Arduino so that interrupts can be used. That's it!

I also used some clear packing tape to seal the pulse sensor (shown in the photos). The PulseSensor.com website recommending sealing the back and covering the front to protect it from dirt and moisture. Also, sealing the back prevents bad readings when holding the sensor between the fingers. Otherwise, skin contact to the exposed circuit could cause bad readings. I read a customer review of this product on Amazon where the customer complained of being shocked! They stated the wiring was unclear and had wired it wrong and received a shock. I have not had any such problems. The module seemed clearly marked and it works great!

Step 2: Arduino Code

The following video goes over the Arduino sketch source code for the Pulse Sensor Amped Cardio Graph application. Please watch the video for detailed information on setting up the application. You can download the source code files for this project here: https://github.com/dmainmon/Arduino-Pulse-Sensor-Amped-Cardio-Graph

The Arduino sketch came from the PulseSensor.com website. I didn't change it much, just the COM port. One thing to watch out for is the baud rate. The baud rate needs to match on the Arduino sketch and the Processing sketch. Otherwise, the applications will not be able to communicate. This is a common Arduino pitfall; you open the serial monitor and instead of seeing the expected data, you see all sorts of garbled meaningless characters. This is because the baud rate for the serial window doesn't match the speed set in the code.

Note: The baud rates also need to match on the Processing code!

Step 3: Processing Code

You will need the Processing IDE in order to compile and execute this application.You can download the Processing 3 IDE from https://www.processing.org/ The following video demonstration describes the Processing source code in detail, including the use of JTransforms Fast Fourier Transform (FFT) java library.

Part II - Continuation of Processing 3 source code for the Pulse Sensor Amped Cardio Graph application.


Libraries

To create the power spectrum (PSD) graph a Fast Fourier Transform library is used.

JTransforms is a java library that works great. You can download the library here: https://sites.google.com/site/piotrwendykier/software/jtransforms

Download the binaries with dependencies and drag and drop the file into the Processing IDE window. This will copy the file into the /code folder of your sketch so you can use the library. You can download the binary with dependencies directly here.

There is also a link embedded in the source code demonstration videos to download all the source files needed for this application.