Spectral analysis of accelerometer data

Hi,

I wonder if any of you did already tried to implement spectral analysis... What I'm looking into is finding peaks around low frequencies - between 0.5 up to 2 Hz, meaning, sampling around 4Hz should be good enough...

Yet - it means - I'd need to implement FFT what could possibly kill the processor (or to be precise - consume a lot of power).

Why so - after a little of research my idea was to detect horse ride type basing on frequency (there are good research available over the net).

On the other hand - as these are quite low frequencies, I'm thinking that maybe simpler would do quick correlation check for specific frequencies...

Just wonder if any of you tried anything like that :)

  • Where do you see the zeros? In your input or in your output? I suppose it's in your input, so probably it's not related to any watchdog. I would first log the raw input to see if that part is OK. BTW what is your source? IMHO you'll only have meaningful HRI data if you connect a HR monitor strap, because the built-in optical sensor won't give you real data as far as I know.

  • Thank you for the answer! Well i have a fr965 and a fenix5x plus. I use both for training and i developed an app for spinning. In this app i tried to analize also some HRV data. Both clocks (no matters if external or internal HR sensor is used) collect a vector of HRI data as i said before 9 or 10 items each sensor sampling. The HRI seems to match the the measured  heart beat rate. I dont think that the:

                        heartRateData.heartBeatIntervals;
                        heartRateData.heartBeatIntervals.size();
    could fill the vector with non-real data. Why add these commands to retrieve fake data? Is it a non-sense!

    Anyway, i find the HRI vector filled with N intervals which are the input for the FFT. The output is a  2*N (real and imaginary) vector. With simple pow and average i can obtain the PSD (power spectral density). 16Hz/16 samples... i know but  i was interested on how far it could go...

    Although on the garmin simulator i can see the face of the PSD as it should be... on the real clock all the bins are zeroes or at least only the first is different from zero. I imagine that the simulator use a random-like generator  for HR and for HRI and i can imagine that the marvellous face of the PSD is due to the "simulation". What i did not expect was the totally zero values in the output vector. 

    In the very next days i will investigate more printing on the screen the vectors along the various steps. 

    you can try with the "drake's spinning app(1)" 

  • As far as I know when you use the optical HR sensor it calculates the HR and then it "simulates" the rrIntervals data. For example when the HR is 60 you'll see 1000ms. Check it. If it always exactly matches then its this fake data. In reality, when you use a proper HRM, for example a Polar h9 or h10 then it's done the other way around: it measires the rrInterval, and calculates from it the HR that you see. So with a proper sensor you'll see things like: 1003ms => 60Hz, 1008ms => 60Hz, etc. Most of the intervals in milliseconds will be different.

    I haven't looked into your algorithm, but I can imagine that using the incorrect (fake) input may cause strange things, maybe that's what you call all zeros.

  • I got it!! The watch is collecting a vector with max 3 or 4 items. Very often only 1 and not 9/10 as simulator does! Anyway HRI data is consistent with the heart beat retrieved. Now i m going to fill up a custom vector with at least 16 HRI values. It will takes some seconds but at least i will have a marvellous PDS!! I will try very soon the code on a real clock... 

  • Is your watch set to smart recording? Try to switch it to every second. What do you mean "consistent"? If it is it exact, like I wrote above then it's fake data.

  • Hello, thank you for the suggestion! i will try the "every second recordin". Anyway the heart beat intervals are variable and not a "simulated HRI". So knowing that the clock collects only 2 or 3 HRI at time i fill up a bigger vector (16 items) and i make the FFT math only when this vector is full. Now the FFT face looks good and seems to be correct. Now i'm going to check the results maybe observing the PSD (Power SPectral Density) of the HRI while resting and while doing the activity.