Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

imaqdx nidaq

Solved!
Go to solution

Hello,

 

I am a LV newbie, so your patience is appreciated 🙂

 

I posted in the labview boards but given that I am working extensively with imaqdx I figured I should post here too.

 

I am working with a Prosilica GE 680 gigabit camera linked to my computer via Intel PRO G/T 1000 and I am also working with an M-series NI-USB 6212 BNC. Connected to the ni-daq is a light source on each of AnalogOut0 and AnalogOut1 as well as 3 analog inputs: two of the three are reading from the analog outputs, the other input is a signal from the camera saying whether it is imaging or not. 

 

I have been debugging someone's code that is no longer around to help. The code essentially allows the user to synchronize two things: 1) The capturing and saving of a number of avi's of specified length, which in my hands is typically 2 sec movies at 200fps AND 2) Turning on and off two light sources at specified times during the movie. The problem is in the precise synchronization of the light sources with the camera exposure period.

 

As of now the light sources turn on and off during my movies, which is good. The problem is that the camera turns on late relative to the start signal as evidenced by the "imaging" output signal sent by the camera into one of the analog inputs. The result is that the lights appear to turn on early in the saved avi's since the movie starts later than specified. This is not ideal.

 

What changes do I need to make to the labview code to make sure that the camera is precisely synchronized with the analog outputs?

 

Thanks and let me know what info you need from me.

 

-Alex

 

0 Kudos
Message 1 of 9
(4,688 Views)

If you have an imaging signal, use it as a trigger to start the analog signals.  Everything will be timed perfectly.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 9
(4,676 Views)

Thanks for your reply Bruce,

 

I've considered your suggestion and now I realize that the program may already be doing this. Let me know whether you agree. Same goes for anybody else following this thread.

 

I should point out that my original hardware description was incomplete. I now see that the camera sends its imaging signal to a t-connector BNC on PFI0. The other arm of the t is connected to the analog input and this is what indicates the imaging signal. So it appears there is a PFI already reading the imaging signal. This PFI is called by the program as a trigger source for a "Start Digital Edge" daqmx function for the analog inputs. It looks like this is then used to trigger the analog outputs. 

 

Let me explain why I think so. This Start Digital edge for the analog inputs has a task out to a "get device terminal prefix" which retrieves the ai/starttrigger terminal name. This starttrigger terminal is then used as the source for the "Start Digital Edge" daqmx function for the analog outputs and for the counter. So there is a software wiring from the PFI0 to a starttrigger terminal to the analog outputs plus counter terminal. 

 

So through this chain of logic it looks like the code already uses the imaging signal to trigger the analog signals. Yet the analog input readout still starts 75msec before the imaging signal from the camera. Any thoughts as to why?

0 Kudos
Message 3 of 9
(4,653 Views)

From your description it sounds like it is triggering, but it is difficult to be sure without seeing the code.

 

After noticing you posted the code, it looks like they tried to use triggering, but it doesn't look right.  Usually you set everything that needs to be triggered and start it, then set up the triggering event and start it. It doesn't look like this is being done in the code.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 9
(4,645 Views)

Hi Bruce,

 

I'm not sure what you mean. I can set what I want to be triggered on the front panel, then I think the start button value change is the triggering event. 

 

Are you saying the event structure subdiagram "start value change" does not include a trigger for the analog outputs and the counter? Or perhaps that one cannot properly set up the triggers using the front panel? 

 

Thank you for your patience,

 

Alex

0 Kudos
Message 5 of 9
(4,586 Views)

Hello,

 

I have made some progress in defining the problem. The camera is sending small signals to the PFI which initiates the daqmx task before it begins imaging. I've attached a picture of the camera signal (white line) and the analog outputs (red and green lines). 

 

I think if I wait to until the imaging signal is steady to start the task then my movies and my analog outputs should be synchronzied with the timing that I specified.

 

So my question now is how do I trigger the daqmx task in response to a steady input rather than small fluctuations? 

 

Alex

0 Kudos
Message 6 of 9
(4,570 Views)

Pushing the button on the screen is a software trigger.  It doesn't work well for sychronizing hardware.

 

A hardware trigger is an electrical signal used to synchronize the hardware.  With this type of signal, the acquisitions can start within microseconds of each other.

 

One method is to use the start of one task to generate a signal, and trigger the other tasks from that signal.  For example, you could use the analog input conversion clock to trigger the first image.  Similarly, you could use the first image clock pulse to start the analog task.

 

The other method is to use a separate signal to start all the tasks.  You could generate a single digital pulse that would start both the analog and image tasks.

 

Look at some of the examples that do triggering of multiple tasks.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 7 of 9
(4,564 Views)
Solution
Accepted by topic author areeves87

Hello again,

 

I have solved the problem. It was a hardware issue. Using SyncOut2 instead of SyncOut1 on my Prosilica GE 680 camera gave me the timing that I specified. No major code edits were needed, other than the edits to support the hardware change.

 

The question still remains as to why SyncOut2 works and SyncOut1 does not. After consulting the technical manual for the camera I realized that using SyncOut1 requires that I use the isolated ground on my camera's 12 pin IO connector. Although I am an electronics novice, it seems to me that this would require a line going from the isolated ground to my DAQ external circuit ground. I did not do this, although I did when I tried SyncOut2. This missing connection may have affected SyncOut1's ability to send a trigger to the DAQ.

 

The reason I started with SyncOut1 is that it is a SMB-to-BNC connection that appeared to be a convenient way to get the camera to trigger the DAQ. Yes, I was being lazy. If it turns out that I still need to connect an isoground on the 12pin to the DAQ extground then the convenience disappears.

 

I have included what the analog input wavegraphs look like now that the synchronization is good.

 

Two additional question I have for those of you that followed this thread. Was I giving information that could have led to this solution? Was I missing anything in my introduction and follow ups? 

 

Despite remaining questions I will mark this issue as solved. Kudos to Bruce for helping me think about this.

0 Kudos
Message 8 of 9
(4,521 Views)

Without being familiar with the specific camera you were using, I don't think anybody would have figured that out.  Perhaps if one of us knew how you had wired everything and studied the camera manual, we might have figured it out.  I don't usually go to that much trouble on forum questions, though.

 

Glad you figured out the problem.  Things like that are tough to figure out, even for experienced programmers.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 9 of 9
(4,512 Views)