LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger camera

Solved!
Go to solution

Dear Labview users,

 

For  a project I have to trigger a Photron high speed camera with a current signal that comes from a function generator; the camera should start recording when the current gives a peak in the signal. The camera TTL cable is connected to the PFI 12/P2.4 on a BNC 2110 daq board. I want to use DAQmx and IMAQ in the program. Does anyone has suggestions?

0 Kudos
Message 1 of 5
(2,952 Views)

Dear Labview users,

 

For  a project I have to trigger a Photron high speed camera with a current signal that comes from a function generator; the camera should start recording when the current gives a peak in the signal. The camera TTL cable is connected to the PFI 12/P2.4 on a BNC 2110 daq board. I want to use DAQmx and IMAQ in the program. Does anyone has suggestions?

0 Kudos
Message 2 of 5
(2,951 Views)

Sure.  I would suggest that you first write the code that will "snap" (take one image) from your camera and display it for you in an Image display.  You mention the BNC 2110 board, but this doesn't produce pulses, it just is a connector box.  What DAQ device is generating the pulses?  You should write a separate small VI that sets up the DAQ and delivers a Pulse when you push a Front Panel button.  It would be useful to have an oscilloscope handy to test that you get a TTL Pulse (quick quiz -- how would you make a 1 ms pulse out of a Digital Out line?) when you push the button.

 

You now have a VI that can take an image "when told", another VI that can deliver a TTL Pulse "when told".  All you have to do now is connect the TTL Pulse to the Camera (via the BNC 2110 and an appropriate cable) and combine the two VIs (which you've already tested separately, so you know they work) to cooperate with each other.

 

Bob Schor 

Message 3 of 5
(2,936 Views)

Dear Bob,

 

Thanks or your reply! I tried to write a script according to your suggestion. Could you have a look at it, hopefully it's not that bad? 

 

kind regards,

Daniel

 

0 Kudos
Message 4 of 5
(2,905 Views)
Solution
Accepted by topic author Dani_W

There is nothing inherently "wrong" with your VI, but it doesn't do what I thought you wanted to do.  It consists of two independantly-running loops:

  • The top loop configures an unspecified DAQ device to acquire continuous analog samples starting from an unspecified TTL input channel.
  • The bottom loop configures an unspecified Camera to acquire continuous Images and display them (parameters such as Frame Rate and Image Format are not specified -- the default values are apparently OK.

Each loop has its own Stop button, and share no obvious information or common inputs or common outputs.

 

I'm guessing that you are relatively new to LabVIEW, including to DAQmx and especially to Vision.  LabVIEW Vision is relatively complex and "under-documented" -- I think you probably need another few months doing serious LabVIEW development before attempting this particular Project on your own.  Notice I said "on your own" -- when I first was introduced to LabVIEW Vision, it was in the context of helping a colleague who had used it to make simple movies, but who otherwise didn't write very good LabVIEW code.  I helped him "improve his code" (I forced him to start using LabVIEW Project, I made him write sub-VIs instead of one huge Block Diagram that required 6 screens (we only had two) to view, straighten out his wires, made him use the Error Line, etc., and he "taught me" about LabVIEW Vision and IMAQdx.  In the process, we learned a lot more about how Vision worked, largely because we wrote a lot of "tiny test routines" to "see what happens if you do this ...".

 

My understanding of what you want to do is the following:

  • Have a Camera start acquiring continuous images on some form of "Start" command and to stop acquiring on some form of "Stop" command.
  • The "Start" command could be a TTL Pulse.  It is unclear to me if you want the TTL pulse to go directly to the Camera (I thought that was what you wanted) or to a "Wait-for-Pulse" loop in LabVIEW, itself, which would subsequently start the Camera.
  • The TTL Pulse could be created by LabVIEW/DAQmx (I thought that was what you wanted) in response to something else in LabVIEW, such as pushing a Front Panel "Start" button.

As you can see, what I thought you wanted is very far from what you presented in your code.  Here are some suggestions:

  • If you are not doing so already, start developing inside the context of a LabVIEW Project.  If you do not know about Projects, and have noone (an Instructor, a colleague) to help you, and can't find help with a Web Search (or LabVIEW Help), ask here and we'll help.
  • I was going to list other steps, but realized this step should come first:  Write Some Documentation!  Write a one-page (or less, or more) document describing What you want to do, what hardware you have available to do it, the significant parameters of your task (sampling rates, frame rates, nature of the inputs and outputs, how long the process runs).  Note that this largely defines your Front Panel (inputs and outputs and other parameters) and the nature of the VIs and functions needed in the Block Diagram.  Plus it really helps you and anyone trying to help you to know your needs.
  • Write the code in "little pieces", preferably as independent sub-VIs (to the extent possible).  I would start with deciding what you mean by a TTL Pulse and if it includes having the program and the hardware generate such a pulse, write (and debug) this code separately and do this first.
  • Next I'd suggest writing a stand-alone VI that simply acquires (and displays) Images without worrying about Triggers.  Trust me, incorporating Triggers will be "tricky".

Bob Schor

Message 5 of 5
(2,900 Views)