Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Drive LED illumination with camera strobe output

Solved!
Go to solution

Hi everyone, 

 

I have a Point Grey Grasshopper camera which outputs a "strobe" signal (TTL high) during the frame exposure time.  I'd like to allow the camera to operate in free-running mode (no external trigger) and use this strobe signal to turn on/off a pair of illumination LEDs while acquiring frames from the camera.  My LED's each have a driver which can be modulated with TTL input.  The LEDs should alternate illumination for successive frames (i.e only one LED is on at any given time).

 

I've used the low-level IMAQdx and DAQmx examples to acquire frames from the camera, acquire the strobe signal (as either analog or digital input), and send out control signals to the LEDs (as analog or digital output).  But I can't figure out how to synchronize all this.  I've looked at the triggering and timing examples, but I don't fully understand them and I think there are also limitations with my USB-6211 DAQ's ability to use hardware/software triggering.

 

 

Thanks in advance for any help / advice.

MP 

 

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

Hi MP,

  

I think we need some more information about the lighting system. What LED driver are you using? What do you mean that the driver can be "modulated with TTL input"? What kind of signal does the LED driver expect?

 

If possible, it would be better to bypass using the 6211 at all. Like you said, it only has software-timed DIO. Do you need it so that you can switch between outputting to the different LEDs?

 

-Jordan

0 Kudos
Message 2 of 9
(4,454 Views)

Hi Jordan,

 

Thanks for your reply - I'm using the Thorlabs LEDD1B driver - it has a "trigger" mode which allows the current delivered to the LED to be controlled by a TTL signal at the driver's BNC input (minimum "high" level: 2V).  I'd like to use the signal coming from the camera's "strobe" output, which is TTL high (or can be inverted) during each frame's exposure time, to turn the LED on only during the frame exposure (i.e. synchronized with the "strobe" signal).

 

The additional challenge is that I have two LEDs (and two drivers) which I'd like to turn on / off alternately for successive frames.  I.e. LED 1 is on during exposure of camera frames 1,3,5... and LED 2 is on during camera frames 2,4,6... .  

 

I'd like to run the camera at somewhere close to 30 frames per second (33 ms exposure times) so timing and synchronization should be on the order of a millisecond or so.  I'm not sure if this is beyond the capability of the software-timed functionality of the USB-6211 or if I should upgrade to a board that can do hardware timed I/O.  I tried a simple modification of the Multifunction AI-AO example (attached) but moving the DAQmx Write VI inside the while loop instead from its original location before DAQmx Start Task leads to error "Non-buffered hardware-timed operations are not supported for this device and Channel Type".  So it seems I am running into limitations of the 6211.

 

Thanks again for any insight or ideas for work-arounds or alternative approaches.  

MP

 

 

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

MP,

 

With the software timing on the USB-6211, you're relying on the Windows OS timing to determine when those signals will be sent out to the driver. Because of the time it would take to recognize a pulse from the camera, do the logic to determine which LED driver to write to, and then write the TTL high to the line, I don't think you'd be able to get anywhere near 1 ms reliability.

 

You would probably want to upgrade your DAQ hardware to something capable of hardware timed output. 

 

-Jordan

0 Kudos
Message 4 of 9
(4,428 Views)

Thanks Jordan, 

 

I have a PCI-6713 available which might allow hardware timing.  This is more of a high speed analog output card and it doesn't have analog input but maybe I can read the camera's strobe signal on one of its digital input lines and then write the TTL level to the LED controllers either via AO or DO.  

 

If that doesn't work I'll reach out to NI for recommended hardware for this application.

 

Thanks again,

MP

0 Kudos
Message 5 of 9
(4,426 Views)
Solution
Accepted by topic author mp50

Depending on the frequency of the pulse train you are trying to output, analog output may not be the best option. For TTL you should try to stick with DIO whenever possible. I altered one of the DAQmx examples to do single-point IO. This VI reads in a pulse train and then parses it into two separate digital outputs. It uses software timing, so you should be able to run it on either of your devices. I ran this VI on a PCIe-6321 (X Series) DAQ device and it seemed to run with a fairly small amount of jitter. This screenshot shows a test of the attached VI. I read in the original pulse train (green) and the two outputs (red and blue) and you can see that they line up fairly well.

 

Synced pulse trains.png

 

So you may actually have luck without having to upgrade your hardware. Give this a try with your hardware and let us know how it goes!

 

-Jordan

 

 

Message 6 of 9
(4,401 Views)

You might be able to control the LED's with COTS hardware, do a search for flip-flop and or bistable switch.

Here is just one example:

 

http://www.ebay.com/itm/3V-24V-5A-Flip-Flop-Latch-Switch-Module-Bistable-single-button-5000mA-LED-Re...

 

 

-AK2DM

edit- wrong link in original.

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 7 of 9
(4,396 Views)

Thanks Jordan, 

 

Your VI was a great help - testing with our USB-6211 showed stable performance for camera frame rates up to 15 frames per second (see oscilloscope screenshot attached; Ch4 is the camera's strobe output - high during each frame exposure, Ch1 & Ch2 are the digital outputs to modulate the LED controllers).  Alternate LED's will be on during alternate frames.

 

It showed instability at higher frame rates but we can look into alternative hardware that supports hardware timing later.  For now 15 fps is very usable.   

 

Thanks again for your help on this!

MP

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

Hi AK2DM,

 

Thanks for your suggestion on this topic - I agree that using electronic hardware like this would be a nice solution.  I'll look into this further.

 

Thanks,

MP

 

 

0 Kudos
Message 9 of 9
(4,364 Views)