ArduCAM / ArduCAM_USB_Camera_Shield

This is the repository for ArduCAM USB Camera Shield
126 stars 69 forks source link

Capture Procedure in External Trigger Mode #53

Open atfields43 opened 5 years ago

atfields43 commented 5 years ago

Hi,

I have an issue with the external trigger mode on an AR0134 connected to the Arducam USB 2.0 camera shield, which is connected to a raspberry pi. the camera works great in auto (video) mode both on the raspberry pi python demo and on the Windows GUI. But I want a very simple procedure to take place to capture an image when externally triggered.

External trigger pin goes high. Capture image (controlled exposure time) Read image in (to be done with what I will, like save, analyze,etc) wait for next trigger.

I know setting R0x301a to 0x1982 puts it in trigger mode setting R0x3012, R0x3016 sets exposure time but I dont see any documentation or examples of how to just grab a picture when the device is triggered? Do I need to manually check the value of the trigger pin, and when it is high, beginCapture, Capture, endCapture myself? Or does it automatically do this when in trigger mode, then I simply have to retrieve it with the usual read image instruction set?

I can't get anything to work as soon as I deviate from the auto mode script. Every time I try to capture a single image triggered by an external trigger (Raspberry pi GPIO going high), I get a USB data len error and don't get a picture.

Seems like it should be very easy to implement this, as many camera systems rely on the fact that they should take a picture when externally triggered, but I've scoured all the User Guides and Developer Guides for the AR0134 I can find, including a previous Issue for trigger mode for the AR0134, which simply tells me how to set the registers, nothing about the capture sequence.

Any help would be appreciated, I can share my modified code if that is helpful.

UPDATE: I now have Trigger mode working and use the FLASH output pin to see that it is indeed exposing the pixels for the correct exposure time, but still, imageAvailable is reading 0, im not sure how to get that image that was just taken onto my processor.

skypanther commented 5 years ago

I need the same functionality. Please share what you discover. I'll do the same. Thanks!

atfields43 commented 5 years ago

@skypanther It works in Auto Trigger Mode on the Windows GUI, just set the R0x301a to 0x1982 and set the trigger pin HIGH externally. However, still can't get pulsed trigger to work where a single trigger comes in and it records an image. But I must be close since Auto Trigger is working and I see that the camera is exposing an image in Pulsed Trigger mode. Will update, and please do the same

lionfish0 commented 5 years ago

I've found the same thing - thanks for the tip about using the 'flash' output to drive the flash. It's not ideal, but this should work sufficiently well at least for now. Ideally I'd like to be able to select exactly when the image is captured.

lionfish0 commented 5 years ago

Did anyone manage to get this working - I realise there are several related issues on here.

https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/issues/101 Maybe https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/issues/67

skypanther commented 5 years ago

I had manual triggering of the cameras working. Some sample python code is at https://gist.github.com/skypanther/4563ffde6fc38c1c9c7675afec9dab41

I no longer have this hardware so I can't really support the code if there are issues (hence it being a gist rather than a repo).

lionfish0 commented 5 years ago

Thanks @skypanther I've looked through your code, but I can't see any differences that might explain why yours works but mine doesn't.

By the way: I got it working with a weird hack (see https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/issues/101#issuecomment-509717856 ). I wonder if the difference is because I'm using the AR0135, not the 134?

(sorry about posting to multiple issues).

lionfish0 commented 5 years ago

Thanks to @glddiv - my problem/confusion is solved. I didn't appreciate I was supposed to be sending my trigger pulses to the 'trigger' pin on the USB camera shield (I didn't even know it had a trigger pin to be honest). Fantastic. Thanks everyone.

pritorius commented 4 years ago

Hello, Hope you are well. I need some help about on using Arducam. I have 3 MT9V034 cameras with usb camera shield (UC-391 Rev D). I need to setup these 3 cameras to be synchronized.

As far as I understand, I need to use the following code: https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/blob/master/Linux_x86/Cpp/External_trigger_demo/ArduCam_Ext_Trigger_Demo.cpp with config file:https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/blob/master/cpp_config/MT9V034_VGA_Stereo.yml

but I am little confused about how the hardware setup should be. As far as I understand:

  1. All 3 cameras should be set in External Trigger mode.
  2. The "External Trigger interface of the UC-391 Rev D of the middle camera should be attached to the trigger input of the left and right camera board ( Please find attached image).
  3. So, when I call read Image on the middle camera, the external trigger from the middle camera should also fire on the left and right camera.
  4. I read images from all 3 camera buffer.

Do you think this is a somewhat reasonable setup? Regards, 3 Camera Stereo

tuananh8693 commented 3 years ago

Dear all, I want to use an external trigger with Arducam Cmos AR0134 However, when using Arducam SDK on Pi 4, FPS is 10fps Can I increase the speed to at least 25fps? Please help me