LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQ reading accelerometer - seems to choke up following addition of savitzky golay filtering

Hi all,

 

I have a program I have written to read continuously in a while loop from an accelerometer using NI-DAQ VIs.

 

The program is a bit complex but basically, after a 'no movement' baseline period, I want to see when acceleration goes over a threshold (i.e. a large enough movement occurred) this will trigger a sound, run for a few more seconds, then stop reading the accelerometer (I also log the data, and do some calculations on it after accel has stopped).

 

This was all working fine until I added a savitzky golay filter to smooth my signal. Now, everything works some of the time, but other times I can tell something is wrong as it starts going very slowly or will terminate the recording when it shouldn't (i.e. when no movement trigger has happened to stop it).

 

I presume maybe the filter is overloading some computational capacity, but I am not sure how to tell - as the error is quite erratic.

 

I am new to labview [first program] so I can't *really* understand what is wrong from looking in debugging mode, or anything else I tried. Would anyone have any ideas what is up? Big apologies in advance also - I know my code is certainly not the most efficient, or pretty. I know I should be using sub-VI's to make everything neat but while I am still writing I like to see everything in front of me.

 

Any help would be very very much appreciated! VI is attached (and the .wav file it plays)

 

Thank you!

Harriet

0 Kudos
Message 1 of 1
(2,065 Views)