Skip to content

External Trigger Application

This Application note describe how to config the global shutter camera into external trigger mode, and synchronize the image capture process with external trigger event.


Install pip and V4L2 packages

sudo python
sudo pip install v4l2

Hardware Wiring

Global shutter cameras like Omnivision OV7251, OV9281, OV2311 always have external trigger input signal called XVS. User can use a 3.3V trigger signal generated from Arduino, Raspberry pi or similar board to synchronize the capture process with hardware trigger event. The following diagram is an example how to connect a GPIO signal to the camera board. The trigger signal pulse duration will be fine from 1us ~ 1ms.

Open the Camera using Opencv

Download the external trigger example from GitHub repos, and run the command python -d 0 in the terminal window to bring up the camera. The parameter -d 0 stands for /dev/video0.


Using​ button 't' to enable external trigger mode, and button 'c' to exit external trigger mode. Adjust the Exposure and Gain settings by launching another terminal window and use v4l2-ctl commands like:

Exposure: v4l2-ctl -d 0 -c exposure=3000 Gain: v4l2-ctl -d 0 -c gain=15


There is default timeout for the opencv capture process, in our V4L2 camera driver it allows you to enable or disable time out settings, so that you can adjust the timeout settings to accommodate longer trigger intervals.

Set timeout command: v4l2-ctl -c frame_timeout=4000 (unit: ms)

Disable timeout command: v4l2-ctl -c disable_frame_timeout=1

Open the Camera using VLC Player

Open the VLC player and choose the /dev/video0 from the capture device.


From Adjustments and Effects menu v4l2 controls page, you can select external trigger mode, adjust the exposure and gain settings.



OpenCV will buffer one frame, so you have to trigger twice before getting the first frame.