From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analysis of Waveform Data using Digital Signal Processing

Solved!
Go to solution

Hi guys,

I am stuck for this part on the signal analysis. I have gotten the z-axis data for the accelerometer and it is shown on the screenshot that I attached. How do I transform the data acquired properly by using Fast Fourier Transform to analyze the signal?

 

The given VI now I used a FFT pt by pt analysis but is not working properly whenever I inject vibrations for the accelerometer, the amplitude remains constant at 100 the signature does not change. Could advise accordingly for this?

 

Thank you. 

Download All
0 Kudos
Message 1 of 11
(3,092 Views)

First: If you want to do meaningfull signal processing on acceleration signals you should use SI units 🙂

G?, g and even g_n or g_local are no SI units ...

If you get yor signals via serial and want to apply a FFT: Samplerate is known and constant?

(MEMS often use internal oscillators and are quite temperature sensitive 😉 )

Sorry, still stick to an older version of LV ... no chance to look into your code

try to collect the samples in an array, apply a FFT and compare it to the pt by pt ...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 11
(3,049 Views)

Hi Henrik,

the units is in acceleration g=9.81 m/s. The signals are via serial modbus rs485 RTUand the sample rate is a fixed frequency. 

Could you let me know your version of the LabVIEW, I will reupload it according to yours? Also, I uploaded the datasheet of the accelerometer that I am using.

 

Thanks.

 

Cyongjed.

0 Kudos
Message 3 of 11
(3,019 Views)

To do an FFT (Fast Fourier Transform), you need (a) data sampled at equally-spaced times (the frequency of sampling and the number of data points sampled determine the number of discrete frequencies and the lowest frequency in the spectrum, from which you can deduce the highest frequency), and (b) for the FFT to be "fast", the number of points needs to factor nicely, which is why the optimum N is a power of 2.

 

One generally acquires, say, 1024 points at a time, then hands those points off to an FFT which returns a representation of the spectrum of the data (you can plot this in various ways).  The next 1024 points will (probably) give you a slightly different spectrum, due to noise and possible changes in the underlying signal.  Except in certain specific cases (like getting a "voice print"), re-doing the spectrum as each point comes in rarely makes sense.

 

I recommend re-designing your code, possibly using a Producer/Consumer Design, into an "Acquire N (ideally 2^n) Data Points" (Producer) and "Do an N-point FFT and display results" (Consumer).

 

Bob Schor

 

Bob Schor 

Message 4 of 11
(3,004 Views)

Hi Bob, thanks for the advice given, but I have some queries for you here. So if I wanna use the FFT pt by pt given my sampling frequency is 20 Hz, the sample length I used would be 1024 in this case? I am quite confused by this. I have attached a screenshot here, where the FFT is done using pt by pt. However, when I turn up the vibrations level of the testing unit, the recorded spectrum before 512 instead moves to the left instead of the right which shouldn't be the case. Am I doing my VI wrongly for this FFT Pt by pt? 

0 Kudos
Message 5 of 11
(2,973 Views)

Hi Henrik,

sorry for the late reply, I uploaded a new version of the LV2012 for the VI in a new message I posted, the sampling rate is known and constant at 20Hz, so for your suggestion I build a for loop as attached in the screenshot?

0 Kudos
Message 6 of 11
(2,970 Views)

OK, you attached your VI (thanks), and I think I know a bit more about what you are doing, though I'm not sure I understand what you are trying to do.  I also think, based on your questions and comments, that you don't quite understand signals, sampling, and frequency analysis.

 

Here's what I'm "guessing" from the code you posted --

  • You have an instrument that can acquire data from an accelerometer.
  • You have a tri-axial accelerometer.
  • You get data using a Modbus Protocol.
  • You mention a sampling frequency of 20 Hz, yet your VI shows a Frequency chart/graph going up to 500 Hz.

I have no experience with this Protocol.  However, I do know about Signals and Sampling.  I'm worried that there's too much that either you or I don't understand about what you are doing.

 

What is the question that you are trying to answer?  I know that it involves an accelerometer -- to what is it attached, what is causing the acceleration, what do you think is the "question" you are trying to answer (or the data you are hoping to see)?  Are you looking at something that is more-or-less periodic (such as a vibration that you record while a motor is running) or transient in nature (like the vibration pattern after you hit a beam with a hammer)?

 

In order to record signals and subject them to time and frequency analysis, you need to acquire data (i.e. X, Y, and Z accelerations) at a known sampling frequency (which needs to be higher, at least a factor of 2, usually more like 10, than the highest frequency of interest in the signal).  You don't say anything (or I didn't read it carefully and don't remember what you wrote, sorry ...) about the instrument taking the data, and how you get it sent to your LabVIEW routine (except that it involves Modbus, a protocol I don't know).  But if you have a graph showing a frequency of 500 Hz, then your sampling rate must be at least 1 kHz.

 

Is your sampling continuous or intermittant?  You are sending data via a Protocol, suggesting you are gathering "a bunch" of data (amount not specified), sending it, getting another bunch, sending, etc., but is the time difference between the last sample of the first bunch and the first sample of the second bunch the same as the time difference between pairs of points within the sample?  [That would be "continuous" sampling].

 

Let me give you a more specific example.  I'm going to assume you've got a "noisy motor" that is running at a constant speed, but vibrates too much.  So let's record at 5 kHz, and acquire 1024 points (why not 1000?  The FFT works best with powers-of-2).  This will take 1024/5000 = 0.2048 seconds.  I compute the spectrum of this signal, which gives me power, or gain/phase, or something, at 512 frequencies from roughly 5 Hz (1/0.2048) to 2.5 kHz (half the sampling frequency).  If I am interested in higher frequencies, I sample at a higher sampling rate; if I am interested in lower frequencies, I sample for a longer time.

 

I do not do a point-by-point FFT.  I'm not 100% certain I understand where this would be useful (there are better routines for studying time-varying spectra, but that's a more complex topic).

 

Bob Schor

0 Kudos
Message 7 of 11
(2,951 Views)

Hi Bob,

Thanks for the reply, really appreciate it. From the strings in hexadecimal from the Modbus Registers which in this case the sampling is continuously acquired, I converted them to numbers and minus the offset (in the SubVI) that I called to get the X, Y, Z out respectively in terms of G (9.81). I am quite new to this signal processing couldn't fully grasp the concept of it but I am tasked to do it for my capstone project. Your 4 assumptions are correct

Questions I have:

1) Output Rate of the Accelerometer Digital Signals = Sampling Frequency am I right to say that? I am confused by this too.

2) If I don't do point by point, how can I go about doing the Normal FFT?

0 Kudos
Message 8 of 11
(2,936 Views)
Solution
Accepted by topic author cyongjed

Remember -- I am unfamiliar with the Modbus Protocol, so I have no idea how the accelerometer data are being sampled and how you are acquiring the data.  I find it amazing that as part of a capstone project, you can't provide definite answers (or provide sufficient details, such as manual pages, setup parameters, etc. for me to figure it out myself) to questions such as what sampling rate you are using.  So here are some questions that you should answer:

  1. What are you measuring?  I know you are using a tri-axial accelerometer, but I don't know if you are measuring orientation (tape it to a helmet, have subject wear helmet while walking around), vibration (and of what, for example, electric motor rotating at 400 rpm), or impulse activity (impact hammer).
  2. What question(s) are you asking about your device?  How does the concept of "time" and "repetition" enter into your question?  For example, are you interested in how a building sways during the course of a day, or comparing how the vibration of a motor depends on the RPM at which it spins?  Don't be afraid to attach the "Introduction" material for your Capstone report.
  3. If you still don't know how to answer the question of what Sampling Rate you are using, someone is either doing a very poor job in teaching Engineering or a very poor job in learning it.  Make a concerted effort to determine this critical parameter -- talk to your fellow students, or talk to your instructors.

Bob Schor

 

 

0 Kudos
Message 9 of 11
(2,914 Views)

Hi Bob,

I found the solution to my problem. Really appreciate the advice that you given me.

0 Kudos
Message 10 of 11
(2,886 Views)