Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • in reply to: Synchronising 2 AR0134 with Usb3.0 Camera Schield #21262

    The problem has been solved. It had a problem connecting the trigger pin.

    Kind regards

    in reply to: Synchronising 2 AR0134 with Usb3.0 Camera Schield #21239

    Hello there,

    thank you for your quick response.

    External trigger: usually an external trigger could be a signal that puts the trigger pin in camera module high. So i used an square wave which has a period of 25 millisecond (frequency 40 Hz), whereas it is high for 1 millisecond and low for the rest of time (24 millisecond).

    Auto trigger : in auto trigger, it’s not a squre wave but a constant signal. Lets say, it puts the camera trigger pin high at time, t = 0  and stays high for the rest of the time .

    I’m using an arduino uno board to produce the above described signal. Trigger pins and Gnd pins of both cameras are parallel connected with an arduino uno. To find out if the frames are synchronised, I use a digital stop watch app from smartphone and save the frames with a time stamp. Every time stamp has 4 consequent frames for each camera.

    Description of Code:

    Three threads are initialised, two threads for CaptureImage, each one with its own Handle (ArduCamHandle) and one thread for readImage with two Handles. In readImage function a little modification has been done. The “while” loop looks like this:


    beginTime = clock(); //time stamp

    vector<cv::Mat> Bilder1, Bilder2;


    if (ArduCam_avaiableImage(handle) > 0 && ArduCam_availableImage(handle2) > 0) {

    rtn_val = Arducam_readImage(handle, frameData);
    rtn_val2 = Arducam_readImage(handle2, frameData2);

    if (rn_val == USB_CAMERA_NO_ERROR && rn_val2 == USB_CAMERA_NO_ERROR) {

    int begin_disp = clock();

    rawImage = ConvertImage(frameData); rawImage2 = ConvertImage(frameData2);

    if (!rawImage.data || !rawImage2.data){

    std::cout << “No image data \n”;

    Bilder1.push_back(rawImage.clone());  // To append the frames in the vector


    if (Bilder1.size()==5){

    if (save_flag){

    for (int i = 1; i< Bilder1.size(); i++){

    ……. // some other codes for image processing…………..

    //Image name with a time stamp

    sprintf(imageName,”Cam1/%ld_%d.jpg”, beginTime, i);

    sprintf(imageName2,”Cam2/%ld_%d.jpg”, beginTime, i);

    cv::imwrite(imageName, Bilder1[i]);

    cv::imwrite(imageName2, Bilder2[i]); }


    // To empty the Vectors

    vector<cv::Mat>().swap(Bilder1); vector<cv::Mat>().swap(Bilder2);                                                        beginTime = clock(); //New time stamp for next image series


    ArduCam_del(handle); ArduCam_del(handle2);





    The external trigger connection with the camera module can be seen in the following picture.

    connection to trigger and gnd in CameraModule



    Kind regards

    in reply to: Synchronising 2 AR0134 with Usb3.0 Camera Schield #21242

    Hello Bin,

    I woluld like to thank you for your quick response.

    My last post (March 5, 2020) is still awaiting moderation.

    Auto trigger is still an external trigger; the differecne is the trigger pin stays always high in auto trigger mode, whereas in pulsed trigger it is an squre wave signal, lets say, it stays for 1 millisecond high and for 24 millisecond low, so that it has a period of 25 millisecond (i.e frequency of 40 hz).

    Hardware setting: The trigger and gnd pins of both camera modules has been connected parallel with an arduino uno digital pin (pin 13) and digital gnd pin. Arduino uno produces an output of constant 5 V in auto trigger mode and in pulsed trigger mode a squaure wave signal with a peak of 5 V in 40 Hz frequency as above described.

    Code description: Two threads of captureImage with different handles (for 2 cameras) are initialised. The frames from both cameras are appended in two different vectors in readImage thread. Once the size of these vector is 5 and the save_flag (boolean) is true the program saves those frames in JPEG format in instructed path with a time stamp (naming convention: timeStamp_frameNumber) and empties the vectors afterwards (if save_flag is false, it skips the saving part).

    Assesment of phase difference: To determine, if the cameras are synchronised or not, a digital stop watch with an accuracy of 0.01 second was hold in front of those cameras and the frames  have been saved with time stamp which could be assesed later on.


    However, the frames are almost synchronised, from 5 frames with an identical time stamp perhaps 2 or 3 (the number differs in different time stamp) are synchronised and the rests are not. Besides, the frame rates are not constant. The time differences between frame to frame are not always same. And this is in the event of auto trigger mode.

    In case of pulsed trigger, the frames are not synchronised at all.


    Hopefully, this description helps you to find out the problem.

    Thank you again,

    Warm regards

Viewing 3 posts - 1 through 3 (of 3 total)