Thursday, March 8, 2012

WEEK 7 & 8

OBJECTIVE :

  1. Program code for RMS value for Red and Infrared LED
  2. Program code for ratio, R
  3. Program code for SPO2 from 3rd order fit polynomial.
  4. Program code for Simple Moving Average (SMA) filtering on Heartbeat signal
  5. Program code for Simple Moving Average (SMA) filtering on SPO2 signal

PROCEDURE :

  • Below is the code for root mean square (RMS) value for red and infrared LED. The float value will be define in variable section while the sample counter-1 initiate in the main programming.   
//Calculate the RMS values of the AC for both RED and IR sources
Rrms = sqrtf(RSum/(float)(SampleCounter-1));
IRrms = sqrtf(IRSum/(float)(SampleCounter-1));


  • Ratio, Rx is to be insert to SpO2 calculation
//Calculate the Ratio R = (Rrms/Rdc) / (IRrms/IRdc)
Rx = (Rrms/R_DC)/(IRrms/IR_DC);


  • The constant value in the calculation takes from 3rd order fit polynomial
//Calculate the SPO2 from 3rd order fit polynomial
SPO2 = ((10.002*Rx - 52.887)*Rx + 26.817)*Rx + 98.293;


  • The simple moving average filter purpose is to smooth the signal for heart beat
//Perform Simple Moving Average (SMA) filtering on Heartbeat signal
SMA = SMAM1 + (float)(X[Beats] - X[SMAindex])/(MEDIAN_SIZE-1);
SMAM1 = SMA;   

  • Signal for SpO2 also implement simple moving average filter
//Perform Simple Moving Average (SMA) filtering on SPO2 signal
SPO2ave = SPO2aveM1 + (float)(SP2[Beats] - SP2[SMAindex])/(MEDIAN_SIZE-1);
SPO2aveM1 = SPO2ave;            


CONCLUSION   

  • All calculation regarding formula is ready to implement. next step will be the integration with the main program

No comments:

Post a Comment