Skip to content

B0678 External Trigger

Use external trigger mode to capture frames in response to a pulse from a signal generator or Raspberry Pi. With the camera streaming in trigger mode, each valid trigger requests a frame.

Supported camera

This guide covers the Arducam B0678, a 2 MP (1600 × 1200) color global shutter USB 2.0 UVC camera with a built-in 6-axis IMU, on Windows and Linux. Use the UC-D53 diagrams in this guide to locate the camera's trigger connector.

Connect the trigger source · Windows setup · Linux setup · Raspberry Pi trigger script

Connect the trigger source

First, plug the camera into the Windows or Linux host and confirm that it can show a live preview in continuous mode. Then unplug USB and power off the trigger source before wiring.

Connect from Connect to
Trigger source signal output XVS (trigger input)
Trigger source ground GND
Camera USB cable Windows or Linux capture host

GND and XVS connections on the B0678 UC-D53 board

Set the source to the XVS input level and pulse timing specified for your UC-D53 board before applying a signal. Match the connector orientation to the diagram.

Reconnect USB and power on the trigger source. Keep its pulse output off until you have enabled external trigger mode on the capture host.

Windows

  1. In AMCap, select the camera under Devices and enable Options → Preview.
  2. Open Options → Video Capture Pin. Select a format, resolution, and frame rate offered by the camera.
  3. Open Options → Video Capture Filter → Camera Control. Clear Auto next to Exposure, shorten the exposure, and click Apply.
  4. In the same tab, check Low Light Compensation and click Apply to enable external trigger mode on the B0678.
  5. Keep the preview open and start the trigger source.

Use an exposure shorter than the interval between pulses, with time left for sensor readout. If the camera is still busy with the previous frame when the next pulse arrives, it can miss the trigger. Add light if the shorter exposure makes the image too dark.

To return to continuous capture, stop the trigger source, clear Low Light Compensation, and click Apply.

Linux

Find the camera and its controls

On Debian or Ubuntu, install v4l-utils if v4l2-ctl is missing:

sudo apt update
sudo apt install v4l-utils
v4l2-ctl --list-devices
v4l2-ctl -d /dev/video0 --list-formats-ext
v4l2-ctl -d /dev/video0 --list-ctrls-menus

The examples use /dev/video0. Replace it with your camera's capture node. Open a preview on that node in a V4L2 viewer such as qv4l2, then set the controls in a separate terminal.

Set a short exposure and enable external trigger

If the control list shows exposure_dynamic_framerate, the control menu lists 1 as Manual Mode, and absolute exposure accepts 10, use the following example. It sets 1 ms of manual exposure and switches on the UVC control used for external trigger.

v4l2-ctl -d /dev/video0 --set-ctrl=auto_exposure=1
v4l2-ctl -d /dev/video0 --set-ctrl=exposure_time_absolute=10
v4l2-ctl -d /dev/video0 --set-ctrl=exposure_dynamic_framerate=1
v4l2-ctl -d /dev/video0 --get-ctrl=exposure_dynamic_framerate

The trigger control should report 1. If your system reports different control names, use the names shown by --list-ctrls-menus. Some versions use exposure_auto, exposure_absolute, and exposure_auto_priority for the same controls. Start the trigger source and check that the camera updates only when pulses arrive.

To return to continuous capture, stop the trigger source and run:

v4l2-ctl -d /dev/video0 --set-ctrl=exposure_dynamic_framerate=0
v4l2-ctl -d /dev/video0 --get-ctrl=exposure_dynamic_framerate

The control should report 0, and the preview should update without pulses.

Verify triggered capture

Move an object in front of the camera so changes between frames are easy to see. The Raspberry Pi script starts at 30 Hz. Select MJPG for this test. See Video mode and trigger rate.

Trigger source Expected preview
No pulses The preview waits or holds the last frame.
A single pulse The preview updates, then waits again.
Pulses at 30 Hz A video mode that supports the rate should deliver about 30 frames per second.
Pulses stopped The preview holds the last frame again.

On Linux, you can also verify one frame from the terminal. Close the preview app, start the following command with the pulse output off, then start the trigger source or send a single pulse within 15 seconds. The command exits successfully when it receives a frame.

timeout 15s v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=/dev/null

Generate trigger pulses with a Raspberry Pi

  1. Install the packages and download the Arducam trigger script on Raspberry Pi OS.

    sudo apt install wget unzip python3-gpiozero python3-lgpio
    mkdir -p "$HOME/arducam-external-trigger"
    cd "$HOME/arducam-external-trigger"
    wget -O trigger.py.zip https://cdn.arducam.com/downloads/trigger.py.zip
    unzip -n trigger.py.zip trigger.py
    

    GPIO Zero is the Python library the script uses to drive the output. The default LED_PIN = 3 selects BCM GPIO 3.

  2. With power off, connect the Pi's physical pin 5 (BCM GPIO 3) to XVS on the UC-D53 square trigger connector and physical pin 6 (ground) to GND. The Pi output is 3.3 V. Use a direct signal connection only when the camera's XVS input supports 3.3 V. Otherwise, use a level shifter that matches the specified XVS input. Connect the camera's USB cable to the capture host.

    Raspberry Pi trigger wiring to the UC-D53 square connector

  3. Power up the Pi. Once capture is running in trigger mode, start the script.

    cd "$HOME/arducam-external-trigger"
    python3 trigger.py
    

    Pulses begin immediately at 30 Hz. To change the rate while the script is running, enter a number in hertz at the > prompt and press Enter. For example, enter 1 for 1 Hz. Enter q or press Ctrl+C to stop.

Video mode and trigger rate

At 1600 × 1200, the B0678 product specifications list 60 fps in MJPG and 5 fps in YUY2 for USB streaming. Select MJPG when testing with the script's default 30 Hz output. The delivered trigger rate also depends on exposure and the selected video mode. Verify frame delivery at the pulse rate you plan to use.

Troubleshooting

Symptom What to check
No preview in continuous mode Check the USB connection, camera selection, and video format before testing the trigger input.
Preview stays still after a pulse Check that capture is active. Verify common ground and the signal level, trigger edge, and pulse width at XVS.
Preview keeps updating without pulses Verify the trigger control on the selected camera. If the preview app reapplies its settings, enable trigger mode again after starting capture.
Trigger control is missing Confirm the camera is B0678 and check the selected capture node and control names. If needed, contact Arducam with the camera's firmware version and control list.
Frames are missed at higher pulse rates Lower the pulse rate, shorten the exposure, and confirm the selected USB video mode can sustain the required rate.

When contacting support, include the SKU, board revision, operating system, video mode, exposure, and the voltage, width, and frequency of the pulse at XVS.