1

I mostly need a general algorithm which i will afterwards port on my system (an Arduino board), but i'm glad to get even a hint to continue the research in other directions;

I have a set of around 650 samples covering 5 seconds representing a periodic signal but with quite a lot of noise; The samples are from a TAOS230 light sensor and the signal is the transparency of the human skin based on the blood flow.

I need the frequency of the main/dominant signal which is actually the human pulse. Samples look similar to this https://www.dropbox.com/s/fw196r6yf1awhrh/untitled2.bmp

Here you have a dump with around 5k samples https://www.dropbox.com/s/efwvyn5oec7ixgg/samples.txt

Thank you,

Alex

user1411688
  • 31
  • 2
  • 3
  • 2
    Compute the power spectrum and look for the largest peak in the range 0.5 Hz - 3 Hz ? – Paul R Jun 10 '12 at 19:16
  • FFT is too dificult for arduino. use autocorrelation instead, is an old algorithm but useful. see: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1143061795 – uDalillu Jun 11 '12 at 06:05
  • 1
    @Eudaid: at such a low sample rate an Arduino should have no problem running an FFT-based algorithm in real time with plenty of compute bandwidth to spare. – Paul R Jun 11 '12 at 10:30

1 Answers1

0

Something i did for arduino quite often is to use a function that averages the input data like

newx contains new sample data

 x = (9 * x +newx ) /10

This dampens signal, Also note that poor soldering is also related to high noise levels, check that too.

A next step would be to define the real average you might then count how many times you go above/below to retrieve the frequency, And i would do that by defining it like -n below or +n above. That's a bit fuzzy implementation but will work. (otherwhise if you dont use some distance n from the average you get many false positives on samples in the average.

Make the function so that it only counts the state changes in pseudo code :

#// counting state changes
if ( state > avg_state + n ) and (oldstate = -1)  {statecount++ : oldstate = +1 } 
if ( state < avg_state - n ) and (oldstate = +1)  {statecount-- : oldstate = -1 }

its perhaps a bit simple (no FFT) but its often that simple things work well.

user613326
  • 2,140
  • 9
  • 34
  • 63