ARO234 - capturing with external signal

UC-788 rev. B is my camera, bought from uctronics.com

I’m lost with the instructions that came with the camera and I am not able to capture frames to jpg files using the external signal.

  • using RPi 4 with the lates Bullseye.and edited the “config.txt” for the latest kernel drivers to be used.

  • The camera seems to work ok and I can capture one shot still images using " libcamera-still -t 10 -o test.jpg "

  • the external 1.8V triggering signal is good and stable (driven from LM358 voltage follower and 817 opto).

  • I can see the framerate reading in the preview frame title being the same determined by high/low triggering so the triggering happens and I can also see the trigger pulses in my oscilloscope.

Here is the relevant part of the code modified from trgger.py example.

os.system(‘clear’)
os.system(“libcamera-still -t 0 --shutter 2000 -brightness 0.1 &”)
os.system(“v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=1 &”)

picsCount=0
print(“Start Trigger! Press CTRL+C to exit”)

try:
while 1:
print(“HIGH”)
GPIO.output(PIN11, GPIO.HIGH)
time.sleep(0.001)

    print("LOW")
    GPIO.output(PIN11, GPIO.LOW)
    if GPIO.input(PIN31)==0:
        picsCount = picsCount + 1
        print(picsCount)
    time.sleep(0.127)

except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
os.system(“v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=0 &”)
GPIO.cleanup() # cleanup all GPIO
print(“Done Cleanup”)

In the instructions it is only said to use “libcamera-still -t 0 --shutter 1000” and then start the external signal, without any pointing to how to save the captured frames to files.

I have tried many options in the above os.system(“libcamera-still -t 0 --shutter 2000 -brightness 0.1 &”) but can’t get any frames saved to files.

Please advice, don’t know what to try next.

@carro

You can refer to the code I wrote before, you need to use picamera2

All right, thank you!

PS. Do you happen to have the same trigger examples written in C++, I’m more used to that than Python?

Thanks,

carro

@carro

Sorry, picamera2 is a simple development tool provided by Raspberry Pi. If you want to use C/C++, you need to program with libcamera source code, we don’t have related examples.

If you want to develop your own, you can refer to the project that relies on libcamera source code.

OK and thanks again.

Carro

Well, I got opencv4 installed and working on the RPi4 but I can’t make any sense of the ExternalTriggerExample.py which probably is what I’m looking for.

There is not a single line of comment explaining what that program does and how it proceeds say thru the threading for instance and no examples of how args are used starting for external triggering.

I was able to get a test picture by fooling around with the args and parameters but no consistency and working hours get wasted but no triggering with external pulse. Can you please explain very clearly what that code does, how that code should work and how to set it up for external triggering.

It is not too much to as that we get properly commented and explained code with working examples for these cameras. I really need proper examples for python as I am not that experienced with its finesses.

Thank you.