LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect the time between two peaks of data coming from an ADXL345 Accelerometer

Hi,

 

I want to detect the time (in seconds) between two peaks of data coming from my ADXL345 Accelerometer. How do I program that in LabVIEW. I am using LINX to read my accelerometer.

0 Kudos
Message 1 of 4
(2,917 Views)

I've implemented the method I found on this thread: Peak to peak time detection

 

My block diagram looks like this:

 

block diagram.png

 

I'd be glad to be corrected. 🙂 As I really don't know if I am doing it right or not. Any suggestion is appreciated. Thank you! 

0 Kudos
Message 2 of 4
(2,894 Views)

Hey JersonJose!

 

To get the time in between peak to peak, you need to make sure you are getting time stamps with the data for when it is taken. If you are sampling at a constant rate, this shouldn't be too hard to figure out. Then, once you have the peak amplitudes, you can find the corresponding time stamp with those peak values by searching the array of data for those peak values and taking the time data from those indices. Then you can subtract the times to get the time between peaks.  

0 Kudos
Message 3 of 4
(2,865 Views)

I can't tell exactly what you're doing there based just on your screenshot but as a general rule of sanity when you're trying to do anything complicated in LabVIEW, don't use the dynamic data type.  If there's a way you can remove all of the VIs that use it, I recommend that you do so.

 

Is that block diagram supposed to have placeholders or something in it?  As far as I can tell it looks like you copied the sine wave generator from the demo over without understanding what it does.  You should be assembling whatever data comes out of your device into a waveform yourself, not using it to feed the inputs of a sine wave generator.

0 Kudos
Message 4 of 4
(2,848 Views)