External Trigger Mode¶
Tip
Access Global Shutter Camera using external trigger snapshot mode
Introduction¶
Global Shutter Camera having an external trigger function, which is used to capture the image and helps in synchronized streaming by connecting two or multiple cameras. In production applications (such as assembly line production), the external trigger mode can easily synchronize the camera with other devices. In addition, the sensor enables the sleep state will greatly reduce the power consumption.
Supported Cameras¶
Product Image | SKU | Sensor | Resolution | Pin/Connect Type | Color Type | Features | Lens Type | Field of View(HxV) | Focus Type | IR Sensitivity |
---|---|---|---|---|---|---|---|---|---|---|
![]() |
B0348 | OG02B10 | 2MP | 22/Top | Color | Pivariety | M12 | 85° (H) x 69° (V) | Manual Focus | 650nm IR-cut filter |
![]() |
B0353 | AR0234 | 2MP | 22/Top | Color | Pivariety | M12 | 90° (H) x 56° (V) | Manual Focus | without IR-cut filter |
![]() |
B0381 | OV2311 | 2MP | 22/Top | Monochrome | Pivariety | M12 | 83°(H) x 67.5°(V) | Manual Focus | without IR-cut filter |
Hardware¶
Abstract
The external trigger pins used by different cameras may not be the same. For example, the OV9281 camera mainly uses the XVS pin as the external trigger pin, while other cameras use pins such as FSIN and Trigger. For specific pin information, you can refer to the camera datasheet.
First of all, You need to solder the headers on the TRIGGER/XVS/FSIN and GND pins, TRIGGER/XVS/FSIN is connected to the external trigger signal, and GND is connected to the ground.
-
XVS Pin¶
We have adapted the new board (UC-788) for some specific cameras such as the new version of OV9281/OG02B10/OV2311 cameras, etc.
-
FSIN Pin¶
Some of the Arducam cameras adopt FSIN pin as the external trigger pin.
![]() |
![]() |
Note
It is required that the voltage of the trigger signal is 1.8V, you need to convert the 3.3V or 5V to 1.8V. The trigger signal pulse width tFSIN_High is not less than 2us, and the frequency cannot exceed the highest external trigger frame rate supported by the current frame rate.
-
Trigger Pin¶
Note
It is required that the voltage of the trigger signal is 1.8V, you need to convert the 3.3V or 5V to 1.8V. The trigger signal pulse width TTPW is not less than 2us, and the frequency cannot exceed the highest external trigger frame rate supported by the current frame rate.
Software¶
Step 1: Connect the External Trigger Pin¶
Connect the GPIO pins on the Raspberry Pi to the camera's XVS and GND pins using DuPont wires, as illustrated in the hardware connection diagram.
Step 2: Configure Timeout Value¶
The rpicam-apps may time out if all cameras fail to start within one second. To prevent this, you need to modify the configuration file to extend the timeout period. First, create a copy of the default configuration file. The command varies depending on your Raspberry Pi model.
- On Raspberry Pi 5 or CM5:
cd /usr/share/libcamera/pipeline/rpi/pisp
sudo cp example.yaml timeout.yaml
- On other Raspberry Pi models:
cd /usr/share/libcamera/pipeline/rpi/vc4
sudo cp rpi_apps.yaml timeout.yaml
Next, edit the new timeout.yaml file. Locate the line "camera_timeout_value_ms":, remove the leading # to uncomment it, and change the value to 100000 (100 seconds).
sudo nano timeout.yaml
Step 3: Start the Camera¶
Execute the following commands to start the camera stream.
- On Raspberry Pi 5 or CM5:
export LIBCAMERA_RPI_CONFIG_FILE=/usr/share/libcamera/pipeline/rpi/pisp/timeout.yaml
libcamera-still -t 0 --shutter 1000
- On other Raspberry Pi models:
export LIBCAMERA_RPI_CONFIG_FILE=timeout.yaml
libcamera-still -t 0 --shutter 1000
Note
The export command only applies to the current terminal session.
Step 4: Enable External Trigger Mode¶
Open a new terminal window and execute the following command to enable external trigger mode. After running this command, the camera will enter external trigger mode, and the preview window will freeze, waiting for an external trigger signal.
v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=1
Note
On Raspberry Pi 5 or CM5, it should be /dev/v4l-subdev2
, while on other Raspberry Pi models, it should be /dev/v4l-subdev0
.
Step 5: Download and Run the Trigger Script¶
Download the required Python script and run it using the following commands. After running the script, you can find that the frame rate of the camera will change according to the external trigger signal. The frame rate will be determined by the frequency of the external trigger signal.
wget -O trigger.py.zip https://cdn.arducam.com/downloads/trigger.py.zip
unzip trigger.py.zip
python3 trigger.py
Step 6: Disable External Trigger Mode¶
Disable the external trigger mode to return the camera to its default state.
v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=0