10-30-2019 02:55 AM
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.
Solved! Go to Solution.
10-30-2019 04:28 AM
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 ...
10-30-2019 07:05 AM
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.
10-30-2019 08:11 AM
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
11-08-2019 11:40 PM
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?
11-08-2019 11:52 PM
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?
11-09-2019 04:45 PM
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 --
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
11-10-2019 06:38 AM
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?
11-10-2019 11:58 AM
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:
Bob Schor
11-11-2019 11:03 PM
Hi Bob,
I found the solution to my problem. Really appreciate the advice that you given me.