I am using AFE4400 for getting PPG signals from the artery. W e are getting the attached graph in Arduino ide by using below code (graph and code attached).
Please let me know how can measure PPG signals correctly using Arduino.
#include <SPI.h> #include "protocentral_afe44xx.h" #define AFE44XX_CS0_PIN 7 #define AFE44XX_CS1_PIN 8 #define AFE44XX_CS2_PIN 9 #define AFE44XX_CS3_PIN 10 #define AFE44XX_CS4_PIN 11 #define AFE44XX_PWDN0_PIN 2 #define AFE44XX_PWDN1_PIN 3 #define AFE44XX_PWDN2_PIN 4 #define AFE44XX_PWDN3_PIN 5 #define AFE44XX_PWDN4_PIN 6 #define AFE44XX_INTNUM 0 AFE44XX afe44xx0(AFE44XX_CS0_PIN, AFE44XX_PWDN0_PIN); AFE44XX afe44xx1(AFE44XX_CS1_PIN, AFE44XX_PWDN1_PIN); AFE44XX afe44xx2(AFE44XX_CS2_PIN, AFE44XX_PWDN2_PIN); AFE44XX afe44xx3(AFE44XX_CS3_PIN, AFE44XX_PWDN3_PIN); AFE44XX afe44xx4(AFE44XX_CS4_PIN, AFE44XX_PWDN4_PIN); afe44xx_data afe44xx_raw_data0; afe44xx_data afe44xx_raw_data1; afe44xx_data afe44xx_raw_data2; afe44xx_data afe44xx_raw_data3; afe44xx_data afe44xx_raw_data4; void setup() { Serial.begin(57600); Serial.println("Intilaziting AFE44xx.. "); SPI.begin(); afe44xx0.afe44xx_init(); afe44xx1.afe44xx_init(); afe44xx2.afe44xx_init(); afe44xx3.afe44xx_init(); afe44xx4.afe44xx_init(); Serial.println("Inited..."); } void loop() { static uint32_t diff = 0,start_time = 0; static bool start_flag = 0; if(start_flag == 0) { start_flag = 1; start_time = millis(); } diff = millis() - start_time; if(diff <= 10000) { afe44xx0.get_AFE44XX_Data(&afe44xx_raw_data0); ///////////////////////////////////////////////// Serial.println(afe44xx_raw_data0.RED_data); } ///////////////////////////////////////////////// else if(diff >= 10000 && diff <= 20000) { afe44xx1.get_AFE44XX_Data(&afe44xx_raw_data1); ///////////////////////////////////////////////// Serial.println(afe44xx_raw_data1.RED_data); } ///////////////////////////////////////////////// //else if(diff >= 20000 && diff <= 30000) //{ // afe44xx2.get_AFE44XX_Data(&afe44xx_raw_data2); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data2.RED_data); //} //else if(diff >= 30000 && diff <= 40000) //{ ///////////////////////////////////////////////// // afe44xx3.get_AFE44XX_Data(&afe44xx_raw_data3); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data3.RED_data); //} ///////////////////////////////////////////////// //else if(diff >= 40000 && diff <= 50000) //{ // afe44xx4.get_AFE44XX_Data(&afe44xx_raw_data4); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data4.RED_data); //} else if(diff >= 20000) { start_flag = 0; } ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data0.IR_data); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data1.IR_data); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data2.IR_data); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data3.IR_data); ///////////////////////////////////////////////// // Serial.println(afe44xx_raw_data4.IR_data); ///////////////////////////////////////////////// delay(8); }