OG02B10 Camera, single shot, single picture, external trigger

Hello there.

I have a OG02B10 Camera and a RPI4. I want to capture one picture by one external trigger pulse.
PI4 creates trigger pulse when pressing a ‘p’ button. I measured the pulse and it look ok.
See picture with trigger pulse and strobe.

Problem is, that I need to generate at least 6 trigger pulses until I can get finally a jpg picture from the camera. (See the small pyhton script here)

So question is, can OG02B10 get one picture by one external trigger shot ? If yes, what am I doing wrong ? If no, what camera can do that ?

import RPi.GPIO as GPIO
from gpiozero import Button
import time
from os import system, name
import subprocess
import libcamera
import libcamera
libcamera.ColorSpace.Sycc = libcamera.ColorSpace.Jpeg
from libcamera import Transform
from socket import error as SocketError
from socket import timeout
from threading import *
from sys import exit
from libcamera import Transform
from picamera2 import Picamera2, Preview, Controls,CameraConfiguration
from http import server
from threading import Condition, Thread
from picamera2.encoders import JpegEncoder
from picamera2.outputs import FileOutput
from sshkeyboard import listen_keyboard,stop_listening
from functools import partial
from queue import Queue
from time import sleep

is_released = True

def run_cmd(cmd):
print(f’{cmd}‘)
try:
p = subprocess.run(cmd, universal_newlines=True, check=False, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(p.stdout)
print(“Set up successfully.”)
except RuntimeError as e:
print(f’Error: {e}’)
except:
print(“Set up error!”)

def release(key):
global is_released
#print(“released”)
is_released=True

def press(key):
global is_released
try:
#print(“pressed”)
if is_released:
c = 1
if key == “p”:
while c <= 1:
GPIO.output(27, GPIO.HIGH)
time.sleep(0.0001)
GPIO.output(27, GPIO.LOW)
time.sleep(0.01)
c = c + 1
picam2.stop()
picam2.close()
#print(“p pressed”)
except:
bForcedExit = True

def myHardwareKeythread( threadName, delay):
#print (“%s: %s” % ( threadName, time.ctime(time.time()) ))
while True:
if GPIO.wait_for_edge(17,GPIO.RISING):
print (“Hardware Button pressed”)
GPIO.output(27, GPIO.HIGH)
time.sleep(0.00005)
GPIO.output(27, GPIO.LOW)
time.sleep(0.032)
sleep(0.5)#prellen verhindern

#remote SSH Keyboard
def myKeythread( threadName, delay):
#print (“%s: %s” % ( threadName, time.ctime(time.time()) ))
try:
listen_keyboard(on_press=press,on_release=release)
except KeyboardInterrupt:
print(“myKeythread key intrpt, will exit now”)
exit()
except:
print(“myKeythread exception”)
finally:
print(“—> exit Keythread”)

GPIO.setwarnings(False)
GPIO.setmode (GPIO.BCM)
GPIO.setup (27, GPIO.OUT)
GPIO.output(27, GPIO.LOW)
GPIO.setup(17, GPIO.IN)
t1=Thread(target=myKeythread, args=(“Keys”, 2, ))
t2=Thread(target=myHardwareKeythread, args=(“Keys”, 2, ))
t1.start()
t2.start()
#run_cmd(“v4l2-ctl -l -d /dev/v4l-subdev0”)# show possible user controls
set_trigger_mode = “v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=1”
run_cmd(set_trigger_mode)
#run_cmd(“v4l2-ctl --get-ctrl”)
#run_cmd(“v4l2-ctl --all”)
#run_cmd(“v4l2-ctl --list-ctrls”)
#run_cmd(“v4l2-ctl --list-devices”)
#clsrun_cmd(“v4l2-ctl --list-formats-ext -d 0”)

picam2 = Picamera2()
picam2.configure(picam2.create_preview_configuration())
picam2.set_controls({“ExposureTime”: 1000})
picam2.start()
print(“Wait Pic, press ‘p’”)
metadata = picam2.capture_file(“camtest.jpg”)
print(“captured”)
t1.join()
GPIO.cleanup() # cleanup all GPIO