Triggers

Last modified by Lev Andronov on 2024/11/11 14:52

Trigger types

There are two types of triggers supported by API:

1. Camera trigger

This will trigger the camera. On each trigger, the camera will send a single frame.

2. Frame Grabber trigger

In this mode, the camera should run in continuous mode. When the Frame Grabber is triggered, it will allow for a single frame to be acquired in the allocated buffer.

WARNING: Please ensure that you do not enable both trigger modes simultaneously, as this could cause failure.

Also refer to sections Camera Trigger and Acquisition (Frame Grabber) Triggers in the KAYA Frame Grabber Feature Guide


Triggers examples

Software trigger

Basic example to configure single frame acquisition with a software trigger.

  1. Open Vision Point, select the frame grabber, and scan for cameras
  2. Open the camera parameters browser and navigate to Acquisition Control -> Trigger Selector
  3. Set "Trigger Mode" = "On"
  4. Set "Trigger Source" = "Software"
  5. Start the transmission on the camera
  6. Every time you click "Execute" at the "Trigger Software" will trigger the camera to image acquisition

Timer trigger

This example describes how to set up a timer as a trigger. Before configuring, open Vision Point, select the frame grabber, and scan for cameras.

Step 1: Configure the timer to create a square wave:

  1. In the frame grabber parameters browser navigate to "Frame Grabber I/O Control" -> "Timer Control"
  2. Set "Timer Trigger Source" = "Continuous"
  3. Set "Timer Selector" = "Timer 0"
  4. Set "Timer Delay" and "Timer Duration" to get the desired frequency. See examples below:
Parameter10KHz10HzDescription
TimerDelay50.0 (50us)50000.0 (50ms)100ms total clock pulse which gives 10 FPS
TimerDuration50.0 (50us)50000.0 (50ms)100us total clock pulse which gives 10,000 FPS

Step 2: Configure the frame grabber to send triggers to the camera

  1. In the frame grabber parameters browser navigate to "Extended Stream Features" -> Choose "Camera Selector id" -> "Camera Trigger Control"
  2. Set "Camera Trigger Mode" = "On"
  3. Set "Camera Trigger Activation" = "AnyEdge"
  4. Set "Camera Trigger Source" = "Timer 0 Active"

Step 3: Configure the camera to receive the triggers from the frame grabber

  1. In the camera parameters browser navigate to "Acquisition Control" -> "Trigger Selector"
  2. Set "Trigger Mode" = "On"
  3. Set "Trigger Source" = "LinkTrigger0"

Step 4: Configuration is complete, start the acquisition to view the results.


Frame rate trigger

The following example illustrates how to configure Timer2 to define the frame rate of stream trigger for incoming data frames from the camera.

Configure Timer2 trigger source to be active in a continuous mode:

  1. set "TimerSelector" to "Timer2"
  2. set "TimerDelay" and "TimerDuration" to get the desired frequency.
  3. set "TimerTriggerSource" to "KY_CONTINUOUS" mode

Configure the Frame Grabber Stream Trigger Control:

  1. set "CameraSelector" to select the destination camera
  2. set "TriggerActivation" to "AnyEdge"
  3. set "TriggerSource" as "KY_TIMER_ACTIVE_2"
  4. set "TriggerMode" to "On."

Configure the Camera Trigger:

  1. set "TriggerMode" in the Camera tab to "On".
  2. additional configurations might be needed to set up a trigger in the camera

TTL triggers

The following example illustrates how to configure TTL0 as an output signal source generating a square wave using connected Timer 0 at 10 Hz frequency (every 100ms). Also configuring TTL1 to be an input for an incoming signal will become the source of the camera trigger. To complete the setup TTL0 is connected to TTL1 to pass the signal from Timer0 to the camera. This setup generates a trail of trigger packets to the camera and a way to connect an oscilloscope, for example, to TTL0 and sample the generated signals.

Equipment Setup:

  • Connect oscilloscope to TTL0 pin
  • Connect TTL0 to TTL1 pin
  • TTL1 input will be sending triggers to the camera over CoaXpress

Configure Timer0 trigger source configuration to create a square wave:

  1. set "TimerSelector" to "Timer0"
  2. set "TimerDelay" and "TimerDuration" to get the desired frequency.
  3. set "TimerTriggerSource" to "KY_CONTINUOUS" mode

Setting timer to be the source of TTL0:

  1. set "LineSelector" to "KY_TTL_0"
  2. set "LineMode" to "Output"
  3. set "LineSource" as "KY_TIMER_ACTIVE_0"

Configuring TTL1 to be the input:

  1. set "LineSelector" to "KY_TTL_1"
  2. set "LineMode" to "Intput"
  3. set "LineSource" as "Disablede"

Configure the Camera Trigger Control:

  1. set "CameraSelector" to select the destination camera
  2. set "CameraTriggerMode" to "On"
  3. set "CameraTriggerActivation" to "AnyEdge"
  4. set "CameraTriggerSource" as "KY_TTL_1"

Configure the Camera Trigger:

  1. set "TriggerMode" in Camera tab to "On"
  2. additional configurations might be needed to set up trigger in the camera.

External trigger via GPIO

Steps to implement camera triggering via external Frame Grabber GPIO:

  1. Connect trigger source to dedicated pins on the GPIO of the Frame Grabber. You can find more information about GPIO pinout in the device HW and Installation Guide.
  2. Select the GPIO using "LineSelector" and configure related parameters. You can find more information in "KAYA Frame Grabber Feature Guide" document.
  3. (Optional) Make sure that the trigger arrives at the Frame Grabber by checking the "LineStatusAll" (see image below). Changes in the trigger state can be seen by refreshing the "LineStatusAll" parameter value (if no changes are observed, it may be because the trigger is too fast. Reduce the trigger frequency to check the trigger changes, and return it to the desired state for regular operation).
  4. Configure the Camera the work in trigger mode instead of continuous acquisition. Usually, this can be achieved by setting "TriggerMode" to "On", but this configuration is camera-specific therefore may require additional configurations.
  5. Redirect the connected Frame Grabber trigger from the GPIO to the camera trigger.
  6. You can achieve basic trigger generation from the Frame Grabber towards the camera by setting "CameraTriggerMode" to "On", "CameraTriggerActivation" to "AnyEdge" and "CameraTriggerSource" to the GPIO input (see image below). You can find information on more advanced configurations in the "KAYA Frame Grabber Feature Guide" document.

camera_trigger_control.png

The Frame Grabber stream trigger ("Trigger Control") should not be enabled with the camera trigger ("Camera Trigger Control"); this may cause a collision between the two trigger logics, which may result in unexpected behavior.


Send N triggers

How to send N triggers from Frame Grabber to camera?

Example with trigger rate 200 (your camera need to support this rate) and 5000 triggers. The timer 0 will be activated by software trigger for debug purposes (later it can be changed to TTL source)

  1. First set a timer that will be high for the duration of the triggers generation (all 5000 triggers)
    • KYFG_SetGrabberValueEnum(grabberHandle, "TimerSelector", 0);
    • KYFG_SetGrabberValueFloat(grabberHandle, "TimerDelay", 10);
    • KYFG_SetGrabberValueFloat(grabberHandle, "TimerDuration", 25000000.0); // 25 seconds of operation, maximum 34 seconds
    • KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, "TimerActivation", "RisingEdge");
    • KYFG_SetGrabberValueEnum(grabberHandle, "TimerTriggerSource", 43); // software trigger
  2. Set a second timer that will generate the triggers to the camera and select its source as a second timer. The trigger activation should be "Level High"
    • KYFG_SetGrabberValueEnum(grabberHandle, "TimerSelector", 1);
    • KYFG_SetGrabberValueFloat(grabberHandle, "TimerDelay", 2500);
    • KYFG_SetGrabberValueFloat(grabberHandle, "TimerDuration", 2500); // frame rate of 200 fps
    • KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, "TimerActivation", "LevelHigh");
    • KYFG_SetGrabberValueEnum(grabberHandle, "TimerTriggerSource", 48); // timer 0 trigger
  3. Configure the camera trigger
    • KYFG_SetGrabberValueInt(grabberHandle, "CameraSelector", 0); // camera index
    • KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, CameraTriggerActivation", "AnyEdge");
    • KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, "CameraTriggerSource" as "KY_TIMER_ACTIVE_1");
    • KYFG_SetGrabberValueEnum_ByValueName(grabberHandle, "CameraTriggerMode", "On");
  4. To activate 1 run (5000 triggers), use the Timer0 trigger software execute for debug. Then you can change the trigger source to TTL or any other IO.
    • KYFG_GrabberExecuteCommand(grabberHandle, "TimerTriggerSoftware");
  5. Make sure to check the "RXFrameCounter" to get the exact frames captured by the Frame Grabber and NOT the frame count in the bottom of the GUI picture window.

Restriction: The minimum FPS that the camera should support is approximately 146, because the timer duration is limited to around 34.35 seconds, so it needs time to generate 5000 triggers.

Triggers known issues

Lost frames at high FPS

When sending triggers it’s necessary to calculate the expected frame rate and set the delay accordingly.

  • Trigger Interval: 12 ms
  • Formula: 1 sec / 12 ms = 83.33 fps (approx.) 

If the trigger rate is too fast, the last image may be lost.

Use our online FPS Calculator to ensure that your camera's frame rate and bandwidth settings are properly configured, also you can download Iron Excel Calc.

KAYA Instruments © 2024. All Rights Reserved.