LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT HELP: Synchronization of Multiple Devices

To whom it may concern,

 

I am relatively new to labview so I am sorry if I use the wrong terminology.

 

Here is all of my equipment:

DAQ USBX-6341 board.

Cameras (plugged into digital p0.0 channel/port)

Force Sensor (plugged into analog channel/port 1)

Test Machine (plugged into COM5)

 

 

Currently,I am sending in a trigger to the camera to start taking photos. This trigger takes 2 miliseconds and then the labview program tells the forcesensor and testing machine to start. This creates a delay between the camera, force sensor and testing machine. THis makes it difficult to analyze data.

 

I want the testing machine, cameras, and force sensor to start taking pictures at the same time. I was told that the best way to do this would be to send in a square wave at my desired sampling rate (ex. 15,000) into the DAQ. This would synchronize everything so that it started capturing data at the same time once a trigger was sent in.

 

Is this the easiest way to accomplish that goal? Is there an easier way to do this?

 

Thanks

 

gcass

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

Hi gcass,

 

It sounds that what you're looking for is a deterministic system response. Determinism is the ability to say that at a certain point in your program, a certain function will happen within a certain amount of time, plus or minus some variation (Jitter). On an Operating System that isn't Real Time oriented, deterministic responses i.e. getting your 2ms long trigger to execute and then simultaneously begin the acquisition can't happen; this is because the OS gets in the way because of the way it schedules tasks.

 

For example, the same program can have two different timed responses for when you're running no programs in the background and when you're running an Internet browser. Even when the OS isn't running any background tasks you still cannot be absolutely certain that some other processor time is being used. Unfortunately, this is the limitation of a conventional OS; the processor's power is shared between multiple competing threads which have equal priorities. Furthermore, USB devices aren't deterministic either due to the serial protocols that they follow, which in their nature are indeterministic.

 

You can only really implement some coarse timing in a traditional OS, whilst remembering that the absolute maximum output rate an OS could achieve is 1kHz. This is where Real Time Operating Systems come into play; these allow threads to be scheduled in a way that the co-ordination of particular tasks can occur at precise periods in time. In order to achieve the response you're after you'd need to use an RTOS based implementation; this is offered on devices such as the Compact RIO or PXI. You can learn more about these products here.

 

However...
 

I may be a little unsure about your application, so please correct me if I'm wrong, but I believe you could synchronise your DAQ tasks by driving different DAQ tasks by the same sample clock; this will allow tasks to operate simultaneously as they're both triggered by the same driving clock. I've answered a forum question with a similar implementation of driving two tasks with a single clock; the same can be done for a third task (You're trigger on the first edge).

 

 

So, the difference between these two points depends on just how you want to acquire your data; because there are limitations imposed in applications such as these with indeterministic systems. Your choice depends on how quickly you need to analyse your data; however if you only want to synchronise the output trigger and the clocking then I suggest the former solution. 

 

I hope this helps!


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 14
(3,140 Views)

L.jpgR.jpg

0 Kudos
Message 3 of 14
(3,127 Views)

Above is two screencaps of my current code that I am running.

 

I want to synchronize/drive the cameras/force sensor with the same clock so that they collect data at the same time and thus I can match up a picture with the related force value.

 

Looking at the example you provided, I think that the following example might be better:

 

examples\DAQmx\Synchronization\Multi-Function.llb\Multi-Function-Synch AI-AO-Ext Dig Trigger.vi

 

The description is:

 

"This example demonstrates how to continuously acquire and generate data at the same time, synchronized with one another, started by an external digital start trigger. "

 

I have the following equipment:

Cameras (plugged into digital p0.0 channel/port)

Force Sensor (plugged into analog channel/port 1)

Test Machine (plugged into COM5)

Digital Pulse Generator 

 

If I altered the example : "Multi-Function-Synch AI-AO-Ext Dig Trigger",

 

My trigger source would be the Digital Pulse generator.                Correct?

My AI VOLTAGE would be the force sensor.                Correct?

I would replace the AO VOLTAGE with a DO VOLTAGE for my cameras. Correct?

 

Then I would need to add in my testing machine, which runs via:             VISA CONFIGURE SERIAL PORT.

 

How would I synchronize this? Would I simply put it in the same flat sequence structure or ???

 

Does any of this sound plausible?

 

Thanks

 

gcass

 

 

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

Hi gcass,

 

What Alex said is very accurate.  To expand a little bit though... You can sync your DAQ inputs/outputs but with a windows OS, you cannot sync your test machine or anything else external without experiencing the inherent jittle of the OS.  You can find a video explaining DAQ synchonization here.

 

 

I would replace the AO VOLTAGE with a DO VOLTAGE for my cameras. Correct?  

My trigger source would be the Digital Pulse generator.                Correct?

My AI VOLTAGE would be the force sensor.                Correct?

 

From what I understand, these statements are all true.  The one thing I might note, however, is that a trigger only occurs once.  I'm not sure what you are trying to use the digital pulse generator for but the trigger will be used to start your AI and DO simultaneously. 

 

You could then put your read and write DAQmx tasks inside a while loop with your VISA write.  This will allow it to operate "simultaneously" with your other equipment.  I use quotes because, as Alex described, it will not truly be simultaneous.

 

I hope this helps clear a few things up!

 

Thanks,

Trey C.

0 Kudos
Message 5 of 14
(3,088 Views)
What could I use as my trigger source? I was thinking about using the pulse generator as the trigger.

Is there an easier way than using the digital pulse generator.
0 Kudos
Message 6 of 14
(3,073 Views)
See above comment
0 Kudos
Message 7 of 14
(3,070 Views)

@gcass wrote:
What could I use as my trigger source? I was thinking about using the pulse generator as the trigger.

Is there an easier way than using the digital pulse generator.

You can use a Counter terminal to generate a digital trigger on command; you can adjust the duty cycle and frequency of the trigger through pulse generation.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 8 of 14
(3,050 Views)
0 Kudos
Message 9 of 14
(3,031 Views)

Above is my newly designed code.

 

I am using the example Multi-Function-Synch AI-AO-Ext Dig Trigger.vi  as a starting point. 

 

I have a digital output (cameras), analog input (force sensor) and a VISA serial (test machine).

 

My main goal was to start them all on the same trigger signal.

 

I am still having issues regarding a trigger signal.

 

I was  told that I could accomplish this via using a counter output to generate a digital trigger on command.

 

I built a 1 ms, 1 pulse output via a counter output. I tried to use this a trigger source in my code but the data types were incompatable.

 

I think that my code (see attachment/pictures above) are synchronized, but I cant figure out my "trigger source." Can i the digital trigger made from the counter output as my trigger? 

 

I also have a digital pulse generator (see posts above) that I could use. If i were going to use that, how would I? Since I only want to send one pulse to trigger everything to begin at the same time, wouldn't it be excessive to use this pulse generator? I also have an oscilloscope that I could use.

 

Any help on this matter would be great. Thanks so much for your help already.

 

 

gcass

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