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: 

Arduino analog read pin to frequency

Solved!
Go to solution

Hi Craig,

 

I am using an ADXL 335 accelerometer with 500 Hz Bandwidth from Dimension Engineering (http://www.dimensionengineering.com/products/de-accm3d)

 

So I know that values over 250 Hz won't make much sense.

 

Arduino is set to 115200 baud rate to communicate with the computer, and its correctly reading the number of samples I am requesting for the FFT, at least in my opinion. 

 

Would it be possible to test the Complex FFT code I attached with the 10 Hz input and see if it gives something close? The vibratory motors I am using are just normal DC ERM pancake motors from Spark Fun (http://www.sparkfun.com/products/11008)

 

Thanks!

 

Here's my rig so far, still under testing, trying to figure out the best way to measure the vibration, although for now its just taping the accelerometer to the motor directly.

 

WP_000403.jpgWP_000404.jpg

0 Kudos
Message 21 of 33
(4,195 Views)
Solution
Accepted by topic author fubag

The input to the functions can be something simple, so I built a VI that compares the two methods. I used an example found in the Example Finder under Analyzing and Processing Signals, Signal and Noise Generation. The example itself was called Function Waveform Generation.

 

I attached the waveform output of the generator into both of the FFTs, see what you think of it.

 

Otherwise I like the setup!

 

 

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 22 of 33
(4,186 Views)

Hi Guys,

Any chance to get this example on LV2009...

Many thanks in advance

Y3G (...when there is LTE)

0 Kudos
Message 23 of 33
(3,992 Views)

I uploaded Craig's example for LV2009

 

Cheers!

0 Kudos
Message 24 of 33
(3,989 Views)

Guys,

Could you be so kind to add a code (vi) in LV2009, so I don't need to add a post.

 

Many thanks in advance,

Y3G (...when there is LTE)

0 Kudos
Message 25 of 33
(3,976 Views)

Hey Y3G,

The attachment that fubag posted in response to you post opens just fine in LabVIEW 2009 for me, could you try it again?

Regards,

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 26 of 33
(3,949 Views)

Thanks Craig

The Output test.vi works, I am looking for the Arduino part as well.

I wonder if the readout of the A0 is as fast enough.

Attached is a picture.

I am reading the A0 Analog out where I inject from a function Generator a 25 Hz square wave (20 ms On 20ms Off) and can only read out approx 4 samples per PulseHi (?!) that makes it 5 ms per Sample....That is really slow !!! Doing an FFT on 1024 sample would last 5.12 sec !! Am I missing something?

Thanks for any hints

0 Kudos
Message 27 of 33
(3,932 Views)

Hey Y3G, 

 

Firstly could you post your question in a new thread? If you link it I can look over it.

 

Secondly you are going to want to use the Continuous sampling functions of the arduino toolkit. Check out the example VI in the functions pallete under Arduino » Examples » Continuous Sampling Example:

Continuous Example.png

 

The continuous sampling will provide much higher sampling rates than calling the single point ones over and over. (Note that there is a finite example as well).

 

Regards,

 

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 28 of 33
(3,923 Views)

Thanks Craig,

I put a new thread/post under "arduino sample speed". The contON is limited to 5kHz....

Thanks for your reply

Y3G

0 Kudos
Message 29 of 33
(3,905 Views)

Hi Craig,

i  am modifying the example you suggested.

I am using the UNO although kimited to 5 kHz and I am feeding into A0 a up to 2.5 kHz (keep Nyquist alive 😉

There are several things I do not understand here from the FFT.vi

1) Is this VI already takes the left half of the FFT spectrum (=devides the samples by 2)?

2) For each 100 Hz  input SIgnal, I get in the  power Spectrum (frequency-axis) a deviation of 12 Hz (decrease), although the resolution is 9.77 Hz/BIN (=df). 

In the example picture I feed in a 200 Hz Signal and the peak indicates it on 176 Hz (=2*12 Hz decrease).

Where does this come from?

 

Amazing workon with this!!

Thanks

 

Download All
0 Kudos
Message 30 of 33
(3,871 Views)