LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Multiple Aquisition Data Sampling

I'm having a problem with aquisition data sampling of multiple analog signal through an Arduino Uno. Although I have two graphs, both graphs shows only the voltage of one pin. I need to see the signal of both pin "at the same time" for analyzing the output signal for my physic project. Any advice would be a great help

Fransiska

0 Kudos
Message 1 of 8
(5,964 Views)

FransiRaith,

Continuous acquisition is not meant to read from multiple pins.  It was intended to allow you to sample one AI pin very quickly.

I'm actually a bit surprised that you are able to run your program at all.  When you call the LIFA init vi it 'opens a connection' to the Arduino.  You cannot (or rather should not) open multiple connections to the same Arduino. 

Try using the analog read port VI in a loop (also use shift registers on your error wires).  If this is not fast enough you may need to create a custom command that reads x samples from the user specified pins.  Let us know if you need more guidance on this.

Thanks,

-Sam K

LIFA Developer

Message 2 of 8
(3,497 Views)

Thanks for your reply, I'll try it

0 Kudos
Message 3 of 8
(3,498 Views)

good day, it is possible that the problem you have with the acquisition of data is due to a race condition, could make the first acquisition and after a delay of a few milliseconds the second reading

1.png

2.png

attached some links related to the management of these conditions, good luck

http://www.ni.com/white-paper/7585/en

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/using_local_and_global/

http://forums.ni.com/t5/Discusiones-sobre-Productos-NI/Problemas-con-la-adquisicion-de-datos-de-un-j...

0 Kudos
Message 4 of 8
(3,498 Views)

Hey Sam,

I am having the same problem. I need to collect 15 analogue measurments and send 5 digital output synchronously with a sample rate of 0.01 sec. What do you suchest me to do?

You mentioned one might be able to do that by "createing a custom command that reads x samples from the user specified pins"... could you please give an example of that?

I can use multiple arduinos if you think it will help.

Thank you very much

Hesam

0 Kudos
Message 5 of 8
(3,498 Views)

Hey Hesam,

When you say 'Synchronous' what exactly do you mean?  Would it be acceptable to sample 15 times in a row and then write 5 values in a row if each operation takes ~1 uS for a total of 20uS?  The arduino doesn't have a way to synchronize all of the AI or DIO so the best you can do is serialize the operations and make them as quick as possible.  NI makes DAQ hardware that allows you to synchronize channels so that they actually acquire or output values at exactly the same time if that is what you really need.

Are the 15 measurements all on the same pin / channel or are there 15 different pins?  Do you need this process to execute every mS forever or a fixed number of iterations then stop?  If you can explain a bit more what you need to do I can provide some recommendations.  (also, out of curiousity, what are you working on?)

Thanks!

-Sam K

0 Kudos
Message 6 of 8
(3,498 Views)

Thanks Sam for your prompt response. We do have NI PXI chassis system that we can use. But this time we are looking into setting up a cheap DAQ and control system for a tabletop battery management system. Therefore we would like to use Arduino with that. And if "sampling  15 times in a row and then write 5 values in a row" is the only solution and each operation takes ~1 uS for a total of 20uS, then that is fine because we need a step time of around 1 ms for our operation.


Also about your questions:

- Are the 15 measurements all on the same pin / channel or are there 15 different pins?

+ Our measurements (voltage of the batteries) need to be acquired with 15 different pins.


- Do you need this process to execute every mS forever or a fixed number of iterations then stop?

+ We need to execute the process for a number of iteration every ms.



-  If you can explain a bit more what you need to do I can provide some recommendations.  (also, out of curiousity, what are you working on?)

+ We need to measure 15 AI signals (Battery voltages and tempratures) on separate channles and send 5 DO signals to 5 fans to cool the system down which work with an on-off switch.


thank you very much

Hesam

0 Kudos
Message 7 of 8
(3,498 Views)

Hesam,

One option is to create a custom LIFA command that reads the 15 pins and writes 5 values each time you call it, or a given number of times each time you call it.  Do you need to get the 15 values back to LV every 1 mS or could you, for example, read the 15 values at 1ms intervals and return data once every x intervals (say return 50 sets of 15 samples?)

Can you explain more about the overall system, how the values are actually used so I can get a better understanding of the timing, and what is used for control vs logging.

Thanks

-Sam K

0 Kudos
Message 8 of 8
(3,498 Views)