Pulse wave veocity.Need help calculating transit time.Using ECG and PPg

Im creating a prototype that mease pulse wave velocity.This require getting transit time from pulse moving from one point to another(caPWV or baPWV). Im struggling with getting the transit time

both_ECG_and_PPG.ino (1.15 KB)

Please post your code, in code tags, and explain what

Im struggling with getting the transit time

means.

#include <Wire.h>
#include "MAX30105.h"

MAX30105 particleSensor;
//char message[20];

//declare global variabes
int value, lominus,lowplus,flag,count;
unsigned long currenttime;

//the code
void setup()
{
Serial.begin(9600); //data baud rate for Serial output //bitrate for ecg
//Serial.begin(115200);//bitrate for PPG
pinMode( 10, INPUT ); // inputs
pinMode( 11, INPUT );// inputs

//PPg Code void setup
// Initialize sensor
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1);
}

particleSensor.setup(); //Configure sensor. Use 6.4mA for LED drive

//Arduino plotter auto-scales .solution: pre-populate the plotter with 500 of an average reading from the sensor
//Take an average of IR readings at power up
const byte avgAmount = 64;
long baseValue = 0;
for (byte x = 0 ; x < avgAmount ; x++)
{
//Wait for new readings to come in
while
(particleSensor.available() == false)
{
particleSensor.check(); //Check the sensor, read up to 3 samples
}
baseValue += particleSensor.getIR(); //Read the IR value
particleSensor.nextSample(); //We're finished with this sample so move to next sample
}
baseValue /= avgAmount;
for (int x = 0 ; x < 500 ; x++)
Serial.println(baseValue);
//end og ppg void setup
}

//main code

void loop()
{
particleSensor.check(); //Check the sensor, read up to 3 samples

while (particleSensor.available()) //do we have new data?
{
Serial.println(particleSensor.getIR());

particleSensor.nextSample(); //We're finished with this sample so move to next sample
}

{
value = analogRead( A0 ); //reads analogue data
lominus = digitalRead( 10 ); //read in digital data from ‘lead off’ pins
lowplus = digitalRead( 11 );

if( lominus == 1 || lowplus == 1 ) //check if leads are off
{
Serial.println( "!" ); //if leads off output error
}
else
{
Serial.println( value );
//else output analogue value in the form of a digital
//number in the range 0 to 1023
}

{
if( value > 500 )
{
flag = 1;
}
else
{
if( flag == 1 )
{
count = count + 1;
flag = 0;
//Serial.println( count );
}
}
}
if( millis() - currenttime > 10000 )
{
currenttime = millis();
//lcd.clear();
//lcd.setCursor( 0, 0 );
//lcd.print( count * 6 );
Serial.println( count * 6 );
count = 0;
}
Serial.println( value );
}
delay( 20 );
}

//if(millis() - time_stamp > 500)// 500ms window
//output0 = count0 * 2;
//

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.