03-26-2019 06:28 AM
Hi,
I am trying to find the travel time between the start of the movement a hammer to impact. An accelerometer is attached to a hammer to obtain the signal. I use the trigger and gate function to obtain a block of samples when the trigger is detected (sensing the hammer started moving) . However, I am currently stuck on how to obtain the travel time using the block of data obtained. I tried using transition measurements.vi and other functions to no avail.
Solved! Go to Solution.
03-26-2019 07:31 AM
Attach your code, and attach a file containing data from the accelerometer (be sure we know the time base). If you don't tell us what you did nor what you found, we can't be much help to you.
Bob Schor
03-26-2019 09:46 AM
Hi Bob,
Attached is my VI. I am currently using bno055 to obtain the data through an arduino. Hope it helps you understand the problem.
03-26-2019 03:13 PM
Thanks. I made a small modification to your code (attached as Hammer Data) that takes the data you get from Arduino and writes it to a Text File (Hammer.txt). Could you please run this and use it to "capture" a data run from the time the hammer drops until it hits? This will show us something about the data, including the number of channels, number of points in a sample, and we can "look for ourselves" and try to understand the signals you are trying to analyze. I used a small "trick" that (I hope) gives nice tabular lines from the VISA data -- each VISA read gives a line of text, and by turning this into a 1D array (with only one row, of course), the Write to Text File automatically adds the EOL to the file. Here's a Snippet, and I'll attach the VI, as well --
Bob Schor
03-27-2019 01:41 AM
Hi!
Thanks for the reply. I ran your code and logged the data in the txt file and is attached. A very clean code to log the data in .txt :). I am still learning LabView but I think maybe because the signal from visa does not read sampling rate from the sensor, labview only reads what is given to it as a raw string without timestamp and the sampling rate in this case is the loop speed?
03-27-2019 02:23 AM - edited 03-27-2019 02:27 AM
Hi Baj,
I think maybe because the signal from visa does not read sampling rate from the sensor, labview only reads what is given to it as a raw string without timestamp and the sampling rate in this case is the loop speed?
The sampling rate is defined by your DAQ device - your Arduino! The Arduino reads the samples at a certain rate and sends the converted data to your computer…
On your data:
These are columns gX, gY and gZ: there is a change at index 18, followed by an event at index 41-45. If one would know the samplerate then one could calculate time from index (differences)…
03-27-2019 09:26 AM
Thank you for attaching the actual data file. I notice two things about this data file:
Bob Schor
P.S. -- I completely agree with GerdW (I almost always agree with him!) that the timing resides in Arduino. There's a lot of data being sent for each sample (lines contain >360 characters, which at a serial rate of 115200, or about 11520 characters/sec, seems to be around 30 Hz, or a measurement every 33 msec. I would think you'd want a more precise time measurement ...
03-27-2019 11:33 AM
Hi,
I understand that we can calculate the transition time manually if we know the sample rate. But I am trying to extract it automatically because impact will be performed multiple times per run and logged into a file. The RHS picture below shows the triggered signal (linyacc in my txt file) block of 30 samples and I aligned it with the waveform chart on the left, so sample rate as Bob said, is around 30Hz. Therefore if we take the end to end of the transition signal it will be approximately 16 samples which corresponds to 0.53s.
However I am still stunted on how to extract this automatically.
Right now what I am trying to do is using trigger and gate function to obtain a block of samples after it detects the trigger ( rising above a specified level) and trying to somehow use the data block to obtain the transition time from this time block (or samples which can be later converted.)
03-27-2019 11:59 AM
Hi,
Thanks for the clean up advice :).
The sampling rate is approximately 30Hz as you said (see my reply to GerdW) and we can calculate time manually but is there any communication between arduino and labview regarding the sampling rate?. and Is there a way to measure the time (or samples) automatically since the impact will be done multiple times.
03-27-2019 02:23 PM
Hi BAJ,
but is there any communication between arduino and labview regarding the sampling rate?
Not yet. You would need to program that in LabVIEW and your Arduino sketch…
I agree with Bob on that rather larger message you send from your Arduino: I would try to send those data in a more compact format (like binary with scaling done by your VI). This will improve the time needed for data transfer and may help to increase sample rate.
and Is there a way to measure the time (or samples) automatically since the impact will be done multiple times.