Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IR and RED values interpretation from Arduino #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion processing/openview_pulseox/SPO2_cal.pde
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SPO2_cal
{
SPO2 = 0;
int k = 0;
for(int i = 50; i < spo2_array.length; i++)
for(int i = 0; i < spo2_array.length; i++)
{
// float roundoff = Math.round((spo2_array[i] * spo2_array[i])*100)/100;
spo2_cal_array[k++] = spo2_array[i] * spo2_array[i];
Expand Down
22 changes: 11 additions & 11 deletions processing/openview_pulseox/openview_pulseox.pde
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ public void setup() {
}
time = 0;
g.GraphColor = color(0, 255, 0);
g.Title = "RED";
g.Title = "IR";
g1.GraphColor = color( 0, 255, 0);
g1.Title = "IR";
g1.Title = "RED";
// myFilter = new SignalFilter(this);
}

Expand Down Expand Up @@ -263,33 +263,33 @@ void ecsProcessData(char rxch)
{
int data1 = ecsParsePacket(DataRcvPacket1, DataRcvPacket1.length-1);
int data2 = ecsParsePacket(DataRcvPacket2, DataRcvPacket2.length-1);
receivedVoltage_RED = data1 * (0.00000057220458984375) ;
receivedVoltage_IR = data2 * (0.00000057220458984375) ;
receivedVoltage_IR = data1 * (0.00000057220458984375) ;
receivedVoltage_RED = data2 * (0.00000057220458984375) ;

time = time+0.1;
xdata[arrayIndex] = time;

//receivedVoltage_RED = myFilter.filterUnitFloat((float)receivedVoltage_RED);
//receivedVoltage_IR = myFilter.filterUnitFloat((float)receivedVoltage_IR);
//receivedVoltage_RED = myFilter.filterUnitFloat((float)receivedVoltage_RED);


AvgYdata[arrayIndex] = (float)receivedVoltage_RED;
AvgZdata[arrayIndex] = (float)receivedVoltage_IR;
AvgYdata[arrayIndex] = (float)receivedVoltage_IR;
AvgZdata[arrayIndex] = (float)receivedVoltage_RED;
value1 = (float)( AvgYdata[arrayIndex] - averageValue(AvgYdata));
value2 = (float)( AvgZdata[arrayIndex] - averageValue(AvgZdata));
ydata[arrayIndex] = value1;
zdata[arrayIndex] = value2;

float RedDC = (float) averageValue(AvgYdata);
float IrDC = (float) averageValue(AvgZdata);
float IrDC = (float) averageValue(AvgYdata);
float RedDC = (float) averageValue(AvgZdata);

arrayIndex++;
if (arrayIndex == pSize)
{
arrayIndex = 0;
time = 0;
RedAC = s.SPO2_Value(ydata);
IrAC = s.SPO2_Value(zdata);
IrAC = s.SPO2_Value(ydata);
RedAC = s.SPO2_Value(zdata);
float value = (RedAC/abs(RedDC))/(IrAC/abs(IrDC));

/******** Emprical Formalae *********/
Expand Down