LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog data from Continuous Sampling - Precision and Errors

     I'm attempting to set up a program which reads data in from one analog pin of the Arduino at 1 kHz, then saves and processes this data. I'm using a producer/consumer architecture to separate the processing from the reading, passing data via a queue. Arduino commands being used are Init (outside the loop), Continuous Acquisition On (outside the loop, set for pin 0 and sampling rate 1000) and Acquire Continuous Sample (inside the loop, set for sampling rate 1000, and I've tried this with it grabbing 10 samples or 1 sample at a time), and Close (outside the loop).

     My issue is that if I time the read loop (which should be running as fast as the data is coming on the serial port; there is no wait and I've done this with all other functions removed from the loop) with a numeric counter and my real-world stopwatch, the samples appear to be coming much slower than 1 kHz (somewhere between 500 and 900 Hz depending on settings). I could try to scale up the speed until I get the speed I'd like, but I felt like there was probably a better answer. Can anyone give an explanation?

     In attempting to debug this, I put an error-out indicator on the Arduino commands and saw error code 1073676294. The only documentation I saw on this pointed me towards Digital I/O pins, but I am not using any digital pins. I'm a newbie when it comes to data acquisition but am not afraid of learning. Any advice from those more experienced is appreciated.

0 Kudos
Message 1 of 4
(5,053 Views)

Hey Rackham,

Unfortunately the way the continuous acquisition is set up it is somewhat dependent on the speed of your PC. Since its all software timing its hard to get accurate settings to scale across all computers. I think the easiest solution is to figure out what that trend is on your machine and scale appropriately. That being said - the error you are seeing may be affecting it - can you tell which block it is originating in?

Kevin Fort
Principal Software Engineer
NI
Message 2 of 4
(3,248 Views)

I should be able to calibrate the speed appropriately, if that's something that is to be expected.

Thanks so much for the prompt reply.

As for the error, the error code seems to be coming from the send/receive block inside Continuous Acquisition On.

With an indicator on the Continuous Acquisition On block I have the error (1073676294) with the source:

VISA Read in LabVIEW Interface for Arduino.lvlib:Send Receive.vi->LabVIEW Interface for Arduino.lvlib:Continuous Aquisition On.vi->(my program)

As a further note, I just ran the Continous Sampling example vi and observed the same warning on Continuous Acquisition On's error line, so now I'm wondering if there might be something wrong with my interface to the Arduino, independent of my code, or if that warning code is normal.

0 Kudos
Message 3 of 4
(3,248 Views)

VISA:  (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available.

And this warning is idiot because it is saying you got what you wanted but maybe there is more.......

So ignore it

greetings from the Netherlands
0 Kudos
Message 4 of 4
(3,248 Views)