Technical Application Notes
Click an item to read from the list below.

Technical Application Notes


 

 

Configuring Synchronized Capture with Multiple Cameras

Subject

TAN2016008 - Configuring Synchronized Capture with Multiple Cameras

10678

Applicable Products

  • Blackfly S
  • Blackfly
  • Chameleon3
  • Flea3
  • Grasshopper3

Application Note Description

This document describes how to set up multiple cameras for synchronized capture.

What is Synchronized Capture?

Synchronized capture is when one "primary" camera is used to trigger one or more "secondary" cameras, using the primary camera's strobe. This ensures that the frame rates of the secondary cameras are the same as the that of the primary camera. Strobes occur when a camera begins to capture images. With the GPIO connection on a FLIR machine vision camera, it's possible to use the strobe output as an input for other cameras.

Note: An alternative method of synchronized capture is to have all cameras triggered by an external hardware trigger (for example, a function generator). Any hardware trigger that provides a 3.3 V or 5 V square wave TTL signal can trigger the cameras. This application note does not cover the configuration of an external hardware trigger.

Configuring Synchronized Capture

There are two steps to configuring synchronized capture:

  1. Create a physical connection between the cameras by linking their GPIO pins.
  2. Configure inputs and outputs for each camera either with the SDK demo application or with code.

Step 1—Connect the Cameras

The first step is to create a physical link between the cameras. The methods vary depending on the camera used.

Blackfly S (BFS)

BFS cameras have a 6-pin GPIO. The BFS GPIO has both a non-isolated output and an opto-isolated output. If using the opto-isolated output as in our example below, the primary camera requires a pull-up resistor to strengthen its strobe signal.

DiagramColorPinLineFunctionDescription

Green 1 3 VAUX Auxiliary Input Voltage (DC)
GPI Non-isolated Input
Black 2 0 OPTOIN Opto-isolated Input
Red 3 2 VOUT Camera Power Output
GPIO Non-isolated Input/Ouput
White 4 1 OPTOOUT Opto-isolated Output
Blue 5 N/A Opto GND Opto-isolated Ground
Brown 6 N/A GND Camera Power Ground

 To configure primary and secondary BFS cameras:

  1. Connect the primary camera's pin 4 (white wire, opto-isolated output) to each secondary camera's pin 1 (green wire, non-isolated input).
  2. Connect the primary camera's pin 5 (blue wire, opto-isolated ground) to each secondary camera's pin 6 (brown wire, ground).

To configure the pull-up resistor needed to strengthen the signal:

  1. Connect one end of a 10 kΩ resistor to the primary camera's pin 3 (red wire, 3.3 V output).
  2. Connect the other end of the resistor to the primary camera's pin 4 (white wire) and to each secondary camera's pin 1 (green wire).
  3. Connect the primary camera's pin 6 (brown wire) to each secondary camera's pin 6 (brown wire). Note: the secondary camera's pin 6 is already connected to the primary camera's pin 5.

Blackfly (BFLY)

BFLY cameras use a 6-pin GPIO connector. The BFLY GPIO has only opto-isolated output pins, so the primary camera requires a pull-up resistor to strengthen its strobe signal.

DiagramColorPinFunctionDescription

Green

1

VEXT +12 V DC Camera Power
Black

2

I0 Opto-isolated input (GPIO 0)
Red

3

NC / +3.3 V +3.3 V output. Current 120 mA (nominal).
Firmware enabled (OUTPUT_VOLTAGE_ENABLE: 19D0h)
White

4

O1 Opto-isolated output (GPIO 1)
Blue

5

OPTO_GND Ground for opto-isolated I/O, not connected to camera ground
Brown

6

GND DC camera power ground

 To configure primary and secondary BFLY cameras:

  1. Connect the primary camera's pin 4 (white wire, opto-isolated output) to each secondary camera's pin 2 (black wire, opto-isolated input).
  2. Connect the primary camera's pin 5 (blue wire, opto-ground) to each secondary camera's pin 5 (blue wire, opto-ground).

To configure the pull-up resistor needed to strengthen the signal:

  1. Connect one end of a 460 Ω resistor to the primary camera's pin 3 (red wire, 3.3 V output).
  2. Connect the other end of the resistor to the primary camera's pin 4 (white wire) and to each secondary camera's pin 2 (black wire).
  3. Connect the primary camera's pin 6 (brown wire) to each camera's pin 5 (blue wire). Note: the secondary camera's pin 5 is already connected to the primary camera's pin 5.

Flea3 (FL3) and Grasshopper3 (GS3)

FL3 and GS3 each use an 8- pin GPIO. They have two non-opto input/output pins that can be used as either input or output. Non-opto pins do not need a pull-up resistor combination to strength the strobe signal. This example uses the non-opto pins.

DiagramColorPinFunctionDescription
Black 1 I0 Opto-isolated input (default Trigger in)
White 2 O1 Opto-isolated output
Red 3 IO2 Input/Output/serial transmit (TX)
Green 4 IO3 Input/Output/serial receive (RX)
Brown 5 GND Ground for bi-directional IO, VEXT, +3.3 V pins
Blue 6 OPTO_GND Ground for opto-isolated IO pins
Orange 7 VEXT Allows the camera to be powered externally
Yellow 8 +3.3 V Power external circuitry up to 150 mA

 To configure primary and secondary FL3 or GS3 cameras:

  1. Connect the primary camera's pin 3 (red wire, output) to each secondary camera's pin 4 (green wire, input).
  2. Connect the primary camera's pin 5 (brown wire, ground) to each secondary camera's pin 5 (brown wire, ground).

Chameleon 3 (CM3)

CM3 uses a 9-pin GPIO. It has two non-opto input/output pins that can be used as either input or output. Non-opto pins do not need a pull-up resistor combination to strength the strobe signal. This example uses the non-opto pins.

DiagramColorPinFunctionDescription
Red 1 VEXT Allows the camera to be powered externally 5 - 24 VDC
Black 2 GND Ground for Input/Output, VEXT, +3.3 V pins
White 3 +3.3 V Power external circuitry fused at 150 mA maximum
Green 4 GPIO3 / Line3 Input/Output
Purple 5 GPIO2 / Line2 Input/Output
Black 6 GND Ground for Input/Output, VEXT, +3.3 V pins
Brown 7 OPTO_GND Ground for opto-isolated IO pins
Orange 8 OPTO_OUT / Line1 Opto-isolated output
Yellow 9 OPTO_IN / Line0 Opto-isolated input

 To configure primary and secondary CM3 cameras:

  1. Connect the primary camera's pin 5 (purple wire, output) to each secondary camera's pin 4 (green wire, input).
  2. Connect the primary camera's pin 6 (black wire, ground) to each secondary camera's pin 6 (black wire, ground).

Step 2—Configure the Cameras

After the cameras have been physically connected, use either the SDK's demo program or write code to configure the GPIO lines.

Using SpinView (BFS)

SpinView is the demo program available with the Spinnaker SDK.

For the primary camera:

  1. Open SpinView.
  2. Select the camera.
  3. On the Features tab, click Digital IO Control.
  4. From the Line Selection drop-down, select Line 2.
  5. Select 3.3V Enable.
  6. Save the settings in a user set:
    1. Click User Set Control.
    2. From the User Set Selector drop-down, select User Set 0 or User Set 1.
    3. Click User Set Save.
    4. From the User Set Default drop-down, select User Set 0 or User Set 1.

For each secondary camera:

  1. Open SpinView and select the camera.
  2. On the GPIO tab, from the Trigger Source drop-down, select Line 3.
  3. From the Trigger Overlap drop-down, select Read Out.
  4. From the Trigger Mode drop-down, select On.
  5. Save the settings in a user set:
    1. Click User Set Control.
    2. From the User Set Selector drop-down, select User Set 0 or User Set 1.
    3. Click User Set Save.
    4. From the User Set Default drop-down, select User Set 0 or User Set 1.
Saving the settings to a user set ensures the camera starts up with these settings even after a power cycle.

To start streaming, select each camera and click Play.

Using FlyCap2 (BFLY, FL3, GS3, CM3)

FlyCap2 is the demo program available with the FlyCapture2 SDK.

For the primary camera:

  1. Open FlyCap2, select the camera and click Configure Selected.
  2. For BFLY camera only, enable the 3.3 V line (red):
    1. In the Camera Control dialog, select the Camera Registers tab.
    2. Enter Register 19D0h (OUTPUT_VOLTAGE_ENABLE) and click Read Register.
    3. Set bit 31 to 1.
    4. Click Write Register.
  3. For all cameras, enable the strobe:
    1. Select the Trigger/Strobe tab.
    2. For BFLY camera only, enable the strobe for GPIO1.
      For all other cameras, enable the strobe for GPIO2.
  4. Save the settings:
    1. Select the Advanced Camera Settings tab.
    2. Select a Memory Channel (either 1 or 2).
    3. Click Save.

For each secondary camera:

  1. Open FlyCap2, select the camera and click Configure Selected.
  2. In the Camera Control dialog, select the Trigger/Strobe tab.
  3. For BFLY camera only, set the Source to 0.
    For all other cameras, set the Source to 3.
  4. Set the Mode to 0 or 14. (Not all models support trigger mode 14.)
  5. Select Enable/disable trigger.
  6. Save the settings:
    1. Select the Advanced Camera Settings tab.
    2. Select a Memory Channel (either 1 or 2).
    3. Click Save.
Saving the settings to a memory channel ensures the camera starts up with these settings even after a power cycle.

Start Saving Images at the Same Time

Once you have configured the primary and secondary cameras you can start saving synchronized images.

For both SpinView and FlyCap2:

  1. Ensure the primary camera's trigger mode is turned on.
  2. In the streaming window for the primary camera, click on the recording button.
  3. Modify the recording settings as necessary.
  4. Click the Start Recording button.
  5. Keep the recording window open.
  6. Repeat steps 1 through 5 for the secondary camera.
  7. Turn off trigger mode for the primary camera. This starts capture for both cameras.

Using Custom Code

Both the Spinnaker SDK and the FlyCapture2 SDK come with example code.  Elements of these two code examples can be combined to configure multiple cameras.

SDKExamplesLocation
Spinnaker SDK AcquisitionMultipleCamera
Trigger
\src\ of the SDK directory
Example: C:\Program Files\Point Grey Research\Spinnaker\src
FlyCapture2 SDK MultipleCameraEx
AsyncTriggerEx
\src\ of the SDK directory
Example: C:\Program Files\Point Grey Research\FlyCapture2\src

In the example configurations above, FL3, GS3, and CM3 use switchable input/output GPIO pins for their strobe outputs. The strobe must be turned on when using these cameras for synchronized capture. To turn on the strobe, create an instance of the StrobeControl struct using the following code:

StrobeControl strobe;

strobe.source = 2;

error = cam.GetStrobe(&strobe);

strobe.onOff = true;

error = cam.SetStrobe(&strobe);

Troubleshooting

Secondary camera captures images at half the frame rate of the primary camera

Cause: The secondary camera isn't using overlapping triggering

Solution: On the secondary camera, switch to using Trigger Overlap as described above. Not all camera models support Trigger Overlap (Trigger Mode 14). To determine if it is supported, consult the Technical Reference for your camera, available from our downloads page.

For more information on trigger modes and differences between overlapped and non-overlapped triggering, see the following knowledge base articles:

Secondary camera captures images at a very slow frame rate

Cause: The camera's exposure (shutter) value is too large.

Solution: Exposure (shutter) time can be adjusted.

  • In SpinView—On the Settings tab
  • In FlyCap2—On the Camera Settings tab of the Camera Control dialog.

I can't properly trigger more than one secondary camera

Cause: the physical setups shown above have been tested with only one secondary camera; we do not guarantee they will work for multiple secondary cameras.

Solution: Use your own pull up resistor setup.