Synchronizing Blackfly S Camera with EEG System
AnsweredHi Teledyne/FLIR Community,
I am a researcher at the University of Pittsburgh using a Blackfly S (BFS-U3-04S2C-C) camera to synchronize a video with an EEG system. I'd like to (ideally) achieve millisecond precision between the camera frame and a standard TTL pulse sent to the EEG system.
The current setup is, unfortunately, limited to USB2, as we have a 50ft USB2 cable connecting the recording room from the data collection room. If this becomes the limiting factor, we may be able to move the computer from the data collection room to the recording room, but this is not our preferred solution.
Currently, I have interfaced the Blackfly S with Matlab using GenTL and generating TTL pulses every 10th frame. I can currently achieve a 40Hz framerate in a Robotics toolbox-controlled loop. I think by reducing the resolution of the image I can achieve an ~80Hz framerate, at least SpinView is able to run at 80Hz with reduced resolution over the 50ft USB2 cable.
My question for the community is, is there a way to achieve even greater precision by sending TTL pulses directly from the camera, bypassing the Windows OS altogether? I would need to set the Baud Rate = 115200.
Alternately, is there a way to increase the frame rate above 80Hz (to the max fps of >500Hz, although probably somewhere around 240Hz would do) without switching to USB3? Even more restriction of the resolution would be my first guess. Not sure what resolution modes are available with Matlab and GenTL, have to play around a bit.
A third question/option would be is it possible to send TTL pulses (again, with Baud Rate = 115200) from SpinView instead of my personalized Matlab program.
Thanks for your time,
Andrew Papale, PhD
-
Official comment
Hello Andrew,
I do not have USB2 port/cable to test for maximum fps, but it should be 10x slower than the expected fps in USB3 mode. Some factors to watch out that could affect camera fps:
- Pixel Format: ensure camera is running at raw pixel format (preferably BayerRG8/BayerGR8 for color camera)
- ISP node: this node could affect the overall fps and should be uncheck/disable
- Exposure Time: value of exposure time should be less than 1/(trigger rate or target fps)
- Device Link Throughput Limit: this node limit data bandwidth transmitted from camera to host. It defaults to 380MB/s in usb3 mode. This should be very far less in usb2 mode. In any case, I would utilize maximum available bandwidth in this usb2 mode by setting this node to maximum value.
- Image resolution: just as you mentioned, reducing resolution allow to transmit more frames in available bandwidth. This may be a good option if there is no other alternative.
- Auto algorithms: With smaller resolution, turning off all auto modes (including exposure, gain and white balance may further enhance the overall fps)
As per TTL configuration, I would require more information in implementation steps to better assist you. It seems camera is software triggered, and for every 10th frame, you send signal via host pc to "EEG system"? Why is baudrate required for this implementation? Is it an option for you using 'MultiFrame" acquisition mode of the camera or 'Frame Burst Start' trigger type that allow to capture a specific number of frames for every acquisition command or trigger signal?
Technically, this camera support TTL signal, and it should be possible to send/receive TTL from GPIO line. It does not require baudrate configuration to perform this functionality. You may wish to reference our KB article (https://www.flir.com/support-center/iis/machine-vision/application-note/configuring-synchronized-capture-with-multiple-cameras/ ) that shows how to properly synchronize cameras. Similar configuration could be followed using our camera and other devices (for instance camera configured as primary device, and "EEG" as secondary device or vice versa).
Please let me know whether the above response answered your question or provide more information in your implementation steps to further assist you.
Regards,Ifeanyi.
-
Hello Andrew,
I am just following up to see if you have the information you need from the above response, or if we can help clarify anything further.
Thank you,
Demos
1 -
Thank you for following up. We have it working at 333Hz on a USB3 cable now with a precision of about 3 pm 6ms. This should be sufficient. Fingers crossed!
0
Please sign in to leave a comment.
Comments
3 comments