DASYLab FFT SCRIPT - How To Compute Frequency Using DASYLab and The USB-1208HS
DASYLab FFT SCRIPT - How To Compute Frequency Using DASYLab and The USB-1208HS
ly/aM0Pqj
This short video will show you how to use DASYLab to acquire data and perform frequency analysis on it. I will show you how to
capture the waveform, compute the frequency domain, and extract the peak frequency and its amplitude.
DASYLab Basic, Full and Pro include the Digital Filter, Data Window and FFT modules. DASYLab Pro includes additional signal
analysis features, including the Transfer Function and the Universal Filter modules. For this video, I will use features that are in
DASYLab Basic and DASYLab Full.
I am using a USB data acquisition device from Measurement Computing, the USB-1208HS. It is a 13-bit device that can sample up to
one million samples per second.
First, create an analog input module from the MCC-DRV group. Select the desired channels. Now right click. Click module properties
to open the property page.
Change the Measurement settings. The default is 100 Hz. And I want to sample at ten thousand samples per second. I’ll change the
block size to one tenth of the sample rate, or one thousand samples. Click ok to close the properties.
I always select a display module to show my raw data, so I’m going to drag out a Y/t Chart. The Y/t Chart is similar to an oscilloscope
in that it has a refresh display. I’m going to resize it so it fits in the recording window. And then hit start
And what you can see is that I’ve got a waveform, a square type wave off of a signal generator device. I'm able to change the
frequency. I’m looking at a tenth of a second or 100 ms at a time. Now hit stop.
Minimize the display and go to the Signal analysis group to add an FFT module. The frequency module allows you to do a variety of
functions. I’m just going use the simple Real FFT of a real signal. I’m going to connect it.
Now I need to add another display. I’m going to add another Y/t Chart display. I’ll drag out the Y/t chart, connect it up, and restore it.
I’ll need to resize this one too, to fit into this display area.
You can see that out that the frequency analysis data showing already. It’s showing minus 5 to plus five. I’m going to use the Y/t
Chart feature to auto scale. To change the display type, I’m going to click on the paintbrush button and change the line type of the
input from solid to bars. This will give you a sense of the frequency resolution as well as the frequency peak
If you zoom in on this you can see the resolution of the frequency display is associated to the block size and right now the resolution is
10 hertz.
If I change the frequency of the signal generator, it’s going to go up and it's going to go down. You can see that how it's changing.
Depending on where it is on the frequency spectrum it may be smeared. The energy may be smeared over a couple of frequency lines
before the peak.
The next thing to do is to find the amplitude of this frequency and also the frequency line that the peak associated with, because that’s
the largest peak, the maximum peak.
I’m going do that by going to the Statistics group and selecting Statistical values. I’ll branch from outside the FFT to the Statistics
module and I’m going to select this initially to collect the maximum and then click on the plus sign to add a second channel. This
channel will be the maximum position.
The position in a frequency block is the frequency. The position in a time domain block would be the time.
I now have two inputs because I selected a second channel. I’ll branch to connect to that. The statistical values module outputs one
sample per block. The easiest way to look at that is to put up a digital meter. I’m going to add a channel to that. Connect it up.
Restore all of the displays. Put the digital meter over here. And now hit start.
You can see right now the peak frequency is 230 hertz. As I move my signal generator up and sweep across the frequency, now I’ve
got 2200. You can see as I'm adjusting it in fine increments the increment that is changing is ten hertz at a time.
To change the resolution of the FFT, for example to increase it, you need to change the block size that the data is being collected in.
Hit the stop button. Go to the Analog Input module, click on the Measurement button. Modify the settings so that the time base
settings match the block size settings. In other words, you want to collect a full seconds worth of data in order to get a resolution of
one hertz. I’m changing the block size to 10,000. Close the dialog box.
You can see that the frequency line is a much sharper frequency line. If I do this now [If I change the frequency], you can see that the
peak frequency is 2256. If I move the sweep slowly, it decreases in smaller increments. Instead of seeing 2230, I’m seeing 2233, 2211,
or 1739. I’m looking at the frequency down to a resolution of one hertz.
There’s another way to do this that doesn’t involve changing the original acquisition.
Press the stop button. Minimize the displays. Change the Measurement back to the original setting of 1000 samples. A thousand
samples lets me have a time update rate of ten times a second, so the screen stays very snappy.
I want to collect the samples together to make a larger block to go into the FFT. Move the Analog input back to give some room.
Remove the wire by right clicking on it. Add a Data Window module. The Data window module will connect from the Analog Input
and to the FFT. Double click on it to configure it. I’ll use the default rectangle window. You can see that there are other weighting
algorithms to use.
I need to change the block size. The defaults are powers of two, but you can type in 10,000. I don’t want any amplitude correction, so
select No correction. This will revector the data without changing it in any way.
When I hit the start button, you can see the resolution of one hertz. I am seeing the frequencies down to a single hertz value as they
change.
For a copy of this worksheet and to see the full version of the script, please visit our Knowledge Base article at: http://bit.ly/UKrD0T