LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast Fourier Transformation and Arduino

Hello, 

 

I'm new at this forum, so if I posted topic in a wrong place, sorry! 

I'm a student and recently I'm doing project of virtual interface for measuring and analizing frequency of sound. So I have arduino and microphone. I'm using Arduino Uno 8bit converter to transform analog signal from microphone into digital and writing it into a text file. 

Now I need to do some further step to obtain frequency of the sound. And here is the problem. I was thinking of using FFT method, but when i tried to copy blocks from NI instructions, i somehow failed, and I don't really know where. As well i was trying to create subVi for reading data from .txt file and converting it to other type of data, but i think that i'm still missing something important, cause there's the same situation.

I'm attaching picture of my code. 

I need to get data from .txt file, put it trough FFT, create wavegraph and obtain frequency to display. Maybe I choosed wrong method as well? Maybe there's easier way to get all of this? 

0 Kudos
Message 1 of 14
(3,165 Views)

You have 2D arrays and you are trying to run 1D functions on them. What does your .txt file look like? I can help if I have a little more detail.

Message 2 of 14
(3,155 Views)

@heath89 wrote:

You have 2D arrays and you are trying to run 1D functions on them. What does your .txt file look like? I can help if I have a little more detail.


Okay, i have it. Kod2.png is actual code, thanks for this one thing. SubVi.png is how i converted string do proper array from file data (signals.png). 

The code now is not exactly what i wanted to have, but i needed something to test LabView - arduino communication.

And it doesn't work. I mean, i'm writing data to file trough external program CoolTerm, and now it occured that while i have launched LabView, CoolTerm have no access to COM port, and I can't even start with anything.

Anybody knows solution for that? I mean, is there any way to change some settings in LabView to not block the COM port or maybe I can write data from arduino to file without any external programs?

Download All
0 Kudos
Message 3 of 14
(3,145 Views)

the problem may lie in the subVI. You will always get an array with just a single element out. Your "number of samples" control will not get out what you are expecting. Are you trying to read out the .txt file and put the first n numbers into an array?

0 Kudos
Message 4 of 14
(3,137 Views)

Try this snippet for your subVI. There may be other problems, but this should fix some of it. The way it works is that if you set the samples to be a negative number then you will get all samples from your text file.

Message 5 of 14
(3,134 Views)

@heath89 wrote:

Try this snippet for your subVI. There may be other problems, but this should fix some of it. The way it works is that if you set the samples to be a negative number then you will get all samples from your text file.

 

 

Okay, thank you very, very much, it's solving problem of reading data from file. And yes i was planning to insert in array defined number of samples to provide fft with a number that is exponentiation of 2. But anyway data's are limited by code of arduino so that's no longer needed.

 

But still there's this problem with blocking CoolTerm with creating, and writing data from arduino to needed file. Do you think I should search for other place for this problem?

0 Kudos
Message 6 of 14
(3,128 Views)

Is there a reason that you are reading from the arduino with CoolTerm instead of LabVIEW ?

0 Kudos
Message 7 of 14
(3,119 Views)

@heath89 wrote:

Is there a reason that you are reading from the arduino with CoolTerm instead of LabVIEW ?


Hmmm it's becouse i don't know other solution for that. 

In my project, I need to gather signals from microphone, convert it, put on graph and get frequency of sound. It's supposed to work as device to control guitar strings sound. Is there a way to gather data from arduino converter in LabView? I've truly never heard about it.

0 Kudos
Message 8 of 14
(3,112 Views)

this shows how you could read from the arduino.

Message 9 of 14
(3,110 Views)

@heath89 wrote:

this shows how you could read from the arduino.


Woooah, i didn't know that there is this kind of option, thanks!

But shouldn't be there a block to convert analog data into digital? I know more or less how fft works with digital, but i don't understand connection to analog data Smiley Sad 

0 Kudos
Message 10 of 14
(3,058 Views)