Libcamera-still not saving timestamped jpg files with AR0234 on Raspberry Pi 3

Hi, I’m using a Pivariety AR0234 global shutter camera (uctronics SKU B0353, PCB UC-788 Rev. B) on a Raspberry Pi 3. The camera is triggered by an external 1.8Vdc signal from a machine. The trigger seems to work because the frame appears in the preview window, but no JPG files get saved. It’s like none of the libcamera-still file saving options work, including saving pictures with the timestamp as name that’s described in libcamera-still --help. I need to actually get JPG photos of the targets, not just a preview. Does anyone have a code example for saving captured pictures with a unix timestamp from the AR0234?

Welcome. A few details would help: which libcamera-still version are you on, and can you paste the exact command you’re running? Also, when you say ‘unix timestamp as name’, do you actually need the raw timestamp, or do you just need the files to have unique/indexed names so they don’t overwrite each other?

Environment: Pivariety AR0234 global shutter camera from uctronics.com, SKU B0353, PCB UC-788 Rev. B, Raspberry Pi 3, external 1.8Vdc trigger signal from a machine. The external signal triggers capture and the images are visible in the preview window, but no JPG files are saved. I tried the file saving options from the help output and none of them produced files. About the naming - I originally asked for a unix timestamp, but the timestamp is in milliseconds. What I actually need is indexing of the captured picture filenames.

That makes sense. For indexed filenames, check the --output examples in libcamera-still --help. Something like -o /home/pi/captures/image_%04d.jpg should give you image_0001.jpg, image_0002.jpg, etc. If the preview is working but the files never appear, it’s usually the output path, permissions, or the command syntax rather than the camera itself. Could you paste the exact libcamera-still line that failed? There are also several AR0234 threads on the Arducam forum, and they cover this external-trigger scenario.

I started a topic over on the Arducam forum with all the AR0234 details: ARO234 - capturing with external signal. The replies there resolved it. The main point was the same as yours - I needed indexed filenames rather than a millisecond timestamp. The JPGs now save correctly. Thanks for the pointers.

Good to hear. For anyone landing here later: the external 1.8Vdc trigger captures frames fine, but the JPGs still need to be written with indexed filenames so each shot gets its own file. The discussion is at ARO234 - capturing with external signal.

I’ve got a new issue now. I’m trying the sample ExternalTriggerExample.py from the picamera2_examples repo and it doesn’t work. Thread1 (external trigger capture) does nothing - RGB888 = None. Thread2 (keyboard capture) works. Why would the external trigger thread return None?

That example is very dependent on where the trigger signal is connected and how the script waits for it. Which repo/version are you using? And have you measured the trigger signal at the camera side of the cable, or only at the GPIO end?

The reference is GitHub - ArduCAM/picamera2_examples · GitHub. I measured the external trigger signal on the cable going from GPIO to the AR0234, and it looks fine there.

Can you post the relevant snippet and the exact log output? Specifically, how Thread1 waits for the trigger and where RGB888 = picam2.capture_array("main") is being called. Also, if you can, confirm whether the signal is actually present at the camera connector pin when the machine fires, not just along the cable.

Sure. In the script, Thread2 uses RGB888 = picam2.capture_array("main") and that works. Thread1 is the external trigger path and it just logs RGB888 = None. So the keyboard capture path works, but the external trigger path returns None and never saves an image.

Based on that, the camera and the capture_array call are fine - Thread2 proves that. The None in Thread1 suggests the trigger condition either isn’t being met, or the signal isn’t reaching the input the example expects. If you have a multimeter or scope, measure right at the AR0234 trigger pin while the machine fires. Also double-check the wiring/pin mapping against the example - the signal may look fine at the GPIO end but not arrive at the card correctly.

I measured a good quality trigger signal on the cable going from GPIO to the AR0234, but I’m not sure whether it does what it’s supposed to do at the card itself. Does anyone have working code for this, or could the camera be defective? Also, what exactly does the external trigger signal do on the card, and how should I measure it at the card?

To recap where we are: the original libcamera-still save issue was resolved via the Arducam forum thread (ARO234 - capturing with external signal), and the working solution was to use indexed filenames rather than millisecond timestamps. The current problem with ExternalTriggerExample.py is still open: Thread2/keyboard capture works and returns a valid RGB888, while Thread1/external trigger returns RGB888 = None. Since the normal capture path works, the camera itself is probably fine - the external trigger signal is the suspect. Next step is to verify the signal at the actual trigger input pin on the AR0234 with a scope/multimeter while the machine fires, and compare that against the pin/edge the example expects. I don’t have a confirmed working replacement script yet, so I wouldn’t call the camera defective until the signal at the card is verified.