Skip to content

OV2311 / OV9781 / OV9282 External Trigger

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

Supported cameras

This guide covers the following Arducam USB UVC cameras on Windows and Linux. Match the SKU on your camera or order before following the wiring instructions.

SKU / product page Sensor Image type Full resolution
B0322 OV2311 Monochrome 1600 × 1200
B0332 OV9281 Monochrome 1280 × 800
B0385 OV9782 Color 1280 × 800

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
3.3 V logic trigger source output Camera F (trigger input)
Trigger source ground Camera G (ground)
Camera USB cable Windows or Linux capture host

Example of the trigger and ground connections on an Arducam USB camera board

If your board layout differs from the photo, locate the F and G markings on your board. Set the source to deliver a 0–3.3 V rising-edge pulse with a high time of at least 2 µs.

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. On the cameras covered by this guide, this control enables external trigger mode.
  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 menu lists 1 as Manual Mode and supports 10 for absolute exposure, these commands set 1 ms of manual exposure and enable 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. Use an MJPG mode that can deliver at least 30 triggered frames per second, or choose a lower pulse rate for a slower video mode.

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, wire the Pi's physical pin 5 (BCM GPIO 3) to camera F, and physical pin 6 (ground) to camera G. The camera's USB cable goes to the capture host. If the Pi is also the Linux host, use a USB port on that same Pi.

    Raspberry Pi wired to the camera trigger and ground pads

  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.

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, a rising edge at F, and a high time of at least 2 µs.
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 SKU and, on Linux, the 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, operating system, video mode, exposure, and the voltage, width, and frequency of the pulse at F.