diff --git a/PulseSensorAmpd_Processing_1dot1/PulseSensorAmpd_Processing_1dot1.pde b/PulseSensorAmpd_Processing_1dot1/PulseSensorAmpd_Processing_1dot1.pde index 4dff829..3821e94 100644 --- a/PulseSensorAmpd_Processing_1dot1/PulseSensorAmpd_Processing_1dot1.pde +++ b/PulseSensorAmpd_Processing_1dot1/PulseSensorAmpd_Processing_1dot1.pde @@ -3,6 +3,8 @@ THIS PROGRAM WORKS WITH PulseSensorAmped_Arduino-xx ARDUINO CODE THE PULSE DATA WINDOW IS SCALEABLE WITH SCROLLBAR AT BOTTOM OF SCREEN PRESS 'S' OR 's' KEY TO SAVE A PICTURE OF THE SCREEN IN SKETCH FOLDER (.jpg) MADE BY JOEL MURPHY AUGUST, 2012 +Updated with HRV display by Elliot Mebane, Roguish, Inc. Feb 2016 +HRV requires 1 minute of data before it's accurate. */ @@ -15,9 +17,12 @@ Serial port; int Sensor; // HOLDS PULSE SENSOR DATA FROM ARDUINO int IBI; // HOLDS TIME BETWEN HEARTBEATS FROM ARDUINO int BPM; // HOLDS HEART RATE VALUE FROM ARDUINO +int HRV; // HRV. Log RMSSD. Scale from about 0 - 20; +int STDDEV; // Standard Deviation int[] RawY; // HOLDS HEARTBEAT WAVEFORM DATA BEFORE SCALING int[] ScaledY; // USED TO POSITION SCALED HEARTBEAT WAVEFORM int[] rate; // USED TO POSITION BPM DATA WAVEFORM +int[] hrv; float zoom; // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW float offset; // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW color eggshell = color(255, 253, 248); @@ -27,9 +32,10 @@ int PulseWindowWidth = 490; int PulseWindowHeight = 512; int BPMWindowWidth = 180; int BPMWindowHeight = 340; +int HRVWindowWidth = 180; // Number of graph points to display in the horizontal space. +int HRVWindowHeight = 340; boolean beat = false; // set when a heart beat is detected, then cleared when the BPM graph is advanced - void setup() { size(700, 600); // Stage size frameRate(100); @@ -43,6 +49,7 @@ void setup() { RawY = new int[PulseWindowWidth]; // initialize raw pulse waveform array ScaledY = new int[PulseWindowWidth]; // initialize scaled pulse waveform array rate = new int [BPMWindowWidth]; // initialize BPM waveform array + hrv = new int[HRVWindowWidth]; // initialize the HRV waveform array zoom = 0.75; // initialize scale of heartbeat window // set the visualizer lines to 0 @@ -52,11 +59,14 @@ void setup() { for (int i=0; i