Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 1   [ 4 posts ]
Author Message
 Post subject: Arduino Uno, Delays on readings (e-health)
PostPosted: Fri Apr 07, 2017 5:56 pm 

Joined: Fri Apr 07, 2017 5:34 pm
Posts: 2
Hi,

I started using eHealthkit 2.4 for Arduino and I was looking through examples.
My application requires precise synchronisation of measurements with other data.

I was looking at the Pulsioximeter code Example and I stumbled upon this code:

Code:

void readPulsioximeter(){ 
  cont ++;

  if (cont == 50) { //Get only of one 50 measures to reduce the latency
    eHealth.readPulsioximeter(); 
    cont = 0;
  }
}


So I was wondering whether I could get some understanding why this method is suggested. So as I understand the line:
Code:
eHealth.readPulsioximeter()

reads the values from sensors and then the lines:
Code:
  float conductance = eHealth.getSkinConductance();
  float resistance = eHealth.getSkinResistance();
  float conductanceVol = eHealth.getSkinConductanceVoltage();

just deliver the cached (from the last measurement) data, right? So I would get the actual reading only every 50th time and every value in between would be the same as the point of measurement?

Why is that so, is it because the measurement is time-consuming? What kind of delays can I expect?

Code:
void readPulsioximeter(){ 
    eHealth.readPulsioximeter(); 
}


Moreover, when looking at the implementation of the function I found that there is some delay of 300 microseconds in code:

Code:
   void eHealthClass::readPulsioximeter(void)
   {
      uint8_t digito[41];

      uint8_t A = 0;
      uint8_t B = 0;
      uint8_t C = 0;
      uint8_t D = 0;
      uint8_t E = 0;
      uint8_t F = 0;
      uint8_t G = 0;

      for (int i = 0; i<41 ; i++) { // read all the led's of the module
         A = !digitalRead(13);
         B = !digitalRead(12);
         C = !digitalRead(11);
         D = !digitalRead(10);
         E = !digitalRead(9);
         F = !digitalRead(8);
         G = !digitalRead(7);
         
         digito[i] = segToNumber(A, B, C ,D ,E, F,G);   
         delayMicroseconds(300); //300 microseconds         
         
      }

         SPO2 = 10 * digito[25] + digito[20];
         BPM  = 100 * digito[19] + 10 * digito[2] + digito[0];
      
                         
   }



What kind of delays can I expect in the measurements in general? I am mainly interested in Pulsioximeter, Temperature sensor and GSRE?


Top
 Profile  
 
 Post subject: Re: Arduino Uno, Delays on readings (e-health)
PostPosted: Mon Apr 10, 2017 8:26 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello Granit,

Code:
void readPulsioximeter(){ 
  cont ++;

  if (cont == 50) { //Get only of one 50 measures to reduce the latency
    eHealth.readPulsioximeter(); 
    cont = 0;
  }
}


This system is made to take only one measurement every 50 times that the loop is done. The delay time for this function is 300microseconds * 41 = 12.3 ms

If you take a look at the functions you will see the included delays, for example "getSkinConductanceVoltage()" includes a 100ms delay.

If you need a precise control of the time you can use a very useful function: millis()
https://www.arduino.cc/en/Reference/Millis
This function is used to count time differentials.

Regards


Top
 Profile  
 
 Post subject: Re: Arduino Uno, Delays on readings (e-health)
PostPosted: Mon Apr 10, 2017 9:04 am 

Joined: Fri Apr 07, 2017 5:34 pm
Posts: 2
Hi,

Thank you very much for your response! I noticed during the measurements that even though the measurement is taken every 50th time, the reeadings do not stay the same for the next 50 values. So:
Code:
float conductance = eHealth.getSkinConductance();
float resistance = eHealth.getSkinResistance();
float conductanceVol = eHealth.getSkinConductanceVoltage();


the code above delivers different values every time. I would expect that the values change only every 50th time. Is there any approximation or interpolation involved which approximates the readings at every point based on periodic measurements (which in this case is every 50th time).

My second question is what would happen if I remove the delays. For instance if in the function:
Code:
void eHealthClass::readPulsioximeter(void)

If I remove the line
Code:
 delayMicroseconds(300);

Would it result in a wrong reading?


Top
 Profile  
 
 Post subject: Re: Arduino Uno, Delays on readings (e-health)
PostPosted: Tue Apr 11, 2017 7:26 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello Granit,

Code:
void readPulsioximeter(){ 
  cont ++;

  if (cont == 50) { //Get only of one 50 measures to reduce the latency
    eHealth.readPulsioximeter(); 
    cont = 0;
  }
}


In this code, only pulsioximeter sensor is taken every 50th time, not GRS sensor.

Code:
float conductance = eHealth.getSkinConductance();
float resistance = eHealth.getSkinResistance();
float conductanceVol = eHealth.getSkinConductanceVoltage();


These 3 functions are from GRS sensor, and you will get a different measure every time you use it.

We do not recommend eliminating the delays, since they are usually necessary for the sensors to work, however you are free to experiment and change the code by testing your own solution.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 4 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.