Sync 2 frame grabbers

Last modified by Lev Andronov on 2025/02/02 17:21

You can synchronize two frame grabbers to start image acquisition simultaneously using GPIO triggers. One frame grabber must be set as Master, and the other as Slave.

Hardware requirements

  • 2x frame grabber
  • Pin-to-pin jump wires

Connect the two grabbers using instructions from the "Frame Grabber and Simulator Hardware Reference & Installation Guide" sections GPIO Connectors and GPIO Pinout. For this case, connect pin 18 to pin 18 (GND) and pin 19 to pin 19 (TTL0). Connect at least one camera to each grabber.

Configuration steps

1. Initialization

Open both grabbers.

Detect cameras for each grabber.

Connect all detected cameras.

2. Configure Cameras for Trigger Mode

For each camera on each grabber:

KYFG_SetCameraValueEnum(cameraHandle, "TriggerMode", 1)
KYFG_SetCameraValueEnum_ByValueName(cameraHandle, "TriggerSource", 'LinkTrigger0')

3. Configure First Grabber (Master)

Grabber Preparation:

KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'LineSelector', "KY_TTL_0")
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'LineMode', "Output")
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'LineSource', "KY_TIMER_ACTIVE_0")

Timer Preparation:

KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'TimerSelector', "Timer0")
Frametime = 1e+6 / ExpectedFPS
KYFG_SetGrabberValueFloat(grabberHandle, 'TimerDelay', Frametime / 2)
KYFG_SetGrabberValueFloat(grabberHandle, 'TimerDuration', Frametime / 2)
KYFG_SetGrabberValueEnum(masterGrabber, "TimerTriggerSource", 0)

Camera Preparation (for each camera):

KYFG_SetGrabberValueInt(grabberHandle, 'CameraSelector', cameraIndex)
KYFG_SetGrabberValueEnum(grabberHandle, "CameraTriggerMode", 1)
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'CameraTriggerActivation', "AnyEdge")
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'CameraTriggerSource', "KY_TTL_0")

4. Configure Second Grabber (Slave)

Grabber Preparation:

KYFG_SetGrabberValueEnum_ByValueName(masterGrabber, 'LineSelector', "KY_TTL_0")
KYFG_SetGrabberValueEnum_ByValueName(masterGrabber, 'LineMode', "Input")
KYFG_SetGrabberValueEnum(masterGrabber, "LineSource", 0)

Camera Preparation (for each camera):

KYFG_SetGrabberValueInt(grabberHandle, 'CameraSelector', cameraIndex)
KYFG_SetGrabberValueEnum(grabberHandle, "CameraTriggerMode", 1)
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'CameraTriggerActivation', "AnyEdge")
KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, 'CameraTriggerSource', "KY_TTL_0")

5. Start Acquisition

Start stream:

KYFG_SetGrabberValueEnum(masterGrabber, "TimerTriggerSource", 42) // Continuous mode

Wait for a period of time to collect needed image quantity.

Stop stream:

KYFG_SetGrabberValueEnum(masterGrabber, "TimerTriggerSource", 0)

Check frame counters and dropped frames. Close cameras and grabbers.

KAYA Instruments © 2024. All Rights Reserved.