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: 

LabVIEW frequency measurement via Arduino UNO analog pin

Hi everybody,

I'm trying to realize a simple frequency measurement with Arduino Uno.

The connection between Arduino Uno and LabVIEW is ok, but the value of the measured frequency with LabVIEW is not correct.

You can see from the image that I'm generating a tone from the Arduino digital pin #8 with a frequency of 80Hz, but both the Tone Measurements and Spectral Measurements block gives me inconsistent results compared with  the input signal.

I tried to use different LabVIEW blocks but I had always the results.

I also tried different sampling frequencies and different number of samples.

Do someone know why? What can I do?

 

Thanks.

 

Problem1.png

 

 

 

Problem2.png

 

Download All
0 Kudos
Message 1 of 6
(5,636 Views)

Hello,

How do you communicate between your Arduino Board and Labview?

( via NI.VISA,  LIFA_BASE (LabView Interface for Arduino) )?

 

Could you please attach your VI (analog.vi) ? this would allow to know what is exactly happening inside of your code

Greetings and Regards,
James
0 Kudos
Message 2 of 6
(5,556 Views)

Thank you for the reply!

I'm using LIFA_BASE. Sure I can attach the VIs, here they are...

In my opinion, the problem is in the data coming from Arduino or there is a problem in reading data with the Continuous Analog Read block.

Download All
0 Kudos
Message 3 of 6
(5,546 Views)
I renamed Analog.vi with Frequency Measurement - 3.vi
0 Kudos
Message 4 of 6
(5,545 Views)

Hello,

Since I don’t have the Arduino board, I cannot simulate your signal for tests.

 

I would suggest that you first debug your code with the lLabVIEW debugging tools

Debugging on LabVIEW.jpg

Also insertion of Probe will show you the value (of the wire, cluster…) in real time.

select the wire >> Right Click>> Probe

Arduino, Probe.jpg

Like that you can see if the values you wanted to generate from your Board come as expected.

Greetings and Regards,
James
0 Kudos
Message 5 of 6
(5,528 Views)

Yes, I've already used the probes and the data that I see are not as I expect.

Since I'm acquiring a signal at 80Hz with a 5 kHz sampling rate, I expect 31 high and 31 low pulse samples, but what I see is 29/30 high and low pulse samples.
There is definitely a problem in the data acquisition, but I don't know whether from Arduino side or from the LabVIEW side.

0 Kudos
Message 6 of 6
(5,480 Views)